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
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
taskmanager.cancelall();
|
|
||||||
if (this.init) {
|
if (this.init) {
|
||||||
|
taskmanager.cancelall();
|
||||||
try {
|
try {
|
||||||
this.saveYml();
|
this.saveYml();
|
||||||
this.backup.backup();
|
this.backup.backup();
|
||||||
|
|||||||
@@ -213,39 +213,43 @@ public class ConfigManager {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void load(final FileConfiguration config) {
|
private void load(final FileConfiguration config) {
|
||||||
defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase();
|
try {
|
||||||
adminsOnly = config.getBoolean("Global.AdminOnlyCommands", false);
|
defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase();
|
||||||
useLeases = config.getBoolean("Global.UseLeaseSystem", false);
|
adminsOnly = config.getBoolean("Global.AdminOnlyCommands", false);
|
||||||
leaseAutoRenew = config.getBoolean("Global.LeaseAutoRenew", true);
|
useLeases = config.getBoolean("Global.UseLeaseSystem", false);
|
||||||
enableEconomy = config.getBoolean("Global.EnableEconomy", false);
|
leaseAutoRenew = config.getBoolean("Global.LeaseAutoRenew", true);
|
||||||
economySystem = config.getString("Global.EconomySystem", "iConomy");
|
enableEconomy = config.getBoolean("Global.EnableEconomy", false);
|
||||||
infoToolId = config.getInt("Global.InfoToolId", Material.STRING.getId());
|
economySystem = config.getString("Global.EconomySystem", "iConomy");
|
||||||
selectionToolId = config.getInt("Global.SelectionToolId", Material.WOOD_AXE.getId());
|
infoToolId = config.getInt("Global.InfoToolId", Material.STRING.getId());
|
||||||
adminOps = config.getBoolean("Global.AdminOPs", true);
|
selectionToolId = config.getInt("Global.SelectionToolId", Material.WOOD_AXE.getId());
|
||||||
multiworldPlugin = config.getString("Global.MultiWorldPlugin");
|
adminOps = config.getBoolean("Global.AdminOPs", true);
|
||||||
enableRentSystem = config.getBoolean("Global.EnableRentSystem", false);
|
multiworldPlugin = config.getString("Global.MultiWorldPlugin");
|
||||||
rentCheckInterval = config.getInt("Global.RentCheckInterval", 10);
|
enableRentSystem = config.getBoolean("Global.EnableRentSystem", false);
|
||||||
leaseCheckInterval = config.getInt("Global.LeaseCheckInterval", 10);
|
rentCheckInterval = config.getInt("Global.RentCheckInterval", 10);
|
||||||
autoSaveInt = config.getInt("Global.SaveInterval", 10);
|
leaseCheckInterval = config.getInt("Global.LeaseCheckInterval", 10);
|
||||||
flagsInherit = config.getBoolean("Global.ResidenceFlagsInherit", false);
|
autoSaveInt = config.getInt("Global.SaveInterval", 10);
|
||||||
minMoveUpdate = config.getInt("Global.MoveCheckInterval", 500);
|
flagsInherit = config.getBoolean("Global.ResidenceFlagsInherit", false);
|
||||||
chatEnable = config.getBoolean("Global.ResidenceChatEnable", true);
|
minMoveUpdate = config.getInt("Global.MoveCheckInterval", 500);
|
||||||
actionBar = config.getBoolean("Global.UseActionBar", true);
|
chatEnable = config.getBoolean("Global.ResidenceChatEnable", true);
|
||||||
enforceAreaInsideArea = config.getBoolean("Global.EnforceAreaInsideArea", false);
|
actionBar = config.getBoolean("Global.UseActionBar", true);
|
||||||
language = config.getString("Global.Language", "English");
|
enforceAreaInsideArea = config.getBoolean("Global.EnforceAreaInsideArea", false);
|
||||||
globalCreatorDefaults = FlagPermissions.parseFromConfigNode("CreatorDefault", config.getConfigurationSection("Global"));
|
language = config.getString("Global.Language", "English");
|
||||||
globalResidenceDefaults = FlagPermissions.parseFromConfigNode("ResidenceDefault", config.getConfigurationSection("Global"));
|
globalCreatorDefaults = FlagPermissions.parseFromConfigNode("CreatorDefault", config.getConfigurationSection("Global"));
|
||||||
preventBuildInRent = config.getBoolean("Global.PreventRentModify", true);
|
globalResidenceDefaults = FlagPermissions.parseFromConfigNode("ResidenceDefault", config.getConfigurationSection("Global"));
|
||||||
stopOnSaveError = config.getBoolean("Global.StopOnSaveFault", true);
|
preventBuildInRent = config.getBoolean("Global.PreventRentModify", true);
|
||||||
legacyperms = config.getBoolean("Global.LegacyPermissions", false);
|
stopOnSaveError = config.getBoolean("Global.StopOnSaveFault", true);
|
||||||
namefix = config.getString("Global.ResidenceNameRegex", "[^A-Za-z0-9\\u4e00-\\u9fa5\\-\\_]");// "[^a-zA-Z0-9\\-\\_]"
|
legacyperms = config.getBoolean("Global.LegacyPermissions", false);
|
||||||
showIntervalMessages = config.getBoolean("Global.ShowIntervalMessages", false);
|
namefix = config.getString("Global.ResidenceNameRegex", "[^A-Za-z0-9\\u4e00-\\u9fa5\\-\\_]");// "[^a-zA-Z0-9\\-\\_]"
|
||||||
spoutEnable = config.getBoolean("Global.EnableSpout", false);
|
showIntervalMessages = config.getBoolean("Global.ShowIntervalMessages", false);
|
||||||
enableLeaseMoneyAccount = config.getBoolean("Global.EnableLeaseMoneyAccount", true);
|
spoutEnable = config.getBoolean("Global.EnableSpout", false);
|
||||||
enableDebug = config.getBoolean("Global.EnableDebug", false);
|
enableLeaseMoneyAccount = config.getBoolean("Global.EnableLeaseMoneyAccount", true);
|
||||||
customContainers = config.getIntegerList("Global.CustomContainers");
|
enableDebug = config.getBoolean("Global.EnableDebug", false);
|
||||||
customBothClick = config.getIntegerList("Global.CustomBothClick");
|
customContainers = config.getIntegerList("Global.CustomContainers");
|
||||||
customRightClick = config.getIntegerList("Global.CustomRightClick");
|
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");
|
final ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault");
|
||||||
|
|
||||||
if (!plugin.is1_8()) {
|
if (!plugin.is1_8()) {
|
||||||
|
|||||||
@@ -46,11 +46,13 @@ public class WorldFlagManager {
|
|||||||
public FlagPermissions getPerms(String world) {
|
public FlagPermissions getPerms(String world) {
|
||||||
world = world.toLowerCase();
|
world = world.toLowerCase();
|
||||||
final FlagPermissions list = worldperms.get(world);
|
final FlagPermissions list = worldperms.get(world);
|
||||||
if (list == null)
|
if (list == null) {
|
||||||
if (globaldefaults == null)
|
if (globaldefaults == null) {
|
||||||
return new FlagPermissions();
|
return new FlagPermissions();
|
||||||
else
|
} else {
|
||||||
return globaldefaults;
|
return globaldefaults;
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,15 +60,18 @@ public class WorldFlagManager {
|
|||||||
world = world.toLowerCase();
|
world = world.toLowerCase();
|
||||||
group = group.toLowerCase();
|
group = group.toLowerCase();
|
||||||
final Map<String, FlagPermissions> groupworldperms = groupperms.get(group);
|
final Map<String, FlagPermissions> groupworldperms = groupperms.get(group);
|
||||||
if (groupworldperms == null)
|
if (groupworldperms == null) {
|
||||||
return this.getPerms(world);
|
return this.getPerms(world);
|
||||||
|
}
|
||||||
FlagPermissions list = groupworldperms.get(world);
|
FlagPermissions list = groupworldperms.get(world);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = groupworldperms.get("global." + world);
|
list = groupworldperms.get("global." + world);
|
||||||
if (list == null)
|
if (list == null) {
|
||||||
list = groupworldperms.get("global");
|
list = groupworldperms.get("global");
|
||||||
if (list == null)
|
}
|
||||||
|
if (list == null) {
|
||||||
return this.getPerms(world);
|
return this.getPerms(world);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -75,16 +80,20 @@ public class WorldFlagManager {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
Set<String> keys = config.getConfigurationSection("Global.Flags").getKeys(false);
|
Set<String> keys = config.getConfigurationSection("Global.Flags").getKeys(false);
|
||||||
if (keys != null)
|
if (keys != null) {
|
||||||
for (final String key : keys)
|
for (final String key : keys) {
|
||||||
if (key.equalsIgnoreCase("Global"))
|
if (key.equalsIgnoreCase("Global")) {
|
||||||
globaldefaults = FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags"));
|
globaldefaults = FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags"));
|
||||||
else
|
} else {
|
||||||
worldperms.put(key.toLowerCase(), FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags")));
|
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);
|
entry.getValue().setParent(globaldefaults);
|
||||||
|
}
|
||||||
keys = config.getConfigurationSection("Groups").getKeys(false);
|
keys = config.getConfigurationSection("Groups").getKeys(false);
|
||||||
if (keys != null)
|
if (keys != null) {
|
||||||
for (final String key : keys) {
|
for (final String key : keys) {
|
||||||
final ConfigurationSection worldkeylist = config.getConfigurationSection("Groups." + key + ".Flags.World");
|
final ConfigurationSection worldkeylist = config.getConfigurationSection("Groups." + key + ".Flags.World");
|
||||||
if (worldkeylist != null) {
|
if (worldkeylist != null) {
|
||||||
@@ -101,24 +110,28 @@ public class WorldFlagManager {
|
|||||||
list.setParent(worldperm.getValue());
|
list.setParent(worldperm.getValue());
|
||||||
perms.put("global." + worldperm.getKey().toLowerCase(), list);
|
perms.put("global." + worldperm.getKey().toLowerCase(), list);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
perms.put(wkey.toLowerCase(), list);
|
perms.put(wkey.toLowerCase(), list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (final Entry<String, FlagPermissions> entry : perms.entrySet()) {
|
for (final Entry<String, FlagPermissions> entry : perms.entrySet()) {
|
||||||
final String wkey = entry.getKey();
|
final String wkey = entry.getKey();
|
||||||
final FlagPermissions list = entry.getValue();
|
final FlagPermissions list = entry.getValue();
|
||||||
if (!wkey.startsWith("global.")) {
|
if (!wkey.startsWith("global.")) {
|
||||||
list.setParent(perms.get("global." + wkey));
|
list.setParent(perms.get("global." + wkey));
|
||||||
if (list.getParent() == null)
|
if (list.getParent() == null) {
|
||||||
list.setParent(worldperms.get(wkey));
|
list.setParent(worldperms.get(wkey));
|
||||||
if (list.getParent() == null)
|
}
|
||||||
|
if (list.getParent() == null) {
|
||||||
list.setParent(globaldefaults);
|
list.setParent(globaldefaults);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
groupperms.put(key.toLowerCase(), perms);
|
groupperms.put(key.toLowerCase(), perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
Logger.getLogger(WorldFlagManager.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(WorldFlagManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,109 +211,109 @@ Global:
|
|||||||
# 这些用户组相当于 '<worldname>.yml的Permissions groups.
|
# 这些用户组相当于 '<worldname>.yml的Permissions groups.
|
||||||
Groups:
|
Groups:
|
||||||
Default: #用户组名称
|
Default: #用户组名称
|
||||||
# 有关玩家可以定义的信息.
|
# 有关玩家可以定义的信息.
|
||||||
# 去除下面的'#'可以镜像复制此配置到其他组.
|
# 去除下面的'#'可以镜像复制此配置到其他组.
|
||||||
#Mirror:
|
#Mirror:
|
||||||
#- 'group1'
|
#- 'group1'
|
||||||
#- 'group2'
|
#- 'group2'
|
||||||
Residence:
|
Residence:
|
||||||
# 玩家是否可以创建领地.这个设置可被 'residence.create' 权限覆盖.
|
# 玩家是否可以创建领地.这个设置可被 'residence.create' 权限覆盖.
|
||||||
CanCreate: true
|
CanCreate: true
|
||||||
# 玩家允许拥有最大领地数.
|
# 玩家允许拥有最大领地数.
|
||||||
MaxResidences: 3
|
MaxResidences: 3
|
||||||
# 一个领地的最大物理区域数目.
|
# 一个领地的最大物理区域数目.
|
||||||
MaxAreasPerResidence: 2
|
MaxAreasPerResidence: 2
|
||||||
# 一个领地在东西方向最大距离 (X坐标).
|
# 一个领地在东西方向最大距离 (X坐标).
|
||||||
MaxEastWest: 16
|
MaxEastWest: 16
|
||||||
# 一个领地在南北方向最大距离 (Z坐标).
|
# 一个领地在南北方向最大距离 (Z坐标).
|
||||||
MaxNorthSouth: 16
|
MaxNorthSouth: 16
|
||||||
# 一个领地在上下方向最大高度 (Y坐标).
|
# 一个领地在上下方向最大高度 (Y坐标).
|
||||||
MaxUpDown: 256
|
MaxUpDown: 256
|
||||||
# 允许创建领地的最低高度.
|
# 允许创建领地的最低高度.
|
||||||
MinHeight: 0
|
MinHeight: 0
|
||||||
# 允许创建领地的最高高度.
|
# 允许创建领地的最高高度.
|
||||||
MaxHeight: 255
|
MaxHeight: 255
|
||||||
# 子区域领地最大深度.
|
# 子区域领地最大深度.
|
||||||
# 当一个领地子区域包含另一个子区域时,最大深度为2.
|
# 当一个领地子区域包含另一个子区域时,最大深度为2.
|
||||||
# 设置为0将禁用领地子区域.
|
# 设置为0将禁用领地子区域.
|
||||||
SubzoneDepth: 3
|
SubzoneDepth: 3
|
||||||
# 是否允许传送
|
# 是否允许传送
|
||||||
CanTeleport: true
|
CanTeleport: true
|
||||||
# 是否允许使用'/res unstuck'命令, 当你卡在领地内时可以传送出去
|
# 是否允许使用'/res unstuck'命令, 当你卡在领地内时可以传送出去
|
||||||
Unstuck: true
|
Unstuck: true
|
||||||
# 是否允许使用'/res select '命令, 如果禁用,那么只能使用工具选取领地.
|
# 是否允许使用'/res select '命令, 如果禁用,那么只能使用工具选取领地.
|
||||||
SelectCommandAccess: true
|
SelectCommandAccess: true
|
||||||
# 领地主人是否允许使用 黑名单/屏蔽列表 .
|
# 领地主人是否允许使用 黑名单/屏蔽列表 .
|
||||||
ItemListAccess: true
|
ItemListAccess: true
|
||||||
# 进入和离开领地时的消息设置.
|
# 进入和离开领地时的消息设置.
|
||||||
Messaging:
|
Messaging:
|
||||||
#玩家是否可以改变领地进出提示.
|
#玩家是否可以改变领地进出提示.
|
||||||
CanChange: true
|
CanChange: true
|
||||||
# 这个文本是当前用户组新建领地后的默认进入信息.
|
# 这个文本是当前用户组新建领地后的默认进入信息.
|
||||||
# 消息留空将禁用.
|
# 消息留空将禁用信息.
|
||||||
DefaultEnter: '欢迎 %player 来到 %owner 的领地 %residence.'
|
DefaultEnter: '欢迎 %player 来到 %owner 的领地 %residence.'
|
||||||
# 这个文本是当前用户组新建领地后的默认离开信息.
|
# 这个文本是当前用户组新建领地后的默认离开信息.
|
||||||
# 消息留空将禁用信息.
|
# 消息留空将禁用信息.
|
||||||
DefaultLeave: '你离开了 %owner 的领地 %residence.'
|
DefaultLeave: '你离开了 %owner 的领地 %residence.'
|
||||||
# 有关出租系统的设置.
|
# 有关出租系统的设置.
|
||||||
Lease:
|
Lease:
|
||||||
# 可出租最大天数.
|
# 可出租最大天数.
|
||||||
MaxDays: 16
|
MaxDays: 16
|
||||||
# 当使用 '/res lease renew' 命令时可续租多少天.
|
# 当使用 '/res lease renew' 命令时可续租多少天.
|
||||||
RenewIncrement: 14
|
RenewIncrement: 14
|
||||||
# 有关租用系统的设置
|
# 有关租用系统的设置
|
||||||
Rent:
|
Rent:
|
||||||
# 决定一次可以租用多少个领地
|
# 决定一次可以租用多少个领地
|
||||||
MaxRents: 3
|
MaxRents: 3
|
||||||
# 决定玩家一次可以设置为出租的领地个数
|
# 决定玩家一次可以设置为出租的领地个数
|
||||||
MaxRentables: 3
|
MaxRentables: 3
|
||||||
# 有关领地经济系统的设置.
|
# 有关领地经济系统的设置.
|
||||||
Economy:
|
Economy:
|
||||||
# 是否可以购买出售中的领地.
|
# 是否可以购买出售中的领地.
|
||||||
CanBuy: true
|
CanBuy: true
|
||||||
# 是否可以出售领地.
|
# 是否可以出售领地.
|
||||||
CanSell: false
|
CanSell: false
|
||||||
# 在购买领地时,是否忽略领地限制.
|
# 在购买领地时,是否忽略领地限制.
|
||||||
IgnoreLimits: false
|
IgnoreLimits: false
|
||||||
# 创建一个新领地或添加物理区域时的每个方块大小花费.
|
# 创建一个新领地或添加物理区域时的每个方块大小花费.
|
||||||
BuyCost: 0.05
|
BuyCost: 0.05
|
||||||
# 出租领地时每个方块大小花费 (如果出租系统开启).
|
# 出租领地时每个方块大小花费 (如果出租系统开启).
|
||||||
RenewCost: 0.02
|
RenewCost: 0.02
|
||||||
# Flag检查顺序:
|
# Flag检查顺序:
|
||||||
# 1: Player 玩家
|
# 1: Player 玩家
|
||||||
# 2: Group 用户组
|
# 2: Group 用户组
|
||||||
# 3: Owner 拥有者
|
# 3: Owner 拥有者
|
||||||
# 4: 如果其他都未定义将使用默认(一般是true).
|
# 4: 如果其他都未定义将使用默认(一般是true).
|
||||||
# Flag 的权限默认是 false.
|
# Flag 的权限默认是 false.
|
||||||
# 这些 flag 设置覆盖总体设置.
|
# 这些 flag 设置覆盖总体设置.
|
||||||
Flags:
|
Flags:
|
||||||
# 特别允许或拒绝这个组权限的Flag.
|
# 特别允许或拒绝这个组权限的Flag.
|
||||||
Permission:
|
Permission:
|
||||||
#build: true
|
#build: true
|
||||||
# 特指为这个组的成员在领地内是否可以进行建造的Flag.
|
# 特指为这个组的成员在领地内是否可以进行建造的Flag.
|
||||||
Default:
|
Default:
|
||||||
#build: true
|
#build: true
|
||||||
# 特指领地的创建者在领地内是否可以进行建造的Flag.
|
# 特指领地的创建者在领地内是否可以进行建造的Flag.
|
||||||
CreatorDefault:
|
CreatorDefault:
|
||||||
#build: true
|
#build: true
|
||||||
# 特指其他组的成员在领地内是否可以进行建造的Flag.
|
# 特指其他组的成员在领地内是否可以进行建造的Flag.
|
||||||
GroupDefault:
|
GroupDefault:
|
||||||
#default: #组名
|
#default: #组名
|
||||||
#build: false
|
#build: false
|
||||||
# 这些Flag将应用于这个组, 当他们在领地之外时将会被使用.
|
# 这些Flag将应用于这个组, 当他们在领地之外时将会被使用.
|
||||||
# 这些Flag将会覆盖上面的Flag, 均为全局选?钕?
|
# 这些Flag将会覆盖上面的Flag, 均为全局选项.
|
||||||
World:
|
World:
|
||||||
Global: # 这些Flag将会应用于所有世界.
|
Global: # 这些Flag将会应用于所有世界.
|
||||||
#build: false
|
#build: false
|
||||||
WorldNameHere: # 或者你也可以单独设置每个世界的情况.
|
WorldNameHere: # 或者你也可以单独设置每个世界的情况.
|
||||||
#build: false
|
#build: false
|
||||||
# 你可以手动设定组里一个玩家的情况, 这将覆盖他所在组的权限.
|
# 你可以手动设定组里一个玩家的情况, 这将覆盖他所在组的权限.
|
||||||
GroupAssignments:
|
GroupAssignments:
|
||||||
bekvon: default
|
bekvon: default
|
||||||
player: default
|
player: default
|
||||||
|
|
||||||
ItemList: #在这里你可以建立黑名单/白名单.
|
ItemList: #在这里你可以建立黑名单/白名单.
|
||||||
DefaultList: #列表的名称并不重要,只要它是唯一的.最好使用一个描述性的名称.
|
DefaultList: #列表的名称并不重要,只要它是唯一的.最好使用一个描述性的名称.
|
||||||
# 列表类型, 可以是黑名单, 白名单, 或屏蔽列表.
|
# 列表类型, 可以是黑名单, 白名单, 或屏蔽列表.
|
||||||
Type: blacklist
|
Type: blacklist
|
||||||
# 如果你想的话, 你可以将此列表只应用到一个世界上, 否则将会应用到所有世界中.
|
# 如果你想的话, 你可以将此列表只应用到一个世界上, 否则将会应用到所有世界中.
|
||||||
|
|||||||
Reference in New Issue
Block a user