1
0
mirror of https://e.coding.net/circlecloud/Residence.git synced 2025-11-26 22:06:07 +00:00

Translation Some Message...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-09-22 20:36:21 +08:00
parent 05e3cbf23f
commit b8b86f4de9
6 changed files with 327 additions and 338 deletions

View File

@@ -184,63 +184,6 @@ public class ConfigManager {
return selectionToolId; 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<String> 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() { public boolean preventRentModify() {
return preventBuildInRent; return preventBuildInRent;
} }
@@ -264,4 +207,57 @@ public class ConfigManager {
public boolean useLegacyPermissions() { public boolean useLegacyPermissions() {
return legacyperms; 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<String> 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;
}
}
} }

View File

@@ -50,10 +50,10 @@ public class ResidenceCommandListener extends Residence {
if (!(sender instanceof Player) || sender instanceof Player && gmanager.isResidenceAdmin((Player) sender)) if (!(sender instanceof Player) || sender instanceof Player && gmanager.isResidenceAdmin((Player) sender))
try { try {
this.loadYml(); this.loadYml();
sender.sendMessage(ChatColor.GREEN + "[Residence] Reloaded save file..."); sender.sendMessage(ChatColor.GREEN + "[Residence] 从配置保存文件重新载入数据...");
} catch (Exception ex) { } catch (Exception ex) {
sender.sendMessage(ChatColor.RED + "[Residence] Unable to reload the save file, exception occured!"); sender.sendMessage(ChatColor.RED + "[Residence] 无法从配置保存文件重新载入数据, 请查看控制台异常信息!");
sender.sendMessage(ChatColor.RED + ex.getMessage()); sender.sendMessage(ChatColor.RED + "[Residence] 异常: " + ex.getMessage());
Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex);
} }
return true; return true;
@@ -63,7 +63,7 @@ public class ResidenceCommandListener extends Residence {
rmanager.removeAllFromWorld(sender, args[1]); rmanager.removeAllFromWorld(sender, args[1]);
return true; return true;
} else } else
sender.sendMessage(ChatColor.RED + "MUST be run from console."); sender.sendMessage(ChatColor.RED + "当前命令必须从控制台执行.");
return false; return false;
} else if (command.getName().equals("rc")) { } else if (command.getName().equals("rc")) {
if (sender instanceof Player) { if (sender instanceof Player) {
@@ -1114,7 +1114,7 @@ public class ResidenceCommandListener extends Residence {
return false; return false;
if (player != null) { if (player != null) {
if (!deleteConfirm.containsKey(player.getName()) || !args[1].equalsIgnoreCase(deleteConfirm.get(player.getName()))) { if (!deleteConfirm.containsKey(player.getName()) || !args[1].equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
String words = ""; String words = null;
if (rmanager.getByName(args[1]) != null) { if (rmanager.getByName(args[1]) != null) {
ClaimedResidence res = rmanager.getByName(args[1]); ClaimedResidence res = rmanager.getByName(args[1]);
if (res.getParent() != null) { if (res.getParent() != null) {
@@ -1122,7 +1122,7 @@ public class ResidenceCommandListener extends Residence {
words = split[split.length - 1]; words = split[split.length - 1];
} }
} }
if (words == "") if (words == null)
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED)); player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED));
else else
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED)); player.sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED));
@@ -1130,7 +1130,7 @@ public class ResidenceCommandListener extends Residence {
} else } else
rmanager.removeResidence(player, args[1], resadmin); rmanager.removeResidence(player, args[1], resadmin);
} else if (!deleteConfirm.containsKey("Console") || !args[1].equalsIgnoreCase(deleteConfirm.get("Console"))) { } else if (!deleteConfirm.containsKey("Console") || !args[1].equalsIgnoreCase(deleteConfirm.get("Console"))) {
String words = ""; String words = null;
if (rmanager.getByName(args[1]) != null) { if (rmanager.getByName(args[1]) != null) {
ClaimedResidence res = rmanager.getByName(args[1]); ClaimedResidence res = rmanager.getByName(args[1]);
if (res.getParent() != null) { if (res.getParent() != null) {
@@ -1138,7 +1138,7 @@ public class ResidenceCommandListener extends Residence {
words = split[split.length - 1]; words = split[split.length - 1];
} }
} }
if (words == "") if (words == null)
server.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED)); server.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED));
else else
server.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED)); server.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED));

View File

@@ -159,7 +159,7 @@ public class ResidencePlayerListener implements Listener {
if (leave != null && !leave.equals("") && ResOld != res.getParent()) if (leave != null && !leave.equals("") && ResOld != res.getParent())
if (Residence.getConfigManager().useActionBar()) 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 else
player.sendMessage(ChatColor.YELLOW + this.insertMessages(player, ResOld.getName(), ResOld, leave)); player.sendMessage(ChatColor.YELLOW + this.insertMessages(player, ResOld.getName(), ResOld, leave));
} }

View File

@@ -5,20 +5,21 @@
package com.bekvon.bukkit.residence.permissions; 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.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player; 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 * @author Administrator
@@ -26,295 +27,290 @@ import org.bukkit.entity.Player;
* changed by inori 03/17/2012 line 91:limits MaxHeight changed to 255 * changed by inori 03/17/2012 line 91:limits MaxHeight changed to 255
*/ */
public class PermissionGroup { public class PermissionGroup {
protected int xmax; protected int xmax;
protected int ymax; protected int ymax;
protected int zmax; protected int zmax;
protected int resmax; protected int resmax;
protected double costperarea; protected double costperarea;
protected boolean tpaccess; protected boolean tpaccess;
protected int subzonedepth; protected int subzonedepth;
protected FlagPermissions flagPerms; protected FlagPermissions flagPerms;
protected Map<String, Boolean> creatorDefaultFlags; protected Map<String, Boolean> creatorDefaultFlags;
protected Map<String, Map<String, Boolean>> groupDefaultFlags; protected Map<String, Map<String, Boolean>> groupDefaultFlags;
protected Map<String, Boolean> residenceDefaultFlags; protected Map<String, Boolean> residenceDefaultFlags;
protected boolean messageperms; protected boolean messageperms;
protected String defaultEnterMessage; protected String defaultEnterMessage;
protected String defaultLeaveMessage; protected String defaultLeaveMessage;
protected int maxLeaseTime; protected int maxLeaseTime;
protected int leaseGiveTime; protected int leaseGiveTime;
protected double renewcostperarea; protected double renewcostperarea;
protected boolean canBuy; protected boolean canBuy;
protected boolean canSell; protected boolean canSell;
protected boolean buyIgnoreLimits; protected boolean buyIgnoreLimits;
protected boolean cancreate; protected boolean cancreate;
protected String groupname; protected String groupname;
protected int maxPhysical; protected int maxPhysical;
protected boolean unstuck; protected boolean unstuck;
protected boolean kick; protected boolean kick;
protected int minHeight; protected int minHeight;
protected int maxHeight; protected int maxHeight;
protected int maxRents; protected int maxRents;
protected int maxRentables; protected int maxRentables;
protected boolean selectCommandAccess; protected boolean selectCommandAccess;
protected boolean itemListAccess; protected boolean itemListAccess;
public PermissionGroup(String name) { public PermissionGroup(String name) {
flagPerms = new FlagPermissions(); flagPerms = new FlagPermissions();
creatorDefaultFlags = new HashMap<String, Boolean>(); creatorDefaultFlags = new HashMap<String, Boolean>();
residenceDefaultFlags = new HashMap<String, Boolean>(); residenceDefaultFlags = new HashMap<String, Boolean>();
groupDefaultFlags = new HashMap<String, Map<String, Boolean>>(); groupDefaultFlags = new HashMap<String, Map<String, Boolean>>();
groupname = name; groupname = name;
} }
public PermissionGroup(String name, ConfigurationSection node) { public PermissionGroup(String name, ConfigurationSection node) {
this(name); this(name);
this.parseGroup(node); this.parseGroup(node);
} }
public PermissionGroup(String name, ConfigurationSection node, FlagPermissions parentFlagPerms) { public PermissionGroup(String name, ConfigurationSection node, FlagPermissions parentFlagPerms) {
this(name, node); this(name, node);
flagPerms.setParent(parentFlagPerms); flagPerms.setParent(parentFlagPerms);
} }
private void parseGroup(ConfigurationSection limits) { public boolean buyLandIgnoreLimits() {
if (limits == null) { return buyIgnoreLimits;
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<String> flags = null;
if (node != null) {
flags = node.getKeys(false);
}
if (flags != null) {
Iterator<String> 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<String> flagit = flags.iterator();
while (flagit.hasNext()) {
String flagname = flagit.next();
boolean access = limits.getBoolean("Flags.CreatorDefault." + flagname, false);
creatorDefaultFlags.put(flagname, access);
}
} public boolean canBuyLand() {
node = limits.getConfigurationSection("Flags.Default"); return canBuy;
if (node != null) { }
flags = node.getKeys(false);
}
if (flags != null) {
Iterator<String> 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<String> groupDef = null;
if (node != null) {
groupDef = node.getKeys(false);
}
if (groupDef != null) {
Iterator<String> groupit = groupDef.iterator();
while (groupit.hasNext()) {
String name = groupit.next();
Map<String, Boolean> gflags = new HashMap<String, Boolean>();
flags = limits.getConfigurationSection("Flags.GroupDefault." + name).getKeys(false);
Iterator<String> 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 int getMaxX() { public boolean canCreateResidences() {
return xmax; return cancreate;
} }
public int getMaxY() { public boolean canSellLand() {
return ymax; return canSell;
} }
public int getMaxZ() { public boolean canSetEnterLeaveMessages() {
return zmax; return messageperms;
} }
public int getMinHeight() { public double getCostPerBlock() {
return minHeight; return costperarea;
} }
public int getMaxHeight() { public Set<Entry<String, Boolean>> getDefaultCreatorFlags() {
return maxHeight; return creatorDefaultFlags.entrySet();
} }
public int getMaxZones() { public String getDefaultEnterMessage() {
return resmax; return defaultEnterMessage;
} }
public double getCostPerBlock() { public Set<Entry<String, Map<String, Boolean>>> getDefaultGroupFlags() {
return costperarea; return groupDefaultFlags.entrySet();
} }
public boolean hasTpAccess() { public String getDefaultLeaveMessage() {
return tpaccess; return defaultLeaveMessage;
} }
public int getMaxSubzoneDepth() { public Set<Entry<String, Boolean>> getDefaultResidenceFlags() {
return subzonedepth; return residenceDefaultFlags.entrySet();
} }
public boolean canSetEnterLeaveMessages() { public int getLeaseGiveTime() {
return messageperms; return leaseGiveTime;
} }
public String getDefaultEnterMessage() { public double getLeaseRenewCost() {
return defaultEnterMessage; return renewcostperarea;
} }
public String getDefaultLeaveMessage() { public int getMaxHeight() {
return defaultLeaveMessage; return maxHeight;
} }
public int getMaxLeaseTime() { public int getMaxLeaseTime() {
return maxLeaseTime; return maxLeaseTime;
} }
public int getLeaseGiveTime() { public int getMaxPhysicalPerResidence() {
return leaseGiveTime; return maxPhysical;
} }
public double getLeaseRenewCost() { public int getMaxRentables() {
return renewcostperarea; return maxRentables;
} }
public boolean canBuyLand() { public int getMaxRents() {
return canBuy; return maxRents;
} }
public boolean canSellLand() { public int getMaxSubzoneDepth() {
return canSell; return subzonedepth;
} }
public int getMaxRents() { public int getMaxX() {
return maxRents; return xmax;
} }
public int getMaxRentables() { public int getMaxY() {
return maxRentables; return ymax;
} }
public boolean buyLandIgnoreLimits() { public int getMaxZ() {
return buyIgnoreLimits; return zmax;
} }
public boolean hasUnstuckAccess() { public int getMaxZones() {
return unstuck; return resmax;
} }
public boolean hasKickAccess() {
return kick;
}
public int getMaxPhysicalPerResidence() {
return maxPhysical;
}
public Set<Entry<String, Boolean>> getDefaultResidenceFlags() { public int getMinHeight() {
return residenceDefaultFlags.entrySet(); return minHeight;
} }
public Set<Entry<String, Boolean>> getDefaultCreatorFlags() { public boolean hasFlagAccess(String flag) {
return creatorDefaultFlags.entrySet(); return flagPerms.has(flag, false);
} }
public Set<Entry<String, Map<String, Boolean>>> getDefaultGroupFlags() { public boolean hasKickAccess() {
return groupDefaultFlags.entrySet(); return kick;
} }
public boolean canCreateResidences() { public boolean hasTpAccess() {
return cancreate; return tpaccess;
} }
public boolean hasFlagAccess(String flag) { public boolean hasUnstuckAccess() {
return flagPerms.has(flag, false); return unstuck;
} }
public boolean inLimits(CuboidArea area) { public boolean inLimits(CuboidArea area) {
if (area.getXSize() > xmax || area.getYSize() > ymax || area.getZSize() > zmax) { if (area.getXSize() > xmax || area.getYSize() > ymax || area.getZSize() > zmax)
return false; return false;
} return true;
return true; }
}
public boolean selectCommandAccess() { public boolean itemListAccess() {
return selectCommandAccess; return itemListAccess;
} }
public boolean itemListAccess() { public void printLimits(Player player) {
return itemListAccess; 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) { public boolean selectCommandAccess() {
player.sendMessage(ChatColor.GRAY + "---------------------------"); return selectCommandAccess;
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)); private void parseGroup(ConfigurationSection limits) {
player.sendMessage(ChatColor.YELLOW + "Can Create Residences:" + ChatColor.DARK_AQUA + " " + cancreate); if (limits == null)
player.sendMessage(ChatColor.YELLOW + "Max Residences:" + ChatColor.DARK_AQUA + " " + resmax); return;
player.sendMessage(ChatColor.YELLOW + "Max East/West Size:" + ChatColor.DARK_AQUA + " " + xmax); cancreate = limits.getBoolean("Residence.CanCreate", false);
player.sendMessage(ChatColor.YELLOW + "Max North/South Size:" + ChatColor.DARK_AQUA + " " + zmax); resmax = limits.getInt("Residence.MaxResidences", 0);
player.sendMessage(ChatColor.YELLOW + "Max Up/Down Size:" + ChatColor.DARK_AQUA + " " + ymax); maxPhysical = limits.getInt("Residence.MaxAreasPerResidence", 2);
player.sendMessage(ChatColor.YELLOW + "Min/Max Protection Height:" + ChatColor.DARK_AQUA + " " + minHeight + " to " + maxHeight); xmax = limits.getInt("Residence.MaxEastWest", 0);
player.sendMessage(ChatColor.YELLOW + "Max Subzone Depth:" + ChatColor.DARK_AQUA + " " + subzonedepth); ymax = limits.getInt("Residence.MaxUpDown", 0);
player.sendMessage(ChatColor.YELLOW + "Can Set Enter/Leave Messages:" + ChatColor.DARK_AQUA + " " + messageperms); zmax = limits.getInt("Residence.MaxNorthSouth", 0);
player.sendMessage(ChatColor.YELLOW + "Number of Residences you own:" + ChatColor.DARK_AQUA + " " + Residence.getResidenceManager().getOwnedZoneCount(player.getName())); minHeight = limits.getInt("Residence.MinHeight", 0);
if (Residence.getEconomyManager() != null) { maxHeight = limits.getInt("Residence.MaxHeight", 255);
player.sendMessage(ChatColor.YELLOW + "Residence Cost Per Block:" + ChatColor.DARK_AQUA + " " + costperarea); tpaccess = limits.getBoolean("Residence.CanTeleport", false);
} subzonedepth = limits.getInt("Residence.SubzoneDepth", 0);
player.sendMessage(ChatColor.YELLOW + "Flag Permissions:" + ChatColor.DARK_AQUA + " " + flagPerms.listFlags()); messageperms = limits.getBoolean("Messaging.CanChange", false);
if (Residence.getConfigManager().useLeases()) { defaultEnterMessage = limits.getString("Messaging.DefaultEnter", null);
player.sendMessage(ChatColor.YELLOW + "Max Lease Days:" + ChatColor.DARK_AQUA + " " + maxLeaseTime); defaultLeaveMessage = limits.getString("Messaging.DefaultLeave", null);
player.sendMessage(ChatColor.YELLOW + "Lease Time Given on Renew:" + ChatColor.DARK_AQUA + " " + leaseGiveTime); maxLeaseTime = limits.getInt("Lease.MaxDays", 16);
player.sendMessage(ChatColor.YELLOW + "Renew Cost Per Block:" + ChatColor.DARK_AQUA + " " + renewcostperarea); leaseGiveTime = limits.getInt("Lease.RenewIncrement", 14);
} maxRents = limits.getInt("Rent.MaxRents", 0);
player.sendMessage(ChatColor.GRAY + "---------------------------"); 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<String> flags = null;
if (node != null)
flags = node.getKeys(false);
if (flags != null) {
Iterator<String> 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<String> 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<String> 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<String> groupDef = null;
if (node != null)
groupDef = node.getKeys(false);
if (groupDef != null) {
Iterator<String> groupit = groupDef.iterator();
while (groupit.hasNext()) {
String name = groupit.next();
Map<String, Boolean> gflags = new HashMap<String, Boolean>();
flags = limits.getConfigurationSection("Flags.GroupDefault." + name).getKeys(false);
Iterator<String> 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);
}
}
}
} }

View File

@@ -796,12 +796,6 @@ public class ClaimedResidence {
} }
public void setEnterLeaveMessage(Player player, String message, boolean enter, boolean resadmin) { 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 != null)
if (message.equals("")) if (message.equals(""))
message = null; message = null;

View File

@@ -313,7 +313,7 @@ CommandHelp: #this is just a holder node, that holds the entire help
Description: '设置选区为WorldEdit的已选择区域.' Description: '设置选区为WorldEdit的已选择区域.'
Info: Info:
- 'Usage /res select worldedit' - 'Usage /res select worldedit'
- 'Sets selection area using the current WorldEdit selection.' - '设置领地的选区为WorldEdit的已选择区域.'
create: #creation command create: #creation command
Description: '创建领地' Description: '创建领地'
Info: Info:
@@ -326,9 +326,11 @@ CommandHelp: #this is just a holder node, that holds the entire help
Description: '删除某位玩家所属的全部领地.' Description: '删除某位玩家所属的全部领地.'
Info: Info:
- 'Usage: /res removeall [owner]' - 'Usage: /res removeall [owner]'
- 'Removes all residences owned by a specific player.' - '移除某一个玩家的所有领地.'
- 'Requires /resadmin if you use it on anyone besides yourself.' - '必须使用 /resadmin 如果你是移除别人的领地.'
confirm: confirm:
Description: '确认领地的删除操作.'
info:
- 'Usage: /res confirm' - 'Usage: /res confirm'
- '确认你要删除某个领地' - '确认你要删除某个领地'
subzone: subzone:
@@ -476,6 +478,7 @@ CommandHelp: #this is just a holder node, that holds the entire help
- 'note - 允许或禁止领地内使用音符盒' - 'note - 允许或禁止领地内使用音符盒'
- 'redstone - 同时配置 lever, diode, button, pressure, note 属性' - 'redstone - 同时配置 lever, diode, button, pressure, note 属性'
- 'craft - 同时配置 table, enchant, brew 属性' - 'craft - 同时配置 table, enchant, brew 属性'
- ''
list: list:
Description: 查看某个玩家领地 Description: 查看某个玩家领地
Info: Info: