mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
add config load tip and format config file...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
@@ -343,8 +343,8 @@ public class ResidenceMain extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
taskmanager.cancelall();
|
||||
if (this.init) {
|
||||
taskmanager.cancelall();
|
||||
try {
|
||||
this.saveYml();
|
||||
this.backup.backup();
|
||||
|
||||
@@ -213,39 +213,43 @@ public class ConfigManager {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void load(final 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", "[^A-Za-z0-9\\u4e00-\\u9fa5\\-\\_]");// "[^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");
|
||||
try {
|
||||
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", "[^A-Za-z0-9\\u4e00-\\u9fa5\\-\\_]");// "[^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");
|
||||
} catch (final Exception e) {
|
||||
throw new RuntimeException("领地配置文件载入错误...", e);
|
||||
}
|
||||
final ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault");
|
||||
|
||||
if (!plugin.is1_8()) {
|
||||
|
||||
@@ -46,11 +46,13 @@ public class WorldFlagManager {
|
||||
public FlagPermissions getPerms(String world) {
|
||||
world = world.toLowerCase();
|
||||
final FlagPermissions list = worldperms.get(world);
|
||||
if (list == null)
|
||||
if (globaldefaults == null)
|
||||
if (list == null) {
|
||||
if (globaldefaults == null) {
|
||||
return new FlagPermissions();
|
||||
else
|
||||
} else {
|
||||
return globaldefaults;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -58,15 +60,18 @@ public class WorldFlagManager {
|
||||
world = world.toLowerCase();
|
||||
group = group.toLowerCase();
|
||||
final Map<String, FlagPermissions> groupworldperms = groupperms.get(group);
|
||||
if (groupworldperms == null)
|
||||
if (groupworldperms == null) {
|
||||
return this.getPerms(world);
|
||||
}
|
||||
FlagPermissions list = groupworldperms.get(world);
|
||||
if (list == null) {
|
||||
list = groupworldperms.get("global." + world);
|
||||
if (list == null)
|
||||
if (list == null) {
|
||||
list = groupworldperms.get("global");
|
||||
if (list == null)
|
||||
}
|
||||
if (list == null) {
|
||||
return this.getPerms(world);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -75,16 +80,20 @@ public class WorldFlagManager {
|
||||
try {
|
||||
|
||||
Set<String> keys = config.getConfigurationSection("Global.Flags").getKeys(false);
|
||||
if (keys != null)
|
||||
for (final String key : keys)
|
||||
if (key.equalsIgnoreCase("Global"))
|
||||
if (keys != null) {
|
||||
for (final String key : keys) {
|
||||
if (key.equalsIgnoreCase("Global")) {
|
||||
globaldefaults = FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags"));
|
||||
else
|
||||
} else {
|
||||
worldperms.put(key.toLowerCase(), FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags")));
|
||||
for (final Entry<String, FlagPermissions> entry : worldperms.entrySet())
|
||||
}
|
||||
}
|
||||
}
|
||||
for (final Entry<String, FlagPermissions> entry : worldperms.entrySet()) {
|
||||
entry.getValue().setParent(globaldefaults);
|
||||
}
|
||||
keys = config.getConfigurationSection("Groups").getKeys(false);
|
||||
if (keys != null)
|
||||
if (keys != null) {
|
||||
for (final String key : keys) {
|
||||
final ConfigurationSection worldkeylist = config.getConfigurationSection("Groups." + key + ".Flags.World");
|
||||
if (worldkeylist != null) {
|
||||
@@ -101,24 +110,28 @@ public class WorldFlagManager {
|
||||
list.setParent(worldperm.getValue());
|
||||
perms.put("global." + worldperm.getKey().toLowerCase(), list);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
perms.put(wkey.toLowerCase(), list);
|
||||
}
|
||||
}
|
||||
for (final Entry<String, FlagPermissions> entry : perms.entrySet()) {
|
||||
final String wkey = entry.getKey();
|
||||
final FlagPermissions list = entry.getValue();
|
||||
if (!wkey.startsWith("global.")) {
|
||||
list.setParent(perms.get("global." + wkey));
|
||||
if (list.getParent() == null)
|
||||
if (list.getParent() == null) {
|
||||
list.setParent(worldperms.get(wkey));
|
||||
if (list.getParent() == null)
|
||||
}
|
||||
if (list.getParent() == null) {
|
||||
list.setParent(globaldefaults);
|
||||
}
|
||||
}
|
||||
}
|
||||
groupperms.put(key.toLowerCase(), perms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
Logger.getLogger(WorldFlagManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@@ -211,109 +211,109 @@ Global:
|
||||
# 这些用户组相当于 '<worldname>.yml的Permissions groups.
|
||||
Groups:
|
||||
Default: #用户组名称
|
||||
# 有关玩家可以定义的信息.
|
||||
# 去除下面的'#'可以镜像复制此配置到其他组.
|
||||
#Mirror:
|
||||
#- 'group1'
|
||||
#- 'group2'
|
||||
Residence:
|
||||
# 玩家是否可以创建领地.这个设置可被 'residence.create' 权限覆盖.
|
||||
CanCreate: true
|
||||
# 玩家允许拥有最大领地数.
|
||||
MaxResidences: 3
|
||||
# 一个领地的最大物理区域数目.
|
||||
MaxAreasPerResidence: 2
|
||||
# 一个领地在东西方向最大距离 (X坐标).
|
||||
MaxEastWest: 16
|
||||
# 一个领地在南北方向最大距离 (Z坐标).
|
||||
MaxNorthSouth: 16
|
||||
# 一个领地在上下方向最大高度 (Y坐标).
|
||||
MaxUpDown: 256
|
||||
# 允许创建领地的最低高度.
|
||||
MinHeight: 0
|
||||
# 允许创建领地的最高高度.
|
||||
MaxHeight: 255
|
||||
# 有关玩家可以定义的信息.
|
||||
# 去除下面的'#'可以镜像复制此配置到其他组.
|
||||
#Mirror:
|
||||
#- 'group1'
|
||||
#- 'group2'
|
||||
Residence:
|
||||
# 玩家是否可以创建领地.这个设置可被 'residence.create' 权限覆盖.
|
||||
CanCreate: true
|
||||
# 玩家允许拥有最大领地数.
|
||||
MaxResidences: 3
|
||||
# 一个领地的最大物理区域数目.
|
||||
MaxAreasPerResidence: 2
|
||||
# 一个领地在东西方向最大距离 (X坐标).
|
||||
MaxEastWest: 16
|
||||
# 一个领地在南北方向最大距离 (Z坐标).
|
||||
MaxNorthSouth: 16
|
||||
# 一个领地在上下方向最大高度 (Y坐标).
|
||||
MaxUpDown: 256
|
||||
# 允许创建领地的最低高度.
|
||||
MinHeight: 0
|
||||
# 允许创建领地的最高高度.
|
||||
MaxHeight: 255
|
||||
# 子区域领地最大深度.
|
||||
# 当一个领地子区域包含另一个子区域时,最大深度为2.
|
||||
# 设置为0将禁用领地子区域.
|
||||
SubzoneDepth: 3
|
||||
# 是否允许传送
|
||||
CanTeleport: true
|
||||
# 是否允许使用'/res unstuck'命令, 当你卡在领地内时可以传送出去
|
||||
Unstuck: true
|
||||
# 是否允许使用'/res select '命令, 如果禁用,那么只能使用工具选取领地.
|
||||
SelectCommandAccess: true
|
||||
# 领地主人是否允许使用 黑名单/屏蔽列表 .
|
||||
ItemListAccess: true
|
||||
# 进入和离开领地时的消息设置.
|
||||
Messaging:
|
||||
#玩家是否可以改变领地进出提示.
|
||||
CanChange: true
|
||||
# 这个文本是当前用户组新建领地后的默认进入信息.
|
||||
# 消息留空将禁用.
|
||||
DefaultEnter: '欢迎 %player 来到 %owner 的领地 %residence.'
|
||||
# 这个文本是当前用户组新建领地后的默认离开信息.
|
||||
# 消息留空将禁用信息.
|
||||
DefaultLeave: '你离开了 %owner 的领地 %residence.'
|
||||
# 有关出租系统的设置.
|
||||
Lease:
|
||||
# 可出租最大天数.
|
||||
MaxDays: 16
|
||||
# 当使用 '/res lease renew' 命令时可续租多少天.
|
||||
RenewIncrement: 14
|
||||
# 有关租用系统的设置
|
||||
Rent:
|
||||
# 决定一次可以租用多少个领地
|
||||
MaxRents: 3
|
||||
# 决定玩家一次可以设置为出租的领地个数
|
||||
MaxRentables: 3
|
||||
# 有关领地经济系统的设置.
|
||||
Economy:
|
||||
# 是否可以购买出售中的领地.
|
||||
CanBuy: true
|
||||
# 是否可以出售领地.
|
||||
CanSell: false
|
||||
# 在购买领地时,是否忽略领地限制.
|
||||
IgnoreLimits: false
|
||||
# 创建一个新领地或添加物理区域时的每个方块大小花费.
|
||||
BuyCost: 0.05
|
||||
# 出租领地时每个方块大小花费 (如果出租系统开启).
|
||||
RenewCost: 0.02
|
||||
# Flag检查顺序:
|
||||
# 1: Player 玩家
|
||||
# 2: Group 用户组
|
||||
# 3: Owner 拥有者
|
||||
# 4: 如果其他都未定义将使用默认(一般是true).
|
||||
# Flag 的权限默认是 false.
|
||||
# 这些 flag 设置覆盖总体设置.
|
||||
Flags:
|
||||
# 特别允许或拒绝这个组权限的Flag.
|
||||
Permission:
|
||||
#build: true
|
||||
# 特指为这个组的成员在领地内是否可以进行建造的Flag.
|
||||
Default:
|
||||
#build: true
|
||||
# 特指领地的创建者在领地内是否可以进行建造的Flag.
|
||||
CreatorDefault:
|
||||
#build: true
|
||||
# 特指其他组的成员在领地内是否可以进行建造的Flag.
|
||||
GroupDefault:
|
||||
#default: #组名
|
||||
#build: false
|
||||
# 这些Flag将应用于这个组, 当他们在领地之外时将会被使用.
|
||||
# 这些Flag将会覆盖上面的Flag, 均为全局选?钕?
|
||||
World:
|
||||
Global: # 这些Flag将会应用于所有世界.
|
||||
#build: false
|
||||
WorldNameHere: # 或者你也可以单独设置每个世界的情况.
|
||||
#build: false
|
||||
SubzoneDepth: 3
|
||||
# 是否允许传送
|
||||
CanTeleport: true
|
||||
# 是否允许使用'/res unstuck'命令, 当你卡在领地内时可以传送出去
|
||||
Unstuck: true
|
||||
# 是否允许使用'/res select '命令, 如果禁用,那么只能使用工具选取领地.
|
||||
SelectCommandAccess: true
|
||||
# 领地主人是否允许使用 黑名单/屏蔽列表 .
|
||||
ItemListAccess: true
|
||||
# 进入和离开领地时的消息设置.
|
||||
Messaging:
|
||||
#玩家是否可以改变领地进出提示.
|
||||
CanChange: true
|
||||
# 这个文本是当前用户组新建领地后的默认进入信息.
|
||||
# 消息留空将禁用信息.
|
||||
DefaultEnter: '欢迎 %player 来到 %owner 的领地 %residence.'
|
||||
# 这个文本是当前用户组新建领地后的默认离开信息.
|
||||
# 消息留空将禁用信息.
|
||||
DefaultLeave: '你离开了 %owner 的领地 %residence.'
|
||||
# 有关出租系统的设置.
|
||||
Lease:
|
||||
# 可出租最大天数.
|
||||
MaxDays: 16
|
||||
# 当使用 '/res lease renew' 命令时可续租多少天.
|
||||
RenewIncrement: 14
|
||||
# 有关租用系统的设置
|
||||
Rent:
|
||||
# 决定一次可以租用多少个领地
|
||||
MaxRents: 3
|
||||
# 决定玩家一次可以设置为出租的领地个数
|
||||
MaxRentables: 3
|
||||
# 有关领地经济系统的设置.
|
||||
Economy:
|
||||
# 是否可以购买出售中的领地.
|
||||
CanBuy: true
|
||||
# 是否可以出售领地.
|
||||
CanSell: false
|
||||
# 在购买领地时,是否忽略领地限制.
|
||||
IgnoreLimits: false
|
||||
# 创建一个新领地或添加物理区域时的每个方块大小花费.
|
||||
BuyCost: 0.05
|
||||
# 出租领地时每个方块大小花费 (如果出租系统开启).
|
||||
RenewCost: 0.02
|
||||
# Flag检查顺序:
|
||||
# 1: Player 玩家
|
||||
# 2: Group 用户组
|
||||
# 3: Owner 拥有者
|
||||
# 4: 如果其他都未定义将使用默认(一般是true).
|
||||
# Flag 的权限默认是 false.
|
||||
# 这些 flag 设置覆盖总体设置.
|
||||
Flags:
|
||||
# 特别允许或拒绝这个组权限的Flag.
|
||||
Permission:
|
||||
#build: true
|
||||
# 特指为这个组的成员在领地内是否可以进行建造的Flag.
|
||||
Default:
|
||||
#build: true
|
||||
# 特指领地的创建者在领地内是否可以进行建造的Flag.
|
||||
CreatorDefault:
|
||||
#build: true
|
||||
# 特指其他组的成员在领地内是否可以进行建造的Flag.
|
||||
GroupDefault:
|
||||
#default: #组名
|
||||
#build: false
|
||||
# 这些Flag将应用于这个组, 当他们在领地之外时将会被使用.
|
||||
# 这些Flag将会覆盖上面的Flag, 均为全局选项.
|
||||
World:
|
||||
Global: # 这些Flag将会应用于所有世界.
|
||||
#build: false
|
||||
WorldNameHere: # 或者你也可以单独设置每个世界的情况.
|
||||
#build: false
|
||||
# 你可以手动设定组里一个玩家的情况, 这将覆盖他所在组的权限.
|
||||
GroupAssignments:
|
||||
bekvon: default
|
||||
player: default
|
||||
bekvon: default
|
||||
player: default
|
||||
|
||||
ItemList: #在这里你可以建立黑名单/白名单.
|
||||
DefaultList: #列表的名称并不重要,只要它是唯一的.最好使用一个描述性的名称.
|
||||
DefaultList: #列表的名称并不重要,只要它是唯一的.最好使用一个描述性的名称.
|
||||
# 列表类型, 可以是黑名单, 白名单, 或屏蔽列表.
|
||||
Type: blacklist
|
||||
# 如果你想的话, 你可以将此列表只应用到一个世界上, 否则将会应用到所有世界中.
|
||||
|
||||
Reference in New Issue
Block a user