From fad62fcf3db94ea98885acadc6315a14babbe784 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Fri, 29 May 2015 06:55:33 +0800 Subject: [PATCH] fix onEnable Error... Signed-off-by: j502647092 --- .../bukkit/residence/ConfigManager.java | 500 ++++++------ .../bekvon/bukkit/residence/Residence.java | 83 +- .../residence/ResidenceCommandListener.java | 735 +++++++----------- 3 files changed, 540 insertions(+), 778 deletions(-) diff --git a/src/com/bekvon/bukkit/residence/ConfigManager.java b/src/com/bekvon/bukkit/residence/ConfigManager.java index 68d4ef0..eb23a3b 100644 --- a/src/com/bekvon/bukkit/residence/ConfigManager.java +++ b/src/com/bekvon/bukkit/residence/ConfigManager.java @@ -1,289 +1,267 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * To change this template, choose Tools | Templates and open the template in the editor. */ package com.bekvon.bukkit.residence; -import org.bukkit.ChatColor; - -import com.bekvon.bukkit.residence.protection.FlagPermissions; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; +import com.bekvon.bukkit.residence.protection.FlagPermissions; + /** * * @author Administrator */ public class ConfigManager { - protected String defaultGroup; - protected boolean useLeases; - protected boolean enableEconomy; - protected String economySystem; - protected boolean adminsOnly; - protected boolean allowEmptyResidences; - protected int infoToolId; - protected int selectionToolId; - protected boolean adminOps; - protected String multiworldPlugin; - protected boolean enableRentSystem; - protected boolean leaseAutoRenew; - protected int rentCheckInterval; - protected int leaseCheckInterval; - protected int autoSaveInt; - protected boolean flagsInherit; - protected ChatColor chatColor; - protected boolean chatEnable; - protected boolean actionBar; - protected int minMoveUpdate; - protected FlagPermissions globalCreatorDefaults; - protected FlagPermissions globalResidenceDefaults; - protected Map globalGroupDefaults; - protected String language; - protected boolean preventBuildInRent; - protected boolean stopOnSaveError; - protected boolean legacyperms; - protected String namefix; - protected boolean showIntervalMessages; - protected boolean spoutEnable; - protected boolean enableLeaseMoneyAccount; - protected boolean enableDebug; - protected List customContainers; - protected List customBothClick; - protected List customRightClick; - private boolean enforceAreaInsideArea; + protected String defaultGroup; + protected boolean useLeases; + protected boolean enableEconomy; + protected String economySystem; + protected boolean adminsOnly; + protected boolean allowEmptyResidences; + protected int infoToolId; + protected int selectionToolId; + protected boolean adminOps; + protected String multiworldPlugin; + protected boolean enableRentSystem; + protected boolean leaseAutoRenew; + protected int rentCheckInterval; + protected int leaseCheckInterval; + protected int autoSaveInt; + protected boolean flagsInherit; + protected ChatColor chatColor; + protected boolean chatEnable; + protected boolean actionBar; + protected int minMoveUpdate; + protected FlagPermissions globalCreatorDefaults; + protected FlagPermissions globalResidenceDefaults; + protected Map globalGroupDefaults; + protected String language; + protected boolean preventBuildInRent; + protected boolean stopOnSaveError; + protected boolean legacyperms; + protected String namefix; + protected boolean showIntervalMessages; + protected boolean spoutEnable; + protected boolean enableLeaseMoneyAccount; + protected boolean enableDebug; + protected List customContainers; + protected List customBothClick; + protected List customRightClick; + private boolean enforceAreaInsideArea; - public ConfigManager(FileConfiguration config) - { - globalCreatorDefaults = new FlagPermissions(); - globalResidenceDefaults = new FlagPermissions(); - globalGroupDefaults = new HashMap(); - this.load(config); - } + public ConfigManager(FileConfiguration config) { + globalCreatorDefaults = new FlagPermissions(); + globalResidenceDefaults = new FlagPermissions(); + globalGroupDefaults = new HashMap(); + this.load(config); + } - @SuppressWarnings("deprecation") + public boolean allowAdminsOnly() { + return adminsOnly; + } + + public boolean allowEmptyResidences() { + return allowEmptyResidences; + } + + public boolean autoRenewLeases() { + return leaseAutoRenew; + } + + public boolean chatEnabled() { + return chatEnable; + } + + public boolean debugEnabled() { + return enableDebug; + } + + public boolean enabledRentSystem() { + return enableRentSystem && enableEconomy(); + } + + public boolean enableEconomy() { + return enableEconomy && Residence.getEconomyManager() != null; + } + + public boolean enableLeaseMoneyAccount() { + return enableLeaseMoneyAccount; + } + + public boolean enableSpout() { + return spoutEnable; + } + + public boolean flagsInherit() { + return flagsInherit; + } + + public int getAutoSaveInterval() { + return autoSaveInt; + } + + public ChatColor getChatColor() { + return chatColor; + } + + public List getCustomBothClick() { + return customBothClick; + } + + public List getCustomContainers() { + return customContainers; + } + + public List getCustomRightClick() { + return customRightClick; + } + + public String getDefaultGroup() { + return defaultGroup; + } + + public String getEconomySystem() { + return economySystem; + } + + public boolean getEnforceAreaInsideArea() { + return enforceAreaInsideArea; + } + + public FlagPermissions getGlobalCreatorDefaultFlags() { + return globalCreatorDefaults; + } + + public Map getGlobalGroupDefaultFlags() { + return globalGroupDefaults; + } + + public FlagPermissions getGlobalResidenceDefaultFlags() { + return globalResidenceDefaults; + } + + public int getInfoToolID() { + return infoToolId; + } + + public String getLanguage() { + return language; + } + + public int getLeaseCheckInterval() { + return leaseCheckInterval; + } + + public int getMinMoveUpdateInterval() { + return minMoveUpdate; + } + + public String getMultiworldPlugin() { + return multiworldPlugin; + } + + public boolean getOpsAreAdmins() { + return adminOps; + } + + public int getRentCheckInterval() { + return rentCheckInterval; + } + + public String getResidenceNameRegex() { + return namefix; + } + + public int getSelectionTooldID() { + return selectionToolId; + } + + @SuppressWarnings("deprecation") private void load(FileConfiguration config) { - defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase(); - adminsOnly = config.getBoolean("Global.AdminOnlyCommands", false); - useLeases = config.getBoolean("Global.UseLeaseSystem", false); - leaseAutoRenew = config.getBoolean("Global.LeaseAutoRenew", true); - enableEconomy = config.getBoolean("Global.EnableEconomy", false); - economySystem = config.getString("Global.EconomySystem", "iConomy"); - infoToolId = config.getInt("Global.InfoToolId", Material.STRING.getId()); - selectionToolId = config.getInt("Global.SelectionToolId", Material.WOOD_AXE.getId()); - adminOps = config.getBoolean("Global.AdminOPs", true); - multiworldPlugin = config.getString("Global.MultiWorldPlugin"); - enableRentSystem = config.getBoolean("Global.EnableRentSystem", false); - rentCheckInterval = config.getInt("Global.RentCheckInterval", 10); - leaseCheckInterval = config.getInt("Global.LeaseCheckInterval", 10); - autoSaveInt = config.getInt("Global.SaveInterval", 10); - flagsInherit = config.getBoolean("Global.ResidenceFlagsInherit", false); - minMoveUpdate = config.getInt("Global.MoveCheckInterval", 500); - chatEnable = config.getBoolean("Global.ResidenceChatEnable", true); - actionBar = config.getBoolean("Global.UseActionBar", true); - enforceAreaInsideArea = config.getBoolean("Global.EnforceAreaInsideArea", false); - language = config.getString("Global.Language","English"); - globalCreatorDefaults = FlagPermissions.parseFromConfigNode("CreatorDefault", config.getConfigurationSection("Global")); - globalResidenceDefaults = FlagPermissions.parseFromConfigNode("ResidenceDefault", config.getConfigurationSection("Global")); - preventBuildInRent = config.getBoolean("Global.PreventRentModify", true); - stopOnSaveError = config.getBoolean("Global.StopOnSaveFault",true); - legacyperms = config.getBoolean("Global.LegacyPermissions",false); - namefix = config.getString("Global.ResidenceNameRegex",null);//"[^a-zA-Z0-9\\-\\_]" - showIntervalMessages = config.getBoolean("Global.ShowIntervalMessages", false); - spoutEnable = config.getBoolean("Global.EnableSpout", false); - enableLeaseMoneyAccount = config.getBoolean("Global.EnableLeaseMoneyAccount", true); - enableDebug = config.getBoolean("Global.EnableDebug", false); - customContainers = config.getIntegerList("Global.CustomContainers"); - customBothClick = config.getIntegerList("Global.CustomBothClick"); - customRightClick = config.getIntegerList("Global.CustomRightClick"); - ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault"); - if(node!=null) - { - Set keys = node.getConfigurationSection(defaultGroup).getKeys(false); - if(keys!=null) - { - for(String key: keys) - { - globalGroupDefaults.put(key, FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.GroupDefault"))); - } - } - } - try { - chatColor = ChatColor.valueOf(config.getString("Global.ResidenceChatColor", "DARK_PURPLE")); - } catch (Exception ex) { - chatColor = ChatColor.DARK_PURPLE; - } - } + defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase(); + adminsOnly = config.getBoolean("Global.AdminOnlyCommands", false); + useLeases = config.getBoolean("Global.UseLeaseSystem", false); + leaseAutoRenew = config.getBoolean("Global.LeaseAutoRenew", true); + enableEconomy = config.getBoolean("Global.EnableEconomy", false); + economySystem = config.getString("Global.EconomySystem", "iConomy"); + infoToolId = config.getInt("Global.InfoToolId", Material.STRING.getId()); + selectionToolId = config.getInt("Global.SelectionToolId", Material.WOOD_AXE.getId()); + adminOps = config.getBoolean("Global.AdminOPs", true); + multiworldPlugin = config.getString("Global.MultiWorldPlugin"); + enableRentSystem = config.getBoolean("Global.EnableRentSystem", false); + rentCheckInterval = config.getInt("Global.RentCheckInterval", 10); + leaseCheckInterval = config.getInt("Global.LeaseCheckInterval", 10); + autoSaveInt = config.getInt("Global.SaveInterval", 10); + flagsInherit = config.getBoolean("Global.ResidenceFlagsInherit", false); + minMoveUpdate = config.getInt("Global.MoveCheckInterval", 500); + chatEnable = config.getBoolean("Global.ResidenceChatEnable", true); + actionBar = config.getBoolean("Global.UseActionBar", true); + enforceAreaInsideArea = config.getBoolean("Global.EnforceAreaInsideArea", false); + language = config.getString("Global.Language", "English"); + globalCreatorDefaults = FlagPermissions.parseFromConfigNode("CreatorDefault", + config.getConfigurationSection("Global")); + globalResidenceDefaults = FlagPermissions.parseFromConfigNode("ResidenceDefault", + config.getConfigurationSection("Global")); + preventBuildInRent = config.getBoolean("Global.PreventRentModify", true); + stopOnSaveError = config.getBoolean("Global.StopOnSaveFault", true); + legacyperms = config.getBoolean("Global.LegacyPermissions", false); + namefix = config.getString("Global.ResidenceNameRegex", null);// "[^a-zA-Z0-9\\-\\_]" + showIntervalMessages = config.getBoolean("Global.ShowIntervalMessages", false); + spoutEnable = config.getBoolean("Global.EnableSpout", false); + enableLeaseMoneyAccount = config.getBoolean("Global.EnableLeaseMoneyAccount", true); + enableDebug = config.getBoolean("Global.EnableDebug", false); + customContainers = config.getIntegerList("Global.CustomContainers"); + customBothClick = config.getIntegerList("Global.CustomBothClick"); + customRightClick = config.getIntegerList("Global.CustomRightClick"); + ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault"); + if (node != null) { + Set keys = node.getConfigurationSection(defaultGroup).getKeys(false); + if (keys != null) { + for (String key : keys) { + globalGroupDefaults.put( + key, + FlagPermissions.parseFromConfigNode(key, + config.getConfigurationSection("Global.GroupDefault"))); + } + } + } + try { + chatColor = ChatColor.valueOf(config.getString("Global.ResidenceChatColor", + "DARK_PURPLE")); + } catch (Exception ex) { + chatColor = ChatColor.DARK_PURPLE; + } + } - public boolean useLegacyPermissions() - { - return legacyperms; - } + public boolean preventRentModify() { + return preventBuildInRent; + } - public String getDefaultGroup() { - return defaultGroup; - } + public boolean showIntervalMessages() { + return showIntervalMessages; + } - public String getResidenceNameRegex() - { - return namefix; - } + public boolean stopOnSaveError() { + return stopOnSaveError; + } - public boolean enableEconomy() { - return enableEconomy && Residence.getEconomyManager()!=null; - } + public boolean useActionBar() { + return actionBar; + } - public boolean enabledRentSystem() - { - return enableRentSystem && enableEconomy(); - } + public boolean useLeases() { + return useLeases; + } - public boolean useLeases() { - return useLeases; - } - - public boolean allowAdminsOnly() { - return adminsOnly; - } - public boolean allowEmptyResidences() - { - return allowEmptyResidences; - } - public int getInfoToolID() - { - return infoToolId; - } - public int getSelectionTooldID() - { - return selectionToolId; - } - - public boolean getOpsAreAdmins() - { - return adminOps; - } - - public String getMultiworldPlugin() - { - return multiworldPlugin; - } - - public boolean autoRenewLeases() - { - return leaseAutoRenew; - } - - public String getEconomySystem() - { - return economySystem; - } - - public int getRentCheckInterval() - { - return rentCheckInterval; - } - - public int getLeaseCheckInterval() - { - return leaseCheckInterval; - } - - public int getAutoSaveInterval() - { - return autoSaveInt; - } - - public boolean flagsInherit() - { - return flagsInherit; - } - - public boolean chatEnabled() - { - return chatEnable; - } - - public boolean useActionBar() - { - return actionBar; - } - - public ChatColor getChatColor() - { - return chatColor; - } - - public int getMinMoveUpdateInterval() - { - return minMoveUpdate; - } - - public FlagPermissions getGlobalCreatorDefaultFlags() - { - return globalCreatorDefaults; - } - - public FlagPermissions getGlobalResidenceDefaultFlags() - { - return globalResidenceDefaults; - } - - public Map getGlobalGroupDefaultFlags() - { - return globalGroupDefaults; - } - - public String getLanguage() - { - return language; - } - - public boolean preventRentModify() - { - return preventBuildInRent; - } - public boolean stopOnSaveError() - { - return stopOnSaveError; - } - public boolean showIntervalMessages() - { - return showIntervalMessages; - } - public boolean enableSpout() - { - return spoutEnable; - } - public boolean enableLeaseMoneyAccount() - { - return enableLeaseMoneyAccount; - } - public boolean debugEnabled() - { - return enableDebug; - } - - public List getCustomContainers() - { - return customContainers; - } - - public List getCustomBothClick() - { - return customBothClick; - } - - public List getCustomRightClick() - { - return customRightClick; - } - - public boolean getEnforceAreaInsideArea() { - return enforceAreaInsideArea; - } + public boolean useLegacyPermissions() { + return legacyperms; + } } diff --git a/src/com/bekvon/bukkit/residence/Residence.java b/src/com/bekvon/bukkit/residence/Residence.java index 71a6b75..d60d86e 100644 --- a/src/com/bekvon/bukkit/residence/Residence.java +++ b/src/com/bekvon/bukkit/residence/Residence.java @@ -1,6 +1,5 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * To change this template, choose Tools | Templates and open the template in the editor. */ package com.bekvon.bukkit.residence; @@ -57,8 +56,8 @@ import com.bekvon.bukkit.residence.selection.WorldEditSelectionManager; import com.bekvon.bukkit.residence.text.Language; import com.bekvon.bukkit.residence.text.help.HelpEntry; import com.bekvon.bukkit.residence.text.help.InformationPager; +import com.bekvon.bukkit.residence.utils.ZipLibrary; import com.bekvon.bukkit.residence.vaultinterface.ResidenceVaultAdapter; -import com.bekvon.bukkit.residence.vaultinterface.ZipLibrary; import com.earth2me.essentials.Essentials; /** @@ -68,34 +67,34 @@ import com.earth2me.essentials.Essentials; */ public class Residence extends JavaPlugin { - public static String bukkitver; - protected static ResidenceManager rmanager; - protected static SelectionManager smanager; - protected static PermissionManager gmanager; - protected static ConfigManager cmanager; - protected static ResidenceBlockListener blistener; - protected static ResidencePlayerListener plistener; - protected static ResidenceEntityListener elistener; - protected static TransactionManager tmanager; - protected static PermissionListManager pmanager; - protected static LeaseManager leasemanager; - protected static WorldItemManager imanager; - protected static WorldFlagManager wmanager; - protected static RentManager rentmanager; - protected static ChatManager chatmanager; - protected static Server server; - protected static HelpEntry helppages; - protected static Language language; - protected static EconomyInterface economy; - public final static int saveVersion = 1; - protected static File dataFolder; - protected static int leaseBukkitId = -1; - protected static int rentBukkitId = -1; - protected static int healBukkitId = -1; - protected static int autosaveBukkitId = -1; - protected static boolean initsuccess = false; - protected static List resadminToggle; - private final static String[] validLanguages = { "English", "Chinese" }; + public static String bukkitver; + protected static ResidenceManager rmanager; + protected static SelectionManager smanager; + protected static PermissionManager gmanager; + protected static ConfigManager cmanager; + protected static ResidenceBlockListener blistener; + protected static ResidencePlayerListener plistener; + protected static ResidenceEntityListener elistener; + protected static TransactionManager tmanager; + protected static PermissionListManager pmanager; + protected static LeaseManager leasemanager; + protected static WorldItemManager imanager; + protected static WorldFlagManager wmanager; + protected static RentManager rentmanager; + protected static ChatManager chatmanager; + protected static Server server; + protected static HelpEntry helppages; + protected static Language language; + protected static EconomyInterface economy; + public final static int saveVersion = 1; + protected static File dataFolder; + protected static int leaseBukkitId = -1; + protected static int rentBukkitId = -1; + protected static int healBukkitId = -1; + protected static int autosaveBukkitId = -1; + protected static boolean initsuccess = false; + protected static List resadminToggle; + private final static String[] validLanguages = { "English", "Chinese" }; public static ResidenceBlockListener getBlockListener() { return blistener; @@ -217,40 +216,38 @@ public class Residence extends JavaPlugin { } } - protected boolean firstenable = true; + protected boolean firstenable = true; - protected Map deleteConfirm; + protected Map deleteConfirm; - private Runnable doHeals = new Runnable() { + private Runnable doHeals = new Runnable() { @Override public void run() { plistener.doHeals(); } }; - private Runnable rentExpire = new Runnable() { + private Runnable rentExpire = new Runnable() { @Override public void run() { rentmanager.checkCurrentRents(); if (cmanager.showIntervalMessages()) { - System.out - .println("[Residence] - Rent Expirations checked!"); + System.out.println("[Residence] - Rent Expirations checked!"); } } }; - private Runnable leaseExpire = new Runnable() { + private Runnable leaseExpire = new Runnable() { @Override public void run() { leasemanager.doExpirations(); if (cmanager.showIntervalMessages()) { - System.out - .println("[Residence] - Lease Expirations checked!"); + System.out.println("[Residence] - Lease Expirations checked!"); } } }; - private Runnable autoSave = new Runnable() { + private Runnable autoSave = new Runnable() { @Override public void run() { try { @@ -258,9 +255,7 @@ public class Residence extends JavaPlugin { saveYml(); } } catch (Exception ex) { - Logger.getLogger("Minecraft").log( - Level.SEVERE, - "[Residence] 插件数据 保存 错误", ex); + Logger.getLogger("Minecraft").log(Level.SEVERE, "[Residence] 插件数据 保存 错误", ex); } } }; diff --git a/src/com/bekvon/bukkit/residence/ResidenceCommandListener.java b/src/com/bekvon/bukkit/residence/ResidenceCommandListener.java index 9996c8b..d7d06cb 100644 --- a/src/com/bekvon/bukkit/residence/ResidenceCommandListener.java +++ b/src/com/bekvon/bukkit/residence/ResidenceCommandListener.java @@ -1,6 +1,5 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * To change this template, choose Tools | Templates and open the template in the editor. */ package com.bekvon.bukkit.residence; @@ -27,8 +26,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin; public class ResidenceCommandListener extends Residence { - private boolean commandHelp(String[] args, boolean resadmin, - CommandSender sender) { + private boolean commandHelp(String[] args, boolean resadmin, CommandSender sender) { if (helppages != null) { String helppath = "res"; for (String arg : args) { @@ -42,8 +40,7 @@ public class ResidenceCommandListener extends Residence { try { page = Integer.parseInt(args[args.length - 1]); } catch (Exception ex) { - sender.sendMessage(ChatColor.RED - + language.getPhrase("InvalidHelp")); + sender.sendMessage(ChatColor.RED + language.getPhrase("InvalidHelp")); } } if (helppages.containesEntry(helppath)) { @@ -55,10 +52,10 @@ public class ResidenceCommandListener extends Residence { } @SuppressWarnings("deprecation") - private boolean commandRes(String[] args, boolean resadmin, - Command command, CommandSender sender) { - if (args.length > 0 && args[args.length - 1].equalsIgnoreCase("?") - || args.length > 1 && args[args.length - 2].equals("?")) + private boolean commandRes(String[] args, boolean resadmin, Command command, + CommandSender sender) { + if (args.length > 0 && args[args.length - 1].equalsIgnoreCase("?") || args.length > 1 + && args[args.length - 2].equals("?")) return commandHelp(args, resadmin, sender); int page = 1; try { @@ -79,8 +76,7 @@ public class ResidenceCommandListener extends Residence { } if (cmanager.allowAdminsOnly()) { if (!resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("AdminOnly")); + player.sendMessage(ChatColor.RED + language.getPhrase("AdminOnly")); return true; } } @@ -96,18 +92,14 @@ public class ResidenceCommandListener extends Residence { if (cmd.equals("confirm")) return commandResConfirm(args, resadmin, sender, page); if (cmd.equals("version")) { - sender.sendMessage(ChatColor.GRAY - + "------------------------------------"); - sender.sendMessage(ChatColor.RED + "This server running " - + ChatColor.GOLD + "Residence" + ChatColor.RED - + " version: " + ChatColor.BLUE + sender.sendMessage(ChatColor.GRAY + "------------------------------------"); + sender.sendMessage(ChatColor.RED + "This server running " + ChatColor.GOLD + + "Residence" + ChatColor.RED + " version: " + ChatColor.BLUE + this.getDescription().getVersion()); - sender.sendMessage(ChatColor.GREEN + "Created by: " - + ChatColor.YELLOW + "bekvon"); - sender.sendMessage(ChatColor.GREEN + "Updated to 1.8 by: " - + ChatColor.YELLOW + "DartCZ"); - sender.sendMessage(ChatColor.RED + "Updated to 2.7.0.0 by: " - + ChatColor.YELLOW + "喵♂呜"); + sender.sendMessage(ChatColor.GREEN + "Created by: " + ChatColor.YELLOW + "bekvon"); + sender.sendMessage(ChatColor.GREEN + "Updated to 1.8 by: " + ChatColor.YELLOW + + "DartCZ"); + sender.sendMessage(ChatColor.RED + "Updated to 2.7.0.0 by: " + ChatColor.YELLOW + "喵♂呜"); String names = null; List authlist = this.getDescription().getAuthors(); for (String auth : authlist) { @@ -117,24 +109,18 @@ public class ResidenceCommandListener extends Residence { names = names + ", " + auth; } } - sender.sendMessage(ChatColor.GREEN + "Authors: " + ChatColor.YELLOW - + names); - sender.sendMessage(ChatColor.DARK_AQUA - + "For a command list, and help, see the wiki:"); - sender.sendMessage(ChatColor.GREEN - + "http://residencebukkitmod.wikispaces.com/"); - sender.sendMessage(ChatColor.AQUA - + "Visit the Spigot Resource page at:"); + sender.sendMessage(ChatColor.GREEN + "Authors: " + ChatColor.YELLOW + names); + sender.sendMessage(ChatColor.DARK_AQUA + "For a command list, and help, see the wiki:"); + sender.sendMessage(ChatColor.GREEN + "http://residencebukkitmod.wikispaces.com/"); + sender.sendMessage(ChatColor.AQUA + "Visit the Spigot Resource page at:"); sender.sendMessage(ChatColor.BLUE + "http://www.spigotmc.org/resources/residence-reloaded-1-8.2697/"); - sender.sendMessage(ChatColor.GRAY - + "------------------------------------"); + sender.sendMessage(ChatColor.GRAY + "------------------------------------"); return true; } if (cmd.equals("setowner") && args.length == 3) { if (!resadmin) { - sender.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + sender.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } ClaimedResidence area = rmanager.getByName(args[1]); @@ -142,26 +128,18 @@ public class ResidenceCommandListener extends Residence { area.getPermissions().setOwner(args[2], true); if (area.getParent() == null) { sender.sendMessage(ChatColor.GREEN - + language.getPhrase("ResidenceOwnerChange", - ChatColor.YELLOW + " " + args[1] + " " - + ChatColor.GREEN + "." - + ChatColor.YELLOW + args[2] - + ChatColor.GREEN)); + + language.getPhrase("ResidenceOwnerChange", ChatColor.YELLOW + " " + + args[1] + " " + ChatColor.GREEN + "." + ChatColor.YELLOW + + args[2] + ChatColor.GREEN)); } else { sender.sendMessage(ChatColor.GREEN - + language.getPhrase( - "SubzoneOwnerChange", - ChatColor.YELLOW - + " " - + args[1].split("\\.")[args[1] - .split("\\.").length - 1] - + " " + ChatColor.GREEN + "." - + ChatColor.YELLOW + args[2] + + language.getPhrase("SubzoneOwnerChange", ChatColor.YELLOW + " " + + args[1].split("\\.")[args[1].split("\\.").length - 1] + " " + + ChatColor.GREEN + "." + ChatColor.YELLOW + args[2] + ChatColor.GREEN)); } } else { - sender.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + sender.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } @@ -171,14 +149,12 @@ public class ResidenceCommandListener extends Residence { if (args.length == 1 && args[0].equals("on")) { resadminToggle.add(player.getName()); player.sendMessage(ChatColor.YELLOW - + language.getPhrase("AdminToggle", - language.getPhrase("TurnOn"))); + + language.getPhrase("AdminToggle", language.getPhrase("TurnOn"))); return true; } else if (args.length == 1 && args[0].equals("off")) { resadminToggle.remove(player.getName()); player.sendMessage(ChatColor.YELLOW - + language.getPhrase("AdminToggle", - language.getPhrase("TurnOff"))); + + language.getPhrase("AdminToggle", language.getPhrase("TurnOff"))); return true; } } @@ -201,11 +177,10 @@ public class ResidenceCommandListener extends Residence { if (resadmin || args[1].endsWith(pname)) { rmanager.removeAllByOwner(player, args[1]); player.sendMessage(ChatColor.GREEN - + language.getPhrase("RemovePlayersResidences", - ChatColor.YELLOW + args[1] + ChatColor.GREEN)); + + language.getPhrase("RemovePlayersResidences", ChatColor.YELLOW + args[1] + + ChatColor.GREEN)); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); } return true; } @@ -236,8 +211,7 @@ public class ResidenceCommandListener extends Residence { if (area != null) { rmanager.printAreaInfo(area, player); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args.length == 2) { @@ -253,22 +227,19 @@ public class ResidenceCommandListener extends Residence { } ClaimedResidence res = rmanager.getByName(args[1]); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } if (!res.getPermissions().hasApplicableFlag(pname, args[2])) { - player.sendMessage(language.getPhrase("FlagCheckFalse", - ChatColor.YELLOW + args[2] + ChatColor.RED + "." - + ChatColor.YELLOW + pname + ChatColor.RED - + "." + ChatColor.YELLOW + args[1] - + ChatColor.RED)); + player.sendMessage(language.getPhrase("FlagCheckFalse", ChatColor.YELLOW + + args[2] + ChatColor.RED + "." + ChatColor.YELLOW + pname + + ChatColor.RED + "." + ChatColor.YELLOW + args[1] + ChatColor.RED)); } else { player.sendMessage(language .getPhrase( "FlagCheckTrue", ChatColor.GREEN - + args[2] + + args[2] + ChatColor.YELLOW + "." + ChatColor.GREEN @@ -277,15 +248,13 @@ public class ResidenceCommandListener extends Residence { + "." + ChatColor.YELLOW + args[1] - + ChatColor.RED - + "." - + (res.getPermissions().playerHas( - pname, - res.getPermissions() - .getWorld(), - args[2], false) ? ChatColor.GREEN - + "TRUE" - : ChatColor.RED + "FALSE"))); + + ChatColor.RED + + "." + + (res.getPermissions() + .playerHas(pname, + res.getPermissions().getWorld(), + args[2], false) ? ChatColor.GREEN + + "TRUE" : ChatColor.RED + "FALSE"))); } return true; } @@ -296,12 +265,11 @@ public class ResidenceCommandListener extends Residence { return false; String res = rmanager.getNameByLoc(player.getLocation()); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NotInResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("NotInResidence")); } else { player.sendMessage(ChatColor.GREEN - + language.getPhrase("InResidence", ChatColor.YELLOW - + res + ChatColor.GREEN)); + + language.getPhrase("InResidence", ChatColor.YELLOW + res + + ChatColor.GREEN)); } return true; } @@ -333,8 +301,7 @@ public class ResidenceCommandListener extends Residence { } if (cmd.equals("listhidden")) { if (!resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } if (args.length == 1) { @@ -365,8 +332,7 @@ public class ResidenceCommandListener extends Residence { if (args.length == 4) { ClaimedResidence res = rmanager.getByName(args[1]); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } res.renameArea(player, args[2], args[3], resadmin); @@ -379,17 +345,14 @@ public class ResidenceCommandListener extends Residence { return false; group = gmanager.getGroup(player); if (!group.hasUnstuckAccess()) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } ClaimedResidence res = rmanager.getByLoc(player.getLocation()); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NotInResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("NotInResidence")); } else { - player.sendMessage(ChatColor.YELLOW - + language.getPhrase("Moved") + "..."); + player.sendMessage(ChatColor.YELLOW + language.getPhrase("Moved") + "..."); player.teleport(res.getOutsideFreeLoc(player.getLocation())); } return true; @@ -403,18 +366,14 @@ public class ResidenceCommandListener extends Residence { } group = gmanager.getGroup(player); if (!group.hasKickAccess()) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } - ClaimedResidence res = rmanager - .getByLoc(targetplayer.getLocation()); + ClaimedResidence res = rmanager.getByLoc(targetplayer.getLocation()); if (res.getOwner().equals(player.getName())) { if (res.getPlayersInResidence().contains(targetplayer)) { - targetplayer.teleport(res.getOutsideFreeLoc(player - .getLocation())); - targetplayer.sendMessage(ChatColor.RED - + language.getPhrase("Kicked") + "!"); + targetplayer.teleport(res.getOutsideFreeLoc(player.getLocation())); + targetplayer.sendMessage(ChatColor.RED + language.getPhrase("Kicked") + "!"); } } @@ -439,8 +398,7 @@ public class ResidenceCommandListener extends Residence { } if (cmd.equals("listallhidden")) { if (!resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } if (args.length == 1) { @@ -459,19 +417,12 @@ public class ResidenceCommandListener extends Residence { return false; try { player.sendMessage(ChatColor.GREEN - + language.getPhrase( - "MaterialGet", - ChatColor.GOLD - + args[1] - + ChatColor.GREEN - + "." - + ChatColor.RED - + Material.getMaterial( - Integer.parseInt(args[1])) - .name() + ChatColor.GREEN)); + + language.getPhrase("MaterialGet", + ChatColor.GOLD + args[1] + ChatColor.GREEN + "." + ChatColor.RED + + Material.getMaterial(Integer.parseInt(args[1])).name() + + ChatColor.GREEN)); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidMaterial")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidMaterial")); } return true; } @@ -480,8 +431,7 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.setTpLoc(player, resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } @@ -490,8 +440,7 @@ public class ResidenceCommandListener extends Residence { return false; ClaimedResidence res = rmanager.getByName(args[1]); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } res.tpToResidence(player, player, resadmin); @@ -511,78 +460,65 @@ public class ResidenceCommandListener extends Residence { } if (cmd.equals("server")) { if (!resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } if (args.length == 2) { ClaimedResidence res = rmanager.getByName(args[1]); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } res.getPermissions().setOwner("Server Land", false); player.sendMessage(ChatColor.GREEN - + language.getPhrase("ResidenceOwnerChange", - ChatColor.YELLOW + args[1] + ChatColor.GREEN - + "." + ChatColor.YELLOW - + "Server Land" + ChatColor.GREEN)); + + language.getPhrase("ResidenceOwnerChange", ChatColor.YELLOW + args[1] + + ChatColor.GREEN + "." + ChatColor.YELLOW + "Server Land" + + ChatColor.GREEN)); return true; } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } } if (cmd.equals("clearflags")) { if (!resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } ClaimedResidence area = rmanager.getByName(args[1]); if (area != null) { area.getPermissions().clearFlags(); - player.sendMessage(ChatColor.GREEN - + language.getPhrase("FlagsCleared")); + player.sendMessage(ChatColor.GREEN + language.getPhrase("FlagsCleared")); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } if (cmd.equals("tool")) { - player.sendMessage(ChatColor.YELLOW - + language.getPhrase("SelectionTool") + ":" - + ChatColor.GREEN - + Material.getMaterial(cmanager.getSelectionTooldID())); - player.sendMessage(ChatColor.YELLOW - + language.getPhrase("InfoTool") + ": " + ChatColor.GREEN - + Material.getMaterial(cmanager.getInfoToolID())); + player.sendMessage(ChatColor.YELLOW + language.getPhrase("SelectionTool") + ":" + + ChatColor.GREEN + Material.getMaterial(cmanager.getSelectionTooldID())); + player.sendMessage(ChatColor.YELLOW + language.getPhrase("InfoTool") + ": " + + ChatColor.GREEN + Material.getMaterial(cmanager.getInfoToolID())); return true; } return false; } - private boolean commandResArea(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResArea(String[] args, boolean resadmin, Player player, int page) { if (args.length == 4) { if (args[1].equals("remove")) { ClaimedResidence res = rmanager.getByName(args[2]); if (res != null) { res.removeArea(player, args[3], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args[1].equals("add")) { - WorldEditPlugin wep = (WorldEditPlugin) server - .getPluginManager().getPlugin("WorldEdit"); + WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager().getPlugin( + "WorldEdit"); if (wep != null) { - if (wep.getConfig().getInt("wand-item") == Residence - .getConfigManager().selectionToolId) { + if (wep.getConfig().getInt("wand-item") == Residence.getConfigManager().selectionToolId) { smanager.worldEdit(player); } } @@ -591,25 +527,20 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.addArea( player, - new CuboidArea(smanager.getPlayerLoc1(player - .getName()), smanager - .getPlayerLoc2(player.getName())), - args[3], resadmin); + new CuboidArea(smanager.getPlayerLoc1(player.getName()), smanager + .getPlayerLoc2(player.getName())), args[3], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectPoints")); + player.sendMessage(ChatColor.RED + language.getPhrase("SelectPoints")); } return true; } else if (args[1].equals("replace")) { - WorldEditPlugin wep = (WorldEditPlugin) server - .getPluginManager().getPlugin("WorldEdit"); + WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager().getPlugin( + "WorldEdit"); if (wep != null) { - if (wep.getConfig().getInt("wand-item") == Residence - .getConfigManager().selectionToolId) { + if (wep.getConfig().getInt("wand-item") == Residence.getConfigManager().selectionToolId) { smanager.worldEdit(player); } } @@ -618,17 +549,13 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.replaceArea( player, - new CuboidArea(smanager.getPlayerLoc1(player - .getName()), smanager - .getPlayerLoc2(player.getName())), - args[3], resadmin); + new CuboidArea(smanager.getPlayerLoc1(player.getName()), smanager + .getPlayerLoc2(player.getName())), args[3], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectPoints")); + player.sendMessage(ChatColor.RED + language.getPhrase("SelectPoints")); } return true; } @@ -638,41 +565,35 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.printAreaList(player, page); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; - } else if ((args.length == 3 || args.length == 4) - && args[1].equals("listall")) { + } else if ((args.length == 3 || args.length == 4) && args[1].equals("listall")) { ClaimedResidence res = rmanager.getByName(args[2]); if (res != null) { res.printAdvancedAreaList(player, page); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } return false; } - private boolean commandResBank(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResBank(String[] args, boolean resadmin, Player player, int page) { if (args.length != 3) return false; - ClaimedResidence res = rmanager.getByName(plistener - .getCurrentResidenceName(player.getName())); + ClaimedResidence res = rmanager.getByName(plistener.getCurrentResidenceName(player + .getName())); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NotInResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("NotInResidence")); return true; } int amount = 0; try { amount = Integer.parseInt(args[2]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidAmount")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidAmount")); return true; } if (args[1].equals("deposit")) { @@ -684,39 +605,34 @@ public class ResidenceCommandListener extends Residence { return true; } - private boolean commandResCompass(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResCompass(String[] args, boolean resadmin, Player player, int page) { if (args.length != 2) { player.setCompassTarget(player.getWorld().getSpawnLocation()); - player.sendMessage(ChatColor.GREEN - + language.getPhrase("CompassTargetReset")); + player.sendMessage(ChatColor.GREEN + language.getPhrase("CompassTargetReset")); return true; } if (rmanager.getByName(args[1]) != null) { if (rmanager.getByName(args[1]).getWorld() .equalsIgnoreCase(player.getWorld().getName())) { - Location low = rmanager.getByName(args[1]).getArea("main") - .getLowLoc(); - Location high = rmanager.getByName(args[1]).getArea("main") - .getHighLoc(); + Location low = rmanager.getByName(args[1]).getArea("main").getLowLoc(); + Location high = rmanager.getByName(args[1]).getArea("main").getHighLoc(); Location mid = new Location(low.getWorld(), (low.getBlockX() + high.getBlockX()) / 2, (low.getBlockY() + high.getBlockY()) / 2, (low.getBlockZ() + high.getBlockZ()) / 2); player.setCompassTarget(mid); player.sendMessage(ChatColor.GREEN - + language.getPhrase("CompassTargetSet", - ChatColor.YELLOW + args[1] + ChatColor.GREEN)); + + language.getPhrase("CompassTargetSet", ChatColor.YELLOW + args[1] + + ChatColor.GREEN)); } } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } - private boolean commandResConfirm(String[] args, boolean resadmin, - CommandSender sender, int page) { + private boolean commandResConfirm(String[] args, boolean resadmin, CommandSender sender, + int page) { Player player = null; String name = "Console"; if (sender instanceof Player) { @@ -726,15 +642,13 @@ public class ResidenceCommandListener extends Residence { if (args.length == 1) { String area = deleteConfirm.get(name); if (area == null) { - sender.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + sender.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } else { rmanager.removeResidence(player, area, resadmin); deleteConfirm.remove(name); if (player == null) { sender.sendMessage(ChatColor.GREEN - + Residence.getLanguage().getPhrase( - "ResidenceRemove", + + Residence.getLanguage().getPhrase("ResidenceRemove", ChatColor.YELLOW + name + ChatColor.GREEN)); } } @@ -742,104 +656,83 @@ public class ResidenceCommandListener extends Residence { return true; } - private boolean commandResCreate(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResCreate(String[] args, boolean resadmin, Player player, int page) { if (args.length != 2) return false; - WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager() - .getPlugin("WorldEdit"); + WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager().getPlugin("WorldEdit"); if (wep != null) { - if (wep.getConfig().getInt("wand-item") == Residence - .getConfigManager().selectionToolId) { + if (wep.getConfig().getInt("wand-item") == Residence.getConfigManager().selectionToolId) { smanager.worldEdit(player); } } if (smanager.hasPlacedBoth(player.getName())) { - rmanager.addResidence(player, args[1], - smanager.getPlayerLoc1(player.getName()), + rmanager.addResidence(player, args[1], smanager.getPlayerLoc1(player.getName()), smanager.getPlayerLoc2(player.getName()), resadmin); return true; } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectPoints")); + player.sendMessage(ChatColor.RED + language.getPhrase("SelectPoints")); return true; } } - private boolean commandResGset(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResGset(String[] args, boolean resadmin, Player player, int page) { if (args.length == 4) { ClaimedResidence area = rmanager.getByLoc(player.getLocation()); if (area != null) { - area.getPermissions().setGroupFlag(player, args[1], args[2], - args[3], resadmin); + area.getPermissions().setGroupFlag(player, args[1], args[2], args[3], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidArea")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidArea")); } return true; } else if (args.length == 5) { ClaimedResidence area = rmanager.getByName(args[1]); if (area != null) { - area.getPermissions().setGroupFlag(player, args[2], args[3], - args[4], resadmin); + area.getPermissions().setGroupFlag(player, args[2], args[3], args[4], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } return false; } - private boolean commandResLease(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResLease(String[] args, boolean resadmin, Player player, int page) { if (args.length == 2 || args.length == 3) { if (args[1].equals("renew")) { if (args.length == 3) { leasemanager.renewArea(args[2], player); } else { - leasemanager - .renewArea( - rmanager.getNameByLoc(player.getLocation()), - player); + leasemanager.renewArea(rmanager.getNameByLoc(player.getLocation()), player); } return true; } else if (args[1].equals("cost")) { if (args.length == 3) { - ClaimedResidence res = Residence.getResidenceManager() - .getByName(args[2]); + ClaimedResidence res = Residence.getResidenceManager().getByName(args[2]); if (res == null || leasemanager.leaseExpires(args[2])) { int cost = leasemanager.getRenewCost(res); player.sendMessage(ChatColor.YELLOW - + language.getPhrase("LeaseRenewalCost", - ChatColor.RED + args[2] - + ChatColor.YELLOW + "." - + ChatColor.RED + cost - + ChatColor.YELLOW)); + + language.getPhrase("LeaseRenewalCost", ChatColor.RED + args[2] + + ChatColor.YELLOW + "." + ChatColor.RED + cost + + ChatColor.YELLOW)); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("LeaseNotExpire")); + player.sendMessage(ChatColor.RED + language.getPhrase("LeaseNotExpire")); } return true; } else { String area = rmanager.getNameByLoc(player.getLocation()); ClaimedResidence res = rmanager.getByName(area); if (area == null || res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidArea")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidArea")); return true; } if (leasemanager.leaseExpires(area)) { int cost = leasemanager.getRenewCost(res); player.sendMessage(ChatColor.YELLOW - + language.getPhrase("LeaseRenewalCost", - ChatColor.RED + area + ChatColor.YELLOW - + "." + ChatColor.RED + cost - + ChatColor.YELLOW)); + + language.getPhrase("LeaseRenewalCost", ChatColor.RED + area + + ChatColor.YELLOW + "." + ChatColor.RED + cost + + ChatColor.YELLOW)); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("LeaseNotExpire")); + player.sendMessage(ChatColor.RED + language.getPhrase("LeaseNotExpire")); } return true; } @@ -847,18 +740,15 @@ public class ResidenceCommandListener extends Residence { } else if (args.length == 4) { if (args[1].equals("set")) { if (!resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("NoPermission")); + player.sendMessage(ChatColor.RED + language.getPhrase("NoPermission")); return true; } if (args[3].equals("infinite")) { if (leasemanager.leaseExpires(args[2])) { leasemanager.removeExpireTime(args[2]); - player.sendMessage(ChatColor.GREEN - + language.getPhrase("LeaseInfinite")); + player.sendMessage(ChatColor.GREEN + language.getPhrase("LeaseInfinite")); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("LeaseNotExpire")); + player.sendMessage(ChatColor.RED + language.getPhrase("LeaseNotExpire")); } return true; } else { @@ -866,8 +756,7 @@ public class ResidenceCommandListener extends Residence { try { days = Integer.parseInt(args[3]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidDays")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidDays")); return true; } leasemanager.setExpireTime(player, args[2], days); @@ -878,8 +767,7 @@ public class ResidenceCommandListener extends Residence { return false; } - private boolean commandResList(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResList(String[] args, boolean resadmin, Player player, int page) { if (args.length == 2) { if (args[1].equals("list")) { pmanager.printLists(player); @@ -898,40 +786,33 @@ public class ResidenceCommandListener extends Residence { } } else if (args.length == 4) { if (args[1].equals("apply")) { - pmanager.applyListToResidence(player, args[2], args[3], - resadmin); + pmanager.applyListToResidence(player, args[2], args[3], resadmin); return true; } } else if (args.length == 5) { if (args[1].equals("set")) { pmanager.getList(player.getName(), args[2]).setFlag(args[3], FlagPermissions.stringToFlagState(args[4])); - player.sendMessage(ChatColor.GREEN - + language.getPhrase("FlagSet")); + player.sendMessage(ChatColor.GREEN + language.getPhrase("FlagSet")); return true; } } else if (args.length == 6) { if (args[1].equals("gset")) { - pmanager.getList(player.getName(), args[2]).setGroupFlag( - args[3], args[4], + pmanager.getList(player.getName(), args[2]).setGroupFlag(args[3], args[4], FlagPermissions.stringToFlagState(args[5])); - player.sendMessage(ChatColor.GREEN - + language.getPhrase("FlagSet")); + player.sendMessage(ChatColor.GREEN + language.getPhrase("FlagSet")); return true; } else if (args[1].equals("pset")) { - pmanager.getList(player.getName(), args[2]).setPlayerFlag( - args[3], args[4], + pmanager.getList(player.getName(), args[2]).setPlayerFlag(args[3], args[4], FlagPermissions.stringToFlagState(args[5])); - player.sendMessage(ChatColor.GREEN - + language.getPhrase("FlagSet")); + player.sendMessage(ChatColor.GREEN + language.getPhrase("FlagSet")); return true; } } return false; } - private boolean commandResLset(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResLset(String[] args, boolean resadmin, Player player, int page) { ClaimedResidence res = null; Material mat = null; String listtype = null; @@ -945,8 +826,7 @@ public class ResidenceCommandListener extends Residence { } if (showinfo) { if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } player.sendMessage(ChatColor.RED + "Blacklist:"); @@ -960,8 +840,7 @@ public class ResidenceCommandListener extends Residence { try { mat = Material.valueOf(args[3].toUpperCase()); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidMaterial")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidMaterial")); return true; } } else if (args.length == 3) { @@ -970,8 +849,7 @@ public class ResidenceCommandListener extends Residence { try { mat = Material.valueOf(args[2].toUpperCase()); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidMaterial")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidMaterial")); return true; } } @@ -981,19 +859,16 @@ public class ResidenceCommandListener extends Residence { } else if (listtype.equalsIgnoreCase("ignorelist")) { res.getItemIgnoreList().playerListChange(player, mat, resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidList")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidList")); } return true; } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } } - private boolean commandResMarket(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResMarket(String[] args, boolean resadmin, Player player, int page) { if (args.length == 1) return false; String command = args[1].toLowerCase(); @@ -1019,14 +894,12 @@ public class ResidenceCommandListener extends Residence { if (args.length == 2) { String areaname = rmanager.getNameByLoc(player.getLocation()); tmanager.viewSaleInfo(areaname, player); - if (cmanager.enabledRentSystem() - && rentmanager.isForRent(areaname)) { + if (cmanager.enabledRentSystem() && rentmanager.isForRent(areaname)) { rentmanager.printRentInfo(player, areaname); } } else if (args.length == 3) { tmanager.viewSaleInfo(args[2], player); - if (cmanager.enabledRentSystem() - && rentmanager.isForRent(args[2])) { + if (cmanager.enabledRentSystem() && rentmanager.isForRent(args[2])) { rentmanager.printRentInfo(player, args[2]); } } else @@ -1052,8 +925,7 @@ public class ResidenceCommandListener extends Residence { try { amount = Integer.parseInt(args[3]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidAmount")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidAmount")); return true; } tmanager.putForSale(args[2], player, amount, resadmin); @@ -1062,11 +934,10 @@ public class ResidenceCommandListener extends Residence { return false; } - private boolean commandResMarketAutorenew(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResMarketAutorenew(String[] args, boolean resadmin, Player player, + int page) { if (!cmanager.enableEconomy()) { - player.sendMessage(ChatColor.RED - + language.getPhrase("MarketDisabled")); + player.sendMessage(ChatColor.RED + language.getPhrase("MarketDisabled")); return true; } if (args.length != 4) @@ -1074,37 +945,31 @@ public class ResidenceCommandListener extends Residence { boolean value; if (args[3].equalsIgnoreCase("true") || args[3].equalsIgnoreCase("t")) { value = true; - } else if (args[3].equalsIgnoreCase("false") - || args[3].equalsIgnoreCase("f")) { + } else if (args[3].equalsIgnoreCase("false") || args[3].equalsIgnoreCase("f")) { value = false; } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidBoolean")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidBoolean")); return true; } if (rentmanager.isRented(args[2]) - && rentmanager.getRentingPlayer(args[2]).equalsIgnoreCase( - player.getName())) { + && rentmanager.getRentingPlayer(args[2]).equalsIgnoreCase(player.getName())) { rentmanager.setRentedRepeatable(player, args[2], value, resadmin); } else if (rentmanager.isForRent(args[2])) { rentmanager.setRentRepeatable(player, args[2], value, resadmin); } else { player.sendMessage(ChatColor.RED - + language.getPhrase("RentReleaseInvalid", ChatColor.YELLOW - + args[2] + ChatColor.RED)); + + language.getPhrase("RentReleaseInvalid", ChatColor.YELLOW + args[2] + + ChatColor.RED)); } return true; } - private boolean commandResMarketList(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResMarketList(String[] args, boolean resadmin, Player player, int page) { if (!cmanager.enableEconomy()) { - player.sendMessage(ChatColor.RED - + language.getPhrase("MarketDisabled")); + player.sendMessage(ChatColor.RED + language.getPhrase("MarketDisabled")); return true; } - player.sendMessage(ChatColor.BLUE + "---" - + language.getPhrase("MarketList") + "---"); + player.sendMessage(ChatColor.BLUE + "---" + language.getPhrase("MarketList") + "---"); tmanager.printForSaleResidences(player); if (cmanager.enabledRentSystem()) { rentmanager.printRentableResidences(player); @@ -1112,19 +977,15 @@ public class ResidenceCommandListener extends Residence { return true; } - private boolean commandResMarketRent(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResMarketRent(String[] args, boolean resadmin, Player player, int page) { if (args.length < 3 || args.length > 4) return false; boolean repeat = false; if (args.length == 4) { - if (args[3].equalsIgnoreCase("t") - || args[3].equalsIgnoreCase("true")) { + if (args[3].equalsIgnoreCase("t") || args[3].equalsIgnoreCase("true")) { repeat = true; - } else if (!args[3].equalsIgnoreCase("f") - && !args[3].equalsIgnoreCase("false")) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidBoolean")); + } else if (!args[3].equalsIgnoreCase("f") && !args[3].equalsIgnoreCase("false")) { + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidBoolean")); return true; } } @@ -1132,13 +993,12 @@ public class ResidenceCommandListener extends Residence { return true; } - private boolean commandResMarketRentable(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResMarketRentable(String[] args, boolean resadmin, Player player, + int page) { if (args.length < 5 || args.length > 6) return false; if (!cmanager.enabledRentSystem()) { - player.sendMessage(ChatColor.RED - + language.getPhrase("RentDisabled")); + player.sendMessage(ChatColor.RED + language.getPhrase("RentDisabled")); return true; } int days; @@ -1146,26 +1006,21 @@ public class ResidenceCommandListener extends Residence { try { cost = Integer.parseInt(args[3]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidCost")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidCost")); return true; } try { days = Integer.parseInt(args[4]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidDays")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidDays")); return true; } boolean repeat = false; if (args.length == 6) { - if (args[5].equalsIgnoreCase("t") - || args[5].equalsIgnoreCase("true")) { + if (args[5].equalsIgnoreCase("t") || args[5].equalsIgnoreCase("true")) { repeat = true; - } else if (!args[5].equalsIgnoreCase("f") - && !args[5].equalsIgnoreCase("false")) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidBoolean")); + } else if (!args[5].equalsIgnoreCase("f") && !args[5].equalsIgnoreCase("false")) { + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidBoolean")); return true; } } @@ -1173,8 +1028,7 @@ public class ResidenceCommandListener extends Residence { return true; } - private boolean commandResMessage(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResMessage(String[] args, boolean resadmin, Player player, int page) { ClaimedResidence res = null; int start = 0; boolean enter = false; @@ -1193,8 +1047,7 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.setEnterLeaveMessage(player, null, true, resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args.length > 2 && args[2].equals("leave")) { @@ -1202,13 +1055,11 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.setEnterLeaveMessage(player, null, false, resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidMessageType")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidMessageType")); return true; } else if (args.length > 2 && args[2].equals("enter")) { enter = true; @@ -1232,12 +1083,10 @@ public class ResidenceCommandListener extends Residence { } return true; } - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidMessageType")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidMessageType")); return true; } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidMessageType")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidMessageType")); return true; } if (start == 0) @@ -1249,60 +1098,49 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.setEnterLeaveMessage(player, message, enter, resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } - private boolean commandResPset(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResPset(String[] args, boolean resadmin, Player player, int page) { if (args.length == 3 && args[2].equalsIgnoreCase("removeall")) { ClaimedResidence area = rmanager.getByLoc(player.getLocation()); if (area != null) { - area.getPermissions().removeAllPlayerFlags(player, args[1], - resadmin); + area.getPermissions().removeAllPlayerFlags(player, args[1], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args.length == 4 && args[3].equalsIgnoreCase("removeall")) { ClaimedResidence area = rmanager.getByName(args[1]); if (area != null) { - area.getPermissions().removeAllPlayerFlags(player, args[2], - resadmin); + area.getPermissions().removeAllPlayerFlags(player, args[2], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args.length == 4) { ClaimedResidence area = rmanager.getByLoc(player.getLocation()); if (area != null) { - area.getPermissions().setPlayerFlag(player, args[1], args[2], - args[3], resadmin); + area.getPermissions().setPlayerFlag(player, args[1], args[2], args[3], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args.length == 5) { ClaimedResidence area = rmanager.getByName(args[1]); if (area != null) { - area.getPermissions().setPlayerFlag(player, args[2], args[3], - args[4], resadmin); + area.getPermissions().setPlayerFlag(player, args[2], args[3], args[4], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } return false; } - private boolean commandResRemove(String[] args, boolean resadmin, - CommandSender sender, int page) { + private boolean commandResRemove(String[] args, boolean resadmin, CommandSender sender, int page) { Player player = null; if (sender instanceof Player) { player = (Player) sender; @@ -1314,13 +1152,10 @@ public class ResidenceCommandListener extends Residence { String[] split = area.split("\\."); String words = split[split.length - 1]; if (!deleteConfirm.containsKey(player.getName()) - || !area.equalsIgnoreCase(deleteConfirm - .get(player.getName()))) { + || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) { player.sendMessage(ChatColor.RED - + language.getPhrase( - "DeleteSubzoneConfirm", - ChatColor.YELLOW + words - + ChatColor.RED)); + + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + + words + ChatColor.RED)); deleteConfirm.put(player.getName(), area); } else { rmanager.removeResidence(player, area, resadmin); @@ -1328,12 +1163,10 @@ public class ResidenceCommandListener extends Residence { return true; } else { if (!deleteConfirm.containsKey(player.getName()) - || !area.equalsIgnoreCase(deleteConfirm - .get(player.getName()))) { + || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) { player.sendMessage(ChatColor.RED - + language.getPhrase("DeleteConfirm", - ChatColor.YELLOW + area - + ChatColor.RED)); + + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + area + + ChatColor.RED)); deleteConfirm.put(player.getName(), area); } else { rmanager.removeResidence(player, area, resadmin); @@ -1348,8 +1181,7 @@ public class ResidenceCommandListener extends Residence { return false; if (player != null) { if (!deleteConfirm.containsKey(player.getName()) - || !args[1].equalsIgnoreCase(deleteConfirm.get(player - .getName()))) { + || !args[1].equalsIgnoreCase(deleteConfirm.get(player.getName()))) { String words = ""; if (rmanager.getByName(args[1]) != null) { ClaimedResidence res = rmanager.getByName(args[1]); @@ -1360,12 +1192,12 @@ public class ResidenceCommandListener extends Residence { } if (words == "") { player.sendMessage(ChatColor.RED - + language.getPhrase("DeleteConfirm", - ChatColor.YELLOW + args[1] + ChatColor.RED)); + + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + + ChatColor.RED)); } else { player.sendMessage(ChatColor.RED - + language.getPhrase("DeleteSubzoneConfirm", - ChatColor.YELLOW + words + ChatColor.RED)); + + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + + ChatColor.RED)); } deleteConfirm.put(player.getName(), args[1]); } else { @@ -1385,16 +1217,13 @@ public class ResidenceCommandListener extends Residence { if (words == "") { server.getConsoleSender().sendMessage( ChatColor.RED - + language.getPhrase("DeleteConfirm", - ChatColor.YELLOW + args[1] - + ChatColor.RED)); + + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + + args[1] + ChatColor.RED)); } else { server.getConsoleSender().sendMessage( ChatColor.RED - + language.getPhrase( - "DeleteSubzoneConfirm", - ChatColor.YELLOW + words - + ChatColor.RED)); + + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + + words + ChatColor.RED)); } deleteConfirm.put("Console", args[1]); } else { @@ -1404,27 +1233,21 @@ public class ResidenceCommandListener extends Residence { return true; } - private boolean commandResSelect(String[] args, boolean resadmin, - Player player, int page) { - PermissionGroup group = Residence.getPermissionManager().getGroup( - player); + private boolean commandResSelect(String[] args, boolean resadmin, Player player, int page) { + PermissionGroup group = Residence.getPermissionManager().getGroup(player); if (!group.selectCommandAccess() && !resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectDiabled")); + player.sendMessage(ChatColor.RED + language.getPhrase("SelectDiabled")); return true; } - if (!group.canCreateResidences() && group.getMaxSubzoneDepth() <= 0 - && !resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectDiabled")); + if (!group.canCreateResidences() && group.getMaxSubzoneDepth() <= 0 && !resadmin) { + player.sendMessage(ChatColor.RED + language.getPhrase("SelectDiabled")); return true; } if ((!player.hasPermission("residence.create") && player.isPermissionSet("residence.create") && !player.hasPermission("residence.select") && player - .isPermissionSet("residence.select")) && !resadmin) { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectDiabled")); + .isPermissionSet("residence.select")) && !resadmin) { + player.sendMessage(ChatColor.RED + language.getPhrase("SelectDiabled")); return true; } if (args.length == 2) { @@ -1434,8 +1257,7 @@ public class ResidenceCommandListener extends Residence { smanager.showSelectionInfo(player); return true; } catch (Exception ex) { - Logger.getLogger(Residence.class.getName()).log( - Level.SEVERE, null, ex); + Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex); return true; } } else if (smanager.worldEdit(player)) { @@ -1443,8 +1265,7 @@ public class ResidenceCommandListener extends Residence { smanager.showSelectionInfo(player); return true; } catch (Exception ex) { - Logger.getLogger(Residence.class.getName()).log( - Level.SEVERE, null, ex); + Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex); return true; } } @@ -1460,19 +1281,15 @@ public class ResidenceCommandListener extends Residence { } else if (args[1].equals("coords")) { Location playerLoc1 = smanager.getPlayerLoc1(player.getName()); if (playerLoc1 != null) { - player.sendMessage(ChatColor.GREEN - + language.getPhrase("Primary.Selection") + ":" - + ChatColor.AQUA + " (" + playerLoc1.getBlockX() - + ", " + playerLoc1.getBlockY() + ", " - + playerLoc1.getBlockZ() + ")"); + player.sendMessage(ChatColor.GREEN + language.getPhrase("Primary.Selection") + + ":" + ChatColor.AQUA + " (" + playerLoc1.getBlockX() + ", " + + playerLoc1.getBlockY() + ", " + playerLoc1.getBlockZ() + ")"); } Location playerLoc2 = smanager.getPlayerLoc2(player.getName()); if (playerLoc2 != null) { - player.sendMessage(ChatColor.GREEN - + language.getPhrase("Secondary.Selection") + ":" - + ChatColor.AQUA + " (" + playerLoc2.getBlockX() - + ", " + playerLoc2.getBlockY() + ", " - + playerLoc2.getBlockZ() + ")"); + player.sendMessage(ChatColor.GREEN + language.getPhrase("Secondary.Selection") + + ":" + ChatColor.AQUA + " (" + playerLoc2.getBlockX() + ", " + + playerLoc2.getBlockY() + ", " + playerLoc2.getBlockZ() + ")"); } return true; } else if (args[1].equals("chunk")) { @@ -1481,8 +1298,7 @@ public class ResidenceCommandListener extends Residence { } else if (args[1].equals("worldedit")) { if (smanager.worldEdit(player)) { player.sendMessage(ChatColor.GREEN - + Residence.getLanguage().getPhrase( - "SelectionSuccess")); + + Residence.getLanguage().getPhrase("SelectionSuccess")); } return true; } @@ -1492,8 +1308,7 @@ public class ResidenceCommandListener extends Residence { try { amount = Integer.parseInt(args[2]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidAmount")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidAmount")); return true; } smanager.modify(player, false, amount); @@ -1503,8 +1318,7 @@ public class ResidenceCommandListener extends Residence { try { amount = Integer.parseInt(args[2]); } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidAmount")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidAmount")); return true; } smanager.modify(player, true, amount); @@ -1521,8 +1335,7 @@ public class ResidenceCommandListener extends Residence { res = rmanager.getByLoc(player.getLocation()); } if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } resName = res.getName(); @@ -1538,55 +1351,48 @@ public class ResidenceCommandListener extends Residence { smanager.placeLoc1(player, area.getHighLoc()); smanager.placeLoc2(player, area.getLowLoc()); player.sendMessage(ChatColor.GREEN - + language.getPhrase("SelectionArea", ChatColor.GOLD - + areaName + ChatColor.GREEN + "." - + ChatColor.GOLD + resName + ChatColor.GREEN)); + + language.getPhrase("SelectionArea", ChatColor.GOLD + areaName + + ChatColor.GREEN + "." + ChatColor.GOLD + resName + + ChatColor.GREEN)); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("AreaNonExist")); + player.sendMessage(ChatColor.RED + language.getPhrase("AreaNonExist")); } return true; } else { try { - smanager.selectBySize(player, Integer.parseInt(args[1]), - Integer.parseInt(args[2]), Integer.parseInt(args[3])); + smanager.selectBySize(player, Integer.parseInt(args[1]), Integer.parseInt(args[2]), + Integer.parseInt(args[3])); return true; } catch (Exception ex) { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectionFail")); + player.sendMessage(ChatColor.RED + language.getPhrase("SelectionFail")); return true; } } } - private boolean commandResSet(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResSet(String[] args, boolean resadmin, Player player, int page) { if (args.length == 3) { String area = rmanager.getNameByLoc(player.getLocation()); if (area != null) { rmanager.getByName(area).getPermissions() - .setFlag(player, args[1], args[2], resadmin); + .setFlag(player, args[1], args[2], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } else if (args.length == 4) { ClaimedResidence area = rmanager.getByName(args[1]); if (area != null) { - area.getPermissions().setFlag(player, args[2], args[3], - resadmin); + area.getPermissions().setFlag(player, args[2], args[3], resadmin); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } return false; } - private boolean commandResSublist(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResSublist(String[] args, boolean resadmin, Player player, int page) { if (args.length == 1 || args.length == 2 || args.length == 3) { ClaimedResidence res; if (args.length == 1) { @@ -1597,16 +1403,14 @@ public class ResidenceCommandListener extends Residence { if (res != null) { res.printSubzoneList(player, page); } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); } return true; } return false; } - private boolean commandResSubzone(String[] args, boolean resadmin, - Player player, int page) { + private boolean commandResSubzone(String[] args, boolean resadmin, Player player, int page) { if (args.length != 2 && args.length != 3) return false; String zname; @@ -1618,48 +1422,40 @@ public class ResidenceCommandListener extends Residence { parent = args[1]; zname = args[2]; } - WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager() - .getPlugin("WorldEdit"); + WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager().getPlugin("WorldEdit"); if (wep != null) { - if (wep.getConfig().getInt("wand-item") == Residence - .getConfigManager().selectionToolId) { + if (wep.getConfig().getInt("wand-item") == Residence.getConfigManager().selectionToolId) { smanager.worldEdit(player); } } if (smanager.hasPlacedBoth(player.getName())) { ClaimedResidence res = rmanager.getByName(parent); if (res == null) { - player.sendMessage(ChatColor.RED - + language.getPhrase("InvalidResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence")); return true; } res.addSubzone(player, smanager.getPlayerLoc1(player.getName()), smanager.getPlayerLoc2(player.getName()), zname, resadmin); return true; } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("SelectPoints")); + player.sendMessage(ChatColor.RED + language.getPhrase("SelectPoints")); return true; } } @Override - public boolean onCommand(CommandSender sender, Command command, - String label, String[] args) { - ResidenceCommandEvent cevent = new ResidenceCommandEvent( - command.getName(), args, sender); + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + ResidenceCommandEvent cevent = new ResidenceCommandEvent(command.getName(), args, sender); server.getPluginManager().callEvent(cevent); if (cevent.isCancelled()) - return true; + return true; if (command.getName().equals("resreload") && args.length == 0) { if (sender instanceof Player) { Player player = (Player) sender; if (Residence.getPermissionManager().isResidenceAdmin(player)) { this.reloadPlugin(); - sender.sendMessage(ChatColor.GREEN - + "[Residence] 重载配置文件."); - System.out.println("[Residence] 重载 by " - + player.getName() + "."); + sender.sendMessage(ChatColor.GREEN + "[Residence] 重载配置文件."); + System.out.println("[Residence] 重载 by " + player.getName() + "."); } } else { this.reloadPlugin(); @@ -1672,14 +1468,12 @@ public class ResidenceCommandListener extends Residence { && gmanager.isResidenceAdmin((Player) sender)) { try { this.loadYml(); - sender.sendMessage(ChatColor.GREEN - + "[Residence] Reloaded save file..."); + sender.sendMessage(ChatColor.GREEN + "[Residence] Reloaded save file..."); } catch (Exception ex) { sender.sendMessage(ChatColor.RED + "[Residence] Unable to reload the save file, exception occured!"); sender.sendMessage(ChatColor.RED + ex.getMessage()); - Logger.getLogger(Residence.class.getName()).log( - Level.SEVERE, null, ex); + Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex); } } return true; @@ -1689,8 +1483,7 @@ public class ResidenceCommandListener extends Residence { rmanager.removeAllFromWorld(sender, args[1]); return true; } else { - sender.sendMessage(ChatColor.RED - + "MUST be run from console."); + sender.sendMessage(ChatColor.RED + "MUST be run from console."); } } return false; @@ -1716,18 +1509,15 @@ public class ResidenceCommandListener extends Residence { + language.getPhrase("InvalidChannel")); } } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("NotInResidence")); + player.sendMessage(ChatColor.RED + language.getPhrase("NotInResidence")); } } } else { - player.sendMessage(ChatColor.RED - + language.getPhrase("ChatDisabled")); + player.sendMessage(ChatColor.RED + language.getPhrase("ChatDisabled")); } } return true; - } else if (command.getName().equals("res") - || command.getName().equals("residence") + } else if (command.getName().equals("res") || command.getName().equals("residence") || command.getName().equals("resadmin")) { boolean resadmin = false; if (sender instanceof Player) { @@ -1737,8 +1527,7 @@ public class ResidenceCommandListener extends Residence { } if (command.getName().equals("resadmin") && !gmanager.isResidenceAdmin((Player) sender)) { - ((Player) sender).sendMessage(ChatColor.RED - + language.getPhrase("NonAdmin")); + ((Player) sender).sendMessage(ChatColor.RED + language.getPhrase("NonAdmin")); return true; } } else {