From b8b86f4de93d65c912988faeb3126577f7517d1e Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 22 Sep 2015 20:36:21 +0800 Subject: [PATCH] Translation Some Message... Signed-off-by: 502647092 --- .../bukkit/residence/ConfigManager.java | 110 ++-- .../residence/ResidenceCommandListener.java | 16 +- .../listeners/ResidencePlayerListener.java | 2 +- .../permissions/PermissionGroup.java | 522 +++++++++--------- .../protection/ClaimedResidence.java | 6 - src/main/resources/languagefiles/Chinese.yml | 9 +- 6 files changed, 327 insertions(+), 338 deletions(-) diff --git a/src/main/java/com/bekvon/bukkit/residence/ConfigManager.java b/src/main/java/com/bekvon/bukkit/residence/ConfigManager.java index eb23a3b..dfe9947 100644 --- a/src/main/java/com/bekvon/bukkit/residence/ConfigManager.java +++ b/src/main/java/com/bekvon/bukkit/residence/ConfigManager.java @@ -184,63 +184,6 @@ public class ConfigManager { 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; - } - } - public boolean preventRentModify() { return preventBuildInRent; } @@ -264,4 +207,57 @@ public class ConfigManager { public boolean useLegacyPermissions() { return legacyperms; } + + @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 (!Residence.is1_8()) + actionBar = false; + + 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; + } + } } diff --git a/src/main/java/com/bekvon/bukkit/residence/ResidenceCommandListener.java b/src/main/java/com/bekvon/bukkit/residence/ResidenceCommandListener.java index 59c2a32..ec03d59 100644 --- a/src/main/java/com/bekvon/bukkit/residence/ResidenceCommandListener.java +++ b/src/main/java/com/bekvon/bukkit/residence/ResidenceCommandListener.java @@ -50,10 +50,10 @@ public class ResidenceCommandListener extends Residence { if (!(sender instanceof Player) || sender instanceof Player && gmanager.isResidenceAdmin((Player) sender)) try { this.loadYml(); - sender.sendMessage(ChatColor.GREEN + "[Residence] Reloaded save file..."); + sender.sendMessage(ChatColor.GREEN + "[Residence] 从配置保存文件重新载入数据..."); } catch (Exception ex) { - sender.sendMessage(ChatColor.RED + "[Residence] Unable to reload the save file, exception occured!"); - sender.sendMessage(ChatColor.RED + ex.getMessage()); + sender.sendMessage(ChatColor.RED + "[Residence] 无法从配置保存文件重新载入数据, 请查看控制台异常信息!"); + sender.sendMessage(ChatColor.RED + "[Residence] 异常: " + ex.getMessage()); Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex); } return true; @@ -63,7 +63,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 + "当前命令必须从控制台执行."); return false; } else if (command.getName().equals("rc")) { if (sender instanceof Player) { @@ -1114,7 +1114,7 @@ public class ResidenceCommandListener extends Residence { return false; if (player != null) { if (!deleteConfirm.containsKey(player.getName()) || !args[1].equalsIgnoreCase(deleteConfirm.get(player.getName()))) { - String words = ""; + String words = null; if (rmanager.getByName(args[1]) != null) { ClaimedResidence res = rmanager.getByName(args[1]); if (res.getParent() != null) { @@ -1122,7 +1122,7 @@ public class ResidenceCommandListener extends Residence { words = split[split.length - 1]; } } - if (words == "") + if (words == null) player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED)); else player.sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED)); @@ -1130,7 +1130,7 @@ public class ResidenceCommandListener extends Residence { } else rmanager.removeResidence(player, args[1], resadmin); } else if (!deleteConfirm.containsKey("Console") || !args[1].equalsIgnoreCase(deleteConfirm.get("Console"))) { - String words = ""; + String words = null; if (rmanager.getByName(args[1]) != null) { ClaimedResidence res = rmanager.getByName(args[1]); if (res.getParent() != null) { @@ -1138,7 +1138,7 @@ public class ResidenceCommandListener extends Residence { words = split[split.length - 1]; } } - if (words == "") + if (words == null) server.getConsoleSender().sendMessage(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)); diff --git a/src/main/java/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java b/src/main/java/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java index c220c5e..29e364f 100644 --- a/src/main/java/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java +++ b/src/main/java/com/bekvon/bukkit/residence/listeners/ResidencePlayerListener.java @@ -159,7 +159,7 @@ public class ResidencePlayerListener implements Listener { if (leave != null && !leave.equals("") && ResOld != res.getParent()) if (Residence.getConfigManager().useActionBar()) - ActionBar.send(player, (new StringBuilder()).append(ChatColor.YELLOW).append(insertMessages(player, ResOld.getName(), ResOld, leave)).toString()); + ActionBar.send(player, ChatColor.YELLOW + insertMessages(player, ResOld.getName(), ResOld, leave)); else player.sendMessage(ChatColor.YELLOW + this.insertMessages(player, ResOld.getName(), ResOld, leave)); } diff --git a/src/main/java/com/bekvon/bukkit/residence/permissions/PermissionGroup.java b/src/main/java/com/bekvon/bukkit/residence/permissions/PermissionGroup.java index 59c550f..f635e69 100644 --- a/src/main/java/com/bekvon/bukkit/residence/permissions/PermissionGroup.java +++ b/src/main/java/com/bekvon/bukkit/residence/permissions/PermissionGroup.java @@ -5,316 +5,312 @@ package com.bekvon.bukkit.residence.permissions; -import org.bukkit.ChatColor; - -import com.bekvon.bukkit.residence.Residence; -import com.bekvon.bukkit.residence.protection.CuboidArea; -import com.bekvon.bukkit.residence.protection.FlagPermissions; -import com.bekvon.bukkit.residence.protection.FlagPermissions.FlagState; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; + +import org.bukkit.ChatColor; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; +import com.bekvon.bukkit.residence.Residence; +import com.bekvon.bukkit.residence.protection.CuboidArea; +import com.bekvon.bukkit.residence.protection.FlagPermissions; +import com.bekvon.bukkit.residence.protection.FlagPermissions.FlagState; + /** - * + * * @author Administrator - * + * * changed by inori 03/17/2012 line 91:limits MaxHeight changed to 255 */ public class PermissionGroup { - protected int xmax; - protected int ymax; - protected int zmax; - protected int resmax; - protected double costperarea; - protected boolean tpaccess; - protected int subzonedepth; - protected FlagPermissions flagPerms; - protected Map creatorDefaultFlags; - protected Map> groupDefaultFlags; - protected Map residenceDefaultFlags; - protected boolean messageperms; - protected String defaultEnterMessage; - protected String defaultLeaveMessage; - protected int maxLeaseTime; - protected int leaseGiveTime; - protected double renewcostperarea; - protected boolean canBuy; - protected boolean canSell; - protected boolean buyIgnoreLimits; - protected boolean cancreate; - protected String groupname; - protected int maxPhysical; - protected boolean unstuck; - protected boolean kick; - protected int minHeight; - protected int maxHeight; - protected int maxRents; - protected int maxRentables; - protected boolean selectCommandAccess; - protected boolean itemListAccess; + protected int xmax; + protected int ymax; + protected int zmax; + protected int resmax; + protected double costperarea; + protected boolean tpaccess; + protected int subzonedepth; + protected FlagPermissions flagPerms; + protected Map creatorDefaultFlags; + protected Map> groupDefaultFlags; + protected Map residenceDefaultFlags; + protected boolean messageperms; + protected String defaultEnterMessage; + protected String defaultLeaveMessage; + protected int maxLeaseTime; + protected int leaseGiveTime; + protected double renewcostperarea; + protected boolean canBuy; + protected boolean canSell; + protected boolean buyIgnoreLimits; + protected boolean cancreate; + protected String groupname; + protected int maxPhysical; + protected boolean unstuck; + protected boolean kick; + protected int minHeight; + protected int maxHeight; + protected int maxRents; + protected int maxRentables; + protected boolean selectCommandAccess; + protected boolean itemListAccess; - public PermissionGroup(String name) { - flagPerms = new FlagPermissions(); - creatorDefaultFlags = new HashMap(); - residenceDefaultFlags = new HashMap(); - groupDefaultFlags = new HashMap>(); - groupname = name; - } + public PermissionGroup(String name) { + flagPerms = new FlagPermissions(); + creatorDefaultFlags = new HashMap(); + residenceDefaultFlags = new HashMap(); + groupDefaultFlags = new HashMap>(); + groupname = name; + } - public PermissionGroup(String name, ConfigurationSection node) { - this(name); - this.parseGroup(node); - } + public PermissionGroup(String name, ConfigurationSection node) { + this(name); + this.parseGroup(node); + } - public PermissionGroup(String name, ConfigurationSection node, FlagPermissions parentFlagPerms) { - this(name, node); - flagPerms.setParent(parentFlagPerms); - } + public PermissionGroup(String name, ConfigurationSection node, FlagPermissions parentFlagPerms) { + this(name, node); + flagPerms.setParent(parentFlagPerms); + } - private void parseGroup(ConfigurationSection limits) { - if (limits == null) { - return; - } - cancreate = limits.getBoolean("Residence.CanCreate", false); - resmax = limits.getInt("Residence.MaxResidences", 0); - maxPhysical = limits.getInt("Residence.MaxAreasPerResidence", 2); - xmax = limits.getInt("Residence.MaxEastWest", 0); - ymax = limits.getInt("Residence.MaxUpDown", 0); - zmax = limits.getInt("Residence.MaxNorthSouth", 0); - minHeight = limits.getInt("Residence.MinHeight", 0); - maxHeight = limits.getInt("Residence.MaxHeight", 255); - tpaccess = limits.getBoolean("Residence.CanTeleport", false); - subzonedepth = limits.getInt("Residence.SubzoneDepth", 0); - messageperms = limits.getBoolean("Messaging.CanChange", false); - defaultEnterMessage = limits.getString("Messaging.DefaultEnter", null); - defaultLeaveMessage = limits.getString("Messaging.DefaultLeave", null); - maxLeaseTime = limits.getInt("Lease.MaxDays", 16); - leaseGiveTime = limits.getInt("Lease.RenewIncrement", 14); - maxRents = limits.getInt("Rent.MaxRents", 0); - maxRentables = limits.getInt("Rent.MaxRentables", 0); - renewcostperarea = limits.getDouble("Economy.RenewCost", 0.02D); - canBuy = limits.getBoolean("Economy.CanBuy", false); - canSell = limits.getBoolean("Economy.CanSell", false); - buyIgnoreLimits = limits.getBoolean("Economy.IgnoreLimits", false); - costperarea = limits.getDouble("Economy.BuyCost", 0); - unstuck = limits.getBoolean("Residence.Unstuck", false); - kick = limits.getBoolean("Residence.Kick", false); - selectCommandAccess = limits.getBoolean("Residence.SelectCommandAccess", true); - itemListAccess = limits.getBoolean("Residence.ItemListAccess", true); - ConfigurationSection node = limits.getConfigurationSection("Flags.Permission"); - Set flags = null; - if (node != null) { - flags = node.getKeys(false); - } - if (flags != null) { - Iterator flagit = flags.iterator(); - while (flagit.hasNext()) { - String flagname = flagit.next(); - boolean access = limits.getBoolean("Flags.Permission." + flagname, false); - flagPerms.setFlag(flagname, access ? FlagState.TRUE : FlagState.FALSE); - } - } - node = limits.getConfigurationSection("Flags.CreatorDefault"); - if (node != null) { - flags = node.getKeys(false); - } - if (flags != null) { - Iterator flagit = flags.iterator(); - while (flagit.hasNext()) { - String flagname = flagit.next(); - boolean access = limits.getBoolean("Flags.CreatorDefault." + flagname, false); - creatorDefaultFlags.put(flagname, access); - } + public boolean buyLandIgnoreLimits() { + return buyIgnoreLimits; + } - } - node = limits.getConfigurationSection("Flags.Default"); - if (node != null) { - flags = node.getKeys(false); - } - if (flags != null) { - Iterator flagit = flags.iterator(); - while (flagit.hasNext()) { - String flagname = flagit.next(); - boolean access = limits.getBoolean("Flags.Default." + flagname, false); - residenceDefaultFlags.put(flagname, access); - } - } - node = limits.getConfigurationSection("Flags.GroupDefault"); - Set groupDef = null; - if (node != null) { - groupDef = node.getKeys(false); - } - if (groupDef != null) { - Iterator groupit = groupDef.iterator(); - while (groupit.hasNext()) { - String name = groupit.next(); - Map gflags = new HashMap(); - flags = limits.getConfigurationSection("Flags.GroupDefault." + name).getKeys(false); - Iterator flagit = flags.iterator(); - while (flagit.hasNext()) { - String flagname = flagit.next(); - boolean access = limits.getBoolean("Flags.GroupDefault." + name + "." + flagname, false); - gflags.put(flagname, access); - } - groupDefaultFlags.put(name, gflags); - } - } - } + public boolean canBuyLand() { + return canBuy; + } - public int getMaxX() { - return xmax; - } + public boolean canCreateResidences() { + return cancreate; + } - public int getMaxY() { - return ymax; - } + public boolean canSellLand() { + return canSell; + } - public int getMaxZ() { - return zmax; - } + public boolean canSetEnterLeaveMessages() { + return messageperms; + } - public int getMinHeight() { - return minHeight; - } + public double getCostPerBlock() { + return costperarea; + } - public int getMaxHeight() { - return maxHeight; - } + public Set> getDefaultCreatorFlags() { + return creatorDefaultFlags.entrySet(); + } - public int getMaxZones() { - return resmax; - } + public String getDefaultEnterMessage() { + return defaultEnterMessage; + } - public double getCostPerBlock() { - return costperarea; - } + public Set>> getDefaultGroupFlags() { + return groupDefaultFlags.entrySet(); + } - public boolean hasTpAccess() { - return tpaccess; - } + public String getDefaultLeaveMessage() { + return defaultLeaveMessage; + } - public int getMaxSubzoneDepth() { - return subzonedepth; - } + public Set> getDefaultResidenceFlags() { + return residenceDefaultFlags.entrySet(); + } - public boolean canSetEnterLeaveMessages() { - return messageperms; - } + public int getLeaseGiveTime() { + return leaseGiveTime; + } - public String getDefaultEnterMessage() { - return defaultEnterMessage; - } + public double getLeaseRenewCost() { + return renewcostperarea; + } - public String getDefaultLeaveMessage() { - return defaultLeaveMessage; - } + public int getMaxHeight() { + return maxHeight; + } - public int getMaxLeaseTime() { - return maxLeaseTime; - } + public int getMaxLeaseTime() { + return maxLeaseTime; + } - public int getLeaseGiveTime() { - return leaseGiveTime; - } + public int getMaxPhysicalPerResidence() { + return maxPhysical; + } - public double getLeaseRenewCost() { - return renewcostperarea; - } + public int getMaxRentables() { + return maxRentables; + } - public boolean canBuyLand() { - return canBuy; - } + public int getMaxRents() { + return maxRents; + } - public boolean canSellLand() { - return canSell; - } + public int getMaxSubzoneDepth() { + return subzonedepth; + } - public int getMaxRents() { - return maxRents; - } + public int getMaxX() { + return xmax; + } - public int getMaxRentables() { - return maxRentables; - } + public int getMaxY() { + return ymax; + } - public boolean buyLandIgnoreLimits() { - return buyIgnoreLimits; - } + public int getMaxZ() { + return zmax; + } - public boolean hasUnstuckAccess() { - return unstuck; - } - public boolean hasKickAccess() { - return kick; - } - public int getMaxPhysicalPerResidence() { - return maxPhysical; - } + public int getMaxZones() { + return resmax; + } - public Set> getDefaultResidenceFlags() { - return residenceDefaultFlags.entrySet(); - } + public int getMinHeight() { + return minHeight; + } - public Set> getDefaultCreatorFlags() { - return creatorDefaultFlags.entrySet(); - } + public boolean hasFlagAccess(String flag) { + return flagPerms.has(flag, false); + } - public Set>> getDefaultGroupFlags() { - return groupDefaultFlags.entrySet(); - } + public boolean hasKickAccess() { + return kick; + } - public boolean canCreateResidences() { - return cancreate; - } + public boolean hasTpAccess() { + return tpaccess; + } - public boolean hasFlagAccess(String flag) { - return flagPerms.has(flag, false); - } + public boolean hasUnstuckAccess() { + return unstuck; + } - public boolean inLimits(CuboidArea area) { - if (area.getXSize() > xmax || area.getYSize() > ymax || area.getZSize() > zmax) { - return false; - } - return true; - } + public boolean inLimits(CuboidArea area) { + if (area.getXSize() > xmax || area.getYSize() > ymax || area.getZSize() > zmax) + return false; + return true; + } - public boolean selectCommandAccess() { - return selectCommandAccess; - } + public boolean itemListAccess() { + return itemListAccess; + } - public boolean itemListAccess() { - return itemListAccess; - } + public void printLimits(Player player) { + player.sendMessage(ChatColor.GRAY + "---------------------------"); + player.sendMessage(ChatColor.YELLOW + "权限 组:" + ChatColor.DARK_AQUA + " " + Residence.getPermissionManager().getPermissionsGroup(player)); + player.sendMessage(ChatColor.YELLOW + "领地 组:" + ChatColor.DARK_AQUA + " " + groupname); + player.sendMessage(ChatColor.YELLOW + "领地 管理:" + ChatColor.DARK_AQUA + " " + Residence.getPermissionManager().isResidenceAdmin(player)); + player.sendMessage(ChatColor.YELLOW + "允许创建领地:" + ChatColor.DARK_AQUA + " " + cancreate); + player.sendMessage(ChatColor.YELLOW + "最大领地个数:" + ChatColor.DARK_AQUA + " " + resmax); + player.sendMessage(ChatColor.YELLOW + "X轴最大长度:" + ChatColor.DARK_AQUA + " " + xmax); + player.sendMessage(ChatColor.YELLOW + "Z轴最大长度:" + ChatColor.DARK_AQUA + " " + zmax); + player.sendMessage(ChatColor.YELLOW + "Y轴最大高度:" + ChatColor.DARK_AQUA + " " + ymax); + player.sendMessage(ChatColor.YELLOW + "高度限制:" + ChatColor.DARK_AQUA + " " + minHeight + " - " + maxHeight); + player.sendMessage(ChatColor.YELLOW + "最大子领地深度:" + ChatColor.DARK_AQUA + " " + subzonedepth); + player.sendMessage(ChatColor.YELLOW + "是否允许设置进出消息:" + ChatColor.DARK_AQUA + " " + messageperms); + player.sendMessage(ChatColor.YELLOW + "你所拥有的领地:" + ChatColor.DARK_AQUA + " " + Residence.getResidenceManager().getOwnedZoneCount(player.getName())); + if (Residence.getEconomyManager() != null) + player.sendMessage(ChatColor.YELLOW + "每个方块需要金钱:" + ChatColor.DARK_AQUA + " " + costperarea); + player.sendMessage(ChatColor.YELLOW + "Flag 权限:" + ChatColor.DARK_AQUA + " " + flagPerms.listFlags()); + if (Residence.getConfigManager().useLeases()) { + player.sendMessage(ChatColor.YELLOW + "最大租赁日:" + ChatColor.DARK_AQUA + " " + maxLeaseTime); + player.sendMessage(ChatColor.YELLOW + "续租日期:" + ChatColor.DARK_AQUA + " " + leaseGiveTime); + player.sendMessage(ChatColor.YELLOW + "续租方块需要金钱:" + ChatColor.DARK_AQUA + " " + renewcostperarea); + } + player.sendMessage(ChatColor.GRAY + "---------------------------"); + } - public void printLimits(Player player) { - player.sendMessage(ChatColor.GRAY + "---------------------------"); - player.sendMessage(ChatColor.YELLOW + "Permissions Group:" + ChatColor.DARK_AQUA + " " + Residence.getPermissionManager().getPermissionsGroup(player)); - player.sendMessage(ChatColor.YELLOW + "Residence Group:" + ChatColor.DARK_AQUA + " " + groupname); - player.sendMessage(ChatColor.YELLOW + "Residence Admin:" + ChatColor.DARK_AQUA + " " + Residence.getPermissionManager().isResidenceAdmin(player)); - player.sendMessage(ChatColor.YELLOW + "Can Create Residences:" + ChatColor.DARK_AQUA + " " + cancreate); - player.sendMessage(ChatColor.YELLOW + "Max Residences:" + ChatColor.DARK_AQUA + " " + resmax); - player.sendMessage(ChatColor.YELLOW + "Max East/West Size:" + ChatColor.DARK_AQUA + " " + xmax); - player.sendMessage(ChatColor.YELLOW + "Max North/South Size:" + ChatColor.DARK_AQUA + " " + zmax); - player.sendMessage(ChatColor.YELLOW + "Max Up/Down Size:" + ChatColor.DARK_AQUA + " " + ymax); - player.sendMessage(ChatColor.YELLOW + "Min/Max Protection Height:" + ChatColor.DARK_AQUA + " " + minHeight + " to " + maxHeight); - player.sendMessage(ChatColor.YELLOW + "Max Subzone Depth:" + ChatColor.DARK_AQUA + " " + subzonedepth); - player.sendMessage(ChatColor.YELLOW + "Can Set Enter/Leave Messages:" + ChatColor.DARK_AQUA + " " + messageperms); - player.sendMessage(ChatColor.YELLOW + "Number of Residences you own:" + ChatColor.DARK_AQUA + " " + Residence.getResidenceManager().getOwnedZoneCount(player.getName())); - if (Residence.getEconomyManager() != null) { - player.sendMessage(ChatColor.YELLOW + "Residence Cost Per Block:" + ChatColor.DARK_AQUA + " " + costperarea); - } - player.sendMessage(ChatColor.YELLOW + "Flag Permissions:" + ChatColor.DARK_AQUA + " " + flagPerms.listFlags()); - if (Residence.getConfigManager().useLeases()) { - player.sendMessage(ChatColor.YELLOW + "Max Lease Days:" + ChatColor.DARK_AQUA + " " + maxLeaseTime); - player.sendMessage(ChatColor.YELLOW + "Lease Time Given on Renew:" + ChatColor.DARK_AQUA + " " + leaseGiveTime); - player.sendMessage(ChatColor.YELLOW + "Renew Cost Per Block:" + ChatColor.DARK_AQUA + " " + renewcostperarea); - } - player.sendMessage(ChatColor.GRAY + "---------------------------"); - } + public boolean selectCommandAccess() { + return selectCommandAccess; + } + + private void parseGroup(ConfigurationSection limits) { + if (limits == null) + return; + cancreate = limits.getBoolean("Residence.CanCreate", false); + resmax = limits.getInt("Residence.MaxResidences", 0); + maxPhysical = limits.getInt("Residence.MaxAreasPerResidence", 2); + xmax = limits.getInt("Residence.MaxEastWest", 0); + ymax = limits.getInt("Residence.MaxUpDown", 0); + zmax = limits.getInt("Residence.MaxNorthSouth", 0); + minHeight = limits.getInt("Residence.MinHeight", 0); + maxHeight = limits.getInt("Residence.MaxHeight", 255); + tpaccess = limits.getBoolean("Residence.CanTeleport", false); + subzonedepth = limits.getInt("Residence.SubzoneDepth", 0); + messageperms = limits.getBoolean("Messaging.CanChange", false); + defaultEnterMessage = limits.getString("Messaging.DefaultEnter", null); + defaultLeaveMessage = limits.getString("Messaging.DefaultLeave", null); + maxLeaseTime = limits.getInt("Lease.MaxDays", 16); + leaseGiveTime = limits.getInt("Lease.RenewIncrement", 14); + maxRents = limits.getInt("Rent.MaxRents", 0); + maxRentables = limits.getInt("Rent.MaxRentables", 0); + renewcostperarea = limits.getDouble("Economy.RenewCost", 0.02D); + canBuy = limits.getBoolean("Economy.CanBuy", false); + canSell = limits.getBoolean("Economy.CanSell", false); + buyIgnoreLimits = limits.getBoolean("Economy.IgnoreLimits", false); + costperarea = limits.getDouble("Economy.BuyCost", 0); + unstuck = limits.getBoolean("Residence.Unstuck", false); + kick = limits.getBoolean("Residence.Kick", false); + selectCommandAccess = limits.getBoolean("Residence.SelectCommandAccess", true); + itemListAccess = limits.getBoolean("Residence.ItemListAccess", true); + ConfigurationSection node = limits.getConfigurationSection("Flags.Permission"); + Set flags = null; + if (node != null) + flags = node.getKeys(false); + if (flags != null) { + Iterator flagit = flags.iterator(); + while (flagit.hasNext()) { + String flagname = flagit.next(); + boolean access = limits.getBoolean("Flags.Permission." + flagname, false); + flagPerms.setFlag(flagname, access ? FlagState.TRUE : FlagState.FALSE); + } + } + node = limits.getConfigurationSection("Flags.CreatorDefault"); + if (node != null) + flags = node.getKeys(false); + if (flags != null) { + Iterator flagit = flags.iterator(); + while (flagit.hasNext()) { + String flagname = flagit.next(); + boolean access = limits.getBoolean("Flags.CreatorDefault." + flagname, false); + creatorDefaultFlags.put(flagname, access); + } + + } + node = limits.getConfigurationSection("Flags.Default"); + if (node != null) + flags = node.getKeys(false); + if (flags != null) { + Iterator flagit = flags.iterator(); + while (flagit.hasNext()) { + String flagname = flagit.next(); + boolean access = limits.getBoolean("Flags.Default." + flagname, false); + residenceDefaultFlags.put(flagname, access); + } + } + node = limits.getConfigurationSection("Flags.GroupDefault"); + Set groupDef = null; + if (node != null) + groupDef = node.getKeys(false); + if (groupDef != null) { + Iterator groupit = groupDef.iterator(); + while (groupit.hasNext()) { + String name = groupit.next(); + Map gflags = new HashMap(); + flags = limits.getConfigurationSection("Flags.GroupDefault." + name).getKeys(false); + Iterator flagit = flags.iterator(); + while (flagit.hasNext()) { + String flagname = flagit.next(); + boolean access = limits.getBoolean("Flags.GroupDefault." + name + "." + flagname, false); + gflags.put(flagname, access); + } + groupDefaultFlags.put(name, gflags); + } + } + } } diff --git a/src/main/java/com/bekvon/bukkit/residence/protection/ClaimedResidence.java b/src/main/java/com/bekvon/bukkit/residence/protection/ClaimedResidence.java index 3b0c21b..f5eb4ac 100644 --- a/src/main/java/com/bekvon/bukkit/residence/protection/ClaimedResidence.java +++ b/src/main/java/com/bekvon/bukkit/residence/protection/ClaimedResidence.java @@ -796,12 +796,6 @@ public class ClaimedResidence { } public void setEnterLeaveMessage(Player player, String message, boolean enter, boolean resadmin) { - // if(message!=null && - // Residence.getConfigManager().getResidenceNameRegex() != null) { - // Removed pending further action - // player.sendMessage(ChatColor.RED+Residence.getLanguage().getPhrase("InvalidCharacters")); - // return; - // } if (message != null) if (message.equals("")) message = null; diff --git a/src/main/resources/languagefiles/Chinese.yml b/src/main/resources/languagefiles/Chinese.yml index 9ed69f9..e6f7185 100644 --- a/src/main/resources/languagefiles/Chinese.yml +++ b/src/main/resources/languagefiles/Chinese.yml @@ -313,7 +313,7 @@ CommandHelp: #this is just a holder node, that holds the entire help Description: '设置选区为WorldEdit的已选择区域.' Info: - 'Usage /res select worldedit' - - 'Sets selection area using the current WorldEdit selection.' + - '设置领地的选区为WorldEdit的已选择区域.' create: #creation command Description: '创建领地' Info: @@ -326,9 +326,11 @@ CommandHelp: #this is just a holder node, that holds the entire help Description: '删除某位玩家所属的全部领地.' Info: - 'Usage: /res removeall [owner]' - - 'Removes all residences owned by a specific player.' - - 'Requires /resadmin if you use it on anyone besides yourself.' + - '移除某一个玩家的所有领地.' + - '必须使用 /resadmin 如果你是移除别人的领地.' confirm: + Description: '确认领地的删除操作.' + info: - 'Usage: /res confirm' - '确认你要删除某个领地' subzone: @@ -476,6 +478,7 @@ CommandHelp: #this is just a holder node, that holds the entire help - 'note - 允许或禁止领地内使用音符盒' - 'redstone - 同时配置 lever, diode, button, pressure, note 属性' - 'craft - 同时配置 table, enchant, brew 属性' + - '' list: Description: 查看某个玩家领地 Info: