mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
@@ -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<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() {
|
||||
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<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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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<String, Boolean> creatorDefaultFlags;
|
||||
protected Map<String, Map<String, Boolean>> groupDefaultFlags;
|
||||
protected Map<String, Boolean> 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<String, Boolean> creatorDefaultFlags;
|
||||
protected Map<String, Map<String, Boolean>> groupDefaultFlags;
|
||||
protected Map<String, Boolean> 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<String, Boolean>();
|
||||
residenceDefaultFlags = new HashMap<String, Boolean>();
|
||||
groupDefaultFlags = new HashMap<String, Map<String, Boolean>>();
|
||||
groupname = name;
|
||||
}
|
||||
public PermissionGroup(String name) {
|
||||
flagPerms = new FlagPermissions();
|
||||
creatorDefaultFlags = new HashMap<String, Boolean>();
|
||||
residenceDefaultFlags = new HashMap<String, Boolean>();
|
||||
groupDefaultFlags = new HashMap<String, Map<String, Boolean>>();
|
||||
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<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 buyLandIgnoreLimits() {
|
||||
return buyIgnoreLimits;
|
||||
}
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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<Entry<String, Boolean>> getDefaultCreatorFlags() {
|
||||
return creatorDefaultFlags.entrySet();
|
||||
}
|
||||
|
||||
public int getMaxZones() {
|
||||
return resmax;
|
||||
}
|
||||
public String getDefaultEnterMessage() {
|
||||
return defaultEnterMessage;
|
||||
}
|
||||
|
||||
public double getCostPerBlock() {
|
||||
return costperarea;
|
||||
}
|
||||
public Set<Entry<String, Map<String, Boolean>>> getDefaultGroupFlags() {
|
||||
return groupDefaultFlags.entrySet();
|
||||
}
|
||||
|
||||
public boolean hasTpAccess() {
|
||||
return tpaccess;
|
||||
}
|
||||
public String getDefaultLeaveMessage() {
|
||||
return defaultLeaveMessage;
|
||||
}
|
||||
|
||||
public int getMaxSubzoneDepth() {
|
||||
return subzonedepth;
|
||||
}
|
||||
public Set<Entry<String, Boolean>> 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<Entry<String, Boolean>> getDefaultResidenceFlags() {
|
||||
return residenceDefaultFlags.entrySet();
|
||||
}
|
||||
public int getMinHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public Set<Entry<String, Boolean>> getDefaultCreatorFlags() {
|
||||
return creatorDefaultFlags.entrySet();
|
||||
}
|
||||
public boolean hasFlagAccess(String flag) {
|
||||
return flagPerms.has(flag, false);
|
||||
}
|
||||
|
||||
public Set<Entry<String, Map<String, Boolean>>> 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<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user