1
0
mirror of https://e.coding.net/circlecloud/Residence.git synced 2024-10-31 22:38:48 +00:00

recovery Residence class...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-09-30 08:39:39 +08:00
parent cbefdc9ac2
commit b37e43a23f
2 changed files with 144 additions and 111 deletions

View File

@ -0,0 +1,143 @@
package com.bekvon.bukkit.residence;
import java.io.File;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import com.bekvon.bukkit.residence.chat.ChatManager;
import com.bekvon.bukkit.residence.economy.EconomyInterface;
import com.bekvon.bukkit.residence.economy.TransactionManager;
import com.bekvon.bukkit.residence.economy.rent.RentManager;
import com.bekvon.bukkit.residence.itemlist.WorldItemManager;
import com.bekvon.bukkit.residence.manager.ConfigManager;
import com.bekvon.bukkit.residence.manager.EntityManager;
import com.bekvon.bukkit.residence.permissions.PermissionManager;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
import com.bekvon.bukkit.residence.protection.LeaseManager;
import com.bekvon.bukkit.residence.protection.PermissionListManager;
import com.bekvon.bukkit.residence.protection.ResidenceManager;
import com.bekvon.bukkit.residence.protection.WorldFlagManager;
import com.bekvon.bukkit.residence.selection.SelectionManager;
import com.bekvon.bukkit.residence.text.Language;
import com.bekvon.bukkit.residence.text.help.HelpEntry;
public class Residence extends JavaPlugin {
static ResidenceMain instance;
public Residence(final ResidenceMain instance) {
Residence.instance = instance;
}
public static ChatManager getChatManager() {
return instance.chatmanager;
}
public static ConfigManager getConfigManager() {
return instance.cmanager;
}
public static File getDataLocation() {
return instance.dataFolder;
}
public static Map<String, String> getDeleteConfirm() {
return instance.deleteConfirm;
}
public static EconomyInterface getEconomyManager() {
return instance.economy;
}
public static EntityManager getEntityManager() {
return instance.entitymanager;
}
public static HelpEntry getHelppages() {
return instance.helppages;
}
public static WorldItemManager getItemManager() {
return instance.imanager;
}
public static Language getLanguage() {
if (instance.language == null) {
instance.language = new Language();
}
return instance.language;
}
public static LeaseManager getLeaseManager() {
return instance.leasemanager;
}
public static PermissionListManager getPermissionListManager() {
return instance.pmanager;
}
public static PermissionManager getPermissionManager() {
return instance.gmanager;
}
public static FlagPermissions getPermsByLoc(final Location loc) {
final ClaimedResidence res = instance.rmanager.getByLoc(loc);
if (res != null) {
return res.getPermissions();
} else {
return instance.wmanager.getPerms(loc.getWorld().getName());
}
}
public static FlagPermissions getPermsByLocForPlayer(final Location loc, final Player player) {
final ClaimedResidence res = instance.rmanager.getByLoc(loc);
if (res != null) {
return res.getPermissions();
} else if (player != null) {
return instance.wmanager.getPerms(player);
} else {
return instance.wmanager.getPerms(loc.getWorld().getName());
}
}
public static RentManager getRentManager() {
return instance.rentmanager;
}
public static ResidenceManager getResidenceManager() {
return instance.rmanager;
}
public static SelectionManager getSelectionManager() {
return instance.smanager;
}
public static TransactionManager getTransactionManager() {
return instance.tmanager;
}
public static WorldFlagManager getWorldFlags() {
return instance.wmanager;
}
public static boolean isResAdminOn(final Player player) {
if (instance.resadminToggle.contains(player.getName())) {
return true;
}
return false;
}
public static boolean isResAdminOn(final String player) {
if (instance.resadminToggle.contains(player.toLowerCase())) {
return true;
}
return false;
}
public static boolean isUseWorldEdit() {
return instance.useWorldEdit;
}
}

View File

@ -511,6 +511,7 @@ public class ResidenceMain extends JavaPlugin {
}
this.getLogger().info("载入完成! 版本: " + this.getDescription().getVersion() + " 重制 by 喵♂呜");
backup = new DataBackup(this);
new Residence(this);
init = true;
} catch (final Exception ex) {
this.getServer().getPluginManager().disablePlugin(this);
@ -765,115 +766,4 @@ public class ResidenceMain extends JavaPlugin {
this.getLogger().info("保存默认 " + lang + " 语言文件...");
}
}
public static class Residence extends JavaPlugin {
public static ChatManager getChatManager() {
return instance.chatmanager;
}
public static ConfigManager getConfigManager() {
return instance.cmanager;
}
public static File getDataLocation() {
return instance.dataFolder;
}
public static Map<String, String> getDeleteConfirm() {
return instance.deleteConfirm;
}
public static EconomyInterface getEconomyManager() {
return instance.economy;
}
public static EntityManager getEntityManager() {
return instance.entitymanager;
}
public static HelpEntry getHelppages() {
return instance.helppages;
}
public static WorldItemManager getItemManager() {
return instance.imanager;
}
public static Language getLanguage() {
if (instance.language == null) {
instance.language = new Language();
}
return instance.language;
}
public static LeaseManager getLeaseManager() {
return instance.leasemanager;
}
public static PermissionListManager getPermissionListManager() {
return instance.pmanager;
}
public static PermissionManager getPermissionManager() {
return instance.gmanager;
}
public static FlagPermissions getPermsByLoc(final Location loc) {
final ClaimedResidence res = instance.rmanager.getByLoc(loc);
if (res != null) {
return res.getPermissions();
} else {
return instance.wmanager.getPerms(loc.getWorld().getName());
}
}
public static FlagPermissions getPermsByLocForPlayer(final Location loc, final Player player) {
final ClaimedResidence res = instance.rmanager.getByLoc(loc);
if (res != null) {
return res.getPermissions();
} else if (player != null) {
return instance.wmanager.getPerms(player);
} else {
return instance.wmanager.getPerms(loc.getWorld().getName());
}
}
public static RentManager getRentManager() {
return instance.rentmanager;
}
public static ResidenceManager getResidenceManager() {
return instance.rmanager;
}
public static SelectionManager getSelectionManager() {
return instance.smanager;
}
public static TransactionManager getTransactionManager() {
return instance.tmanager;
}
public static WorldFlagManager getWorldFlags() {
return instance.wmanager;
}
public static boolean isResAdminOn(final Player player) {
if (instance.resadminToggle.contains(player.getName())) {
return true;
}
return false;
}
public static boolean isResAdminOn(final String player) {
if (instance.resadminToggle.contains(player.toLowerCase())) {
return true;
}
return false;
}
public static boolean isUseWorldEdit() {
return instance.useWorldEdit;
}
}
}