mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
@@ -1,21 +1,20 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* To change this template, choose Tools | Templates and open the template in the editor.
|
||||
*/
|
||||
package com.bekvon.bukkit.residence;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
@@ -58,14 +57,133 @@ public class ConfigManager {
|
||||
protected List<Integer> customRightClick;
|
||||
private boolean enforceAreaInsideArea;
|
||||
|
||||
public ConfigManager(FileConfiguration config)
|
||||
{
|
||||
public ConfigManager(FileConfiguration config) {
|
||||
globalCreatorDefaults = new FlagPermissions();
|
||||
globalResidenceDefaults = new FlagPermissions();
|
||||
globalGroupDefaults = new HashMap<String, FlagPermissions>();
|
||||
this.load(config);
|
||||
}
|
||||
|
||||
public boolean allowAdminsOnly() {
|
||||
return adminsOnly;
|
||||
}
|
||||
|
||||
public boolean allowEmptyResidences() {
|
||||
return allowEmptyResidences;
|
||||
}
|
||||
|
||||
public boolean autoRenewLeases() {
|
||||
return leaseAutoRenew;
|
||||
}
|
||||
|
||||
public boolean chatEnabled() {
|
||||
return chatEnable;
|
||||
}
|
||||
|
||||
public boolean debugEnabled() {
|
||||
return enableDebug;
|
||||
}
|
||||
|
||||
public boolean enabledRentSystem() {
|
||||
return enableRentSystem && enableEconomy();
|
||||
}
|
||||
|
||||
public boolean enableEconomy() {
|
||||
return enableEconomy && Residence.getEconomyManager() != null;
|
||||
}
|
||||
|
||||
public boolean enableLeaseMoneyAccount() {
|
||||
return enableLeaseMoneyAccount;
|
||||
}
|
||||
|
||||
public boolean enableSpout() {
|
||||
return spoutEnable;
|
||||
}
|
||||
|
||||
public boolean flagsInherit() {
|
||||
return flagsInherit;
|
||||
}
|
||||
|
||||
public int getAutoSaveInterval() {
|
||||
return autoSaveInt;
|
||||
}
|
||||
|
||||
public ChatColor getChatColor() {
|
||||
return chatColor;
|
||||
}
|
||||
|
||||
public List<Integer> getCustomBothClick() {
|
||||
return customBothClick;
|
||||
}
|
||||
|
||||
public List<Integer> getCustomContainers() {
|
||||
return customContainers;
|
||||
}
|
||||
|
||||
public List<Integer> getCustomRightClick() {
|
||||
return customRightClick;
|
||||
}
|
||||
|
||||
public String getDefaultGroup() {
|
||||
return defaultGroup;
|
||||
}
|
||||
|
||||
public String getEconomySystem() {
|
||||
return economySystem;
|
||||
}
|
||||
|
||||
public boolean getEnforceAreaInsideArea() {
|
||||
return enforceAreaInsideArea;
|
||||
}
|
||||
|
||||
public FlagPermissions getGlobalCreatorDefaultFlags() {
|
||||
return globalCreatorDefaults;
|
||||
}
|
||||
|
||||
public Map<String, FlagPermissions> getGlobalGroupDefaultFlags() {
|
||||
return globalGroupDefaults;
|
||||
}
|
||||
|
||||
public FlagPermissions getGlobalResidenceDefaultFlags() {
|
||||
return globalResidenceDefaults;
|
||||
}
|
||||
|
||||
public int getInfoToolID() {
|
||||
return infoToolId;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public int getLeaseCheckInterval() {
|
||||
return leaseCheckInterval;
|
||||
}
|
||||
|
||||
public int getMinMoveUpdateInterval() {
|
||||
return minMoveUpdate;
|
||||
}
|
||||
|
||||
public String getMultiworldPlugin() {
|
||||
return multiworldPlugin;
|
||||
}
|
||||
|
||||
public boolean getOpsAreAdmins() {
|
||||
return adminOps;
|
||||
}
|
||||
|
||||
public int getRentCheckInterval() {
|
||||
return rentCheckInterval;
|
||||
}
|
||||
|
||||
public String getResidenceNameRegex() {
|
||||
return namefix;
|
||||
}
|
||||
|
||||
public int getSelectionTooldID() {
|
||||
return selectionToolId;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void load(FileConfiguration config) {
|
||||
defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase();
|
||||
@@ -88,8 +206,10 @@ public class ConfigManager {
|
||||
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"));
|
||||
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);
|
||||
@@ -102,188 +222,46 @@ public class ConfigManager {
|
||||
customBothClick = config.getIntegerList("Global.CustomBothClick");
|
||||
customRightClick = config.getIntegerList("Global.CustomRightClick");
|
||||
ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault");
|
||||
if(node!=null)
|
||||
{
|
||||
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")));
|
||||
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"));
|
||||
chatColor = ChatColor.valueOf(config.getString("Global.ResidenceChatColor",
|
||||
"DARK_PURPLE"));
|
||||
} catch (Exception ex) {
|
||||
chatColor = ChatColor.DARK_PURPLE;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean useLegacyPermissions()
|
||||
{
|
||||
return legacyperms;
|
||||
public boolean preventRentModify() {
|
||||
return preventBuildInRent;
|
||||
}
|
||||
|
||||
public String getDefaultGroup() {
|
||||
return defaultGroup;
|
||||
public boolean showIntervalMessages() {
|
||||
return showIntervalMessages;
|
||||
}
|
||||
|
||||
public String getResidenceNameRegex()
|
||||
{
|
||||
return namefix;
|
||||
public boolean stopOnSaveError() {
|
||||
return stopOnSaveError;
|
||||
}
|
||||
|
||||
public boolean enableEconomy() {
|
||||
return enableEconomy && Residence.getEconomyManager()!=null;
|
||||
}
|
||||
|
||||
public boolean enabledRentSystem()
|
||||
{
|
||||
return enableRentSystem && enableEconomy();
|
||||
public boolean useActionBar() {
|
||||
return actionBar;
|
||||
}
|
||||
|
||||
public boolean useLeases() {
|
||||
return useLeases;
|
||||
}
|
||||
|
||||
public boolean allowAdminsOnly() {
|
||||
return adminsOnly;
|
||||
}
|
||||
public boolean allowEmptyResidences()
|
||||
{
|
||||
return allowEmptyResidences;
|
||||
}
|
||||
public int getInfoToolID()
|
||||
{
|
||||
return infoToolId;
|
||||
}
|
||||
public int getSelectionTooldID()
|
||||
{
|
||||
return selectionToolId;
|
||||
}
|
||||
|
||||
public boolean getOpsAreAdmins()
|
||||
{
|
||||
return adminOps;
|
||||
}
|
||||
|
||||
public String getMultiworldPlugin()
|
||||
{
|
||||
return multiworldPlugin;
|
||||
}
|
||||
|
||||
public boolean autoRenewLeases()
|
||||
{
|
||||
return leaseAutoRenew;
|
||||
}
|
||||
|
||||
public String getEconomySystem()
|
||||
{
|
||||
return economySystem;
|
||||
}
|
||||
|
||||
public int getRentCheckInterval()
|
||||
{
|
||||
return rentCheckInterval;
|
||||
}
|
||||
|
||||
public int getLeaseCheckInterval()
|
||||
{
|
||||
return leaseCheckInterval;
|
||||
}
|
||||
|
||||
public int getAutoSaveInterval()
|
||||
{
|
||||
return autoSaveInt;
|
||||
}
|
||||
|
||||
public boolean flagsInherit()
|
||||
{
|
||||
return flagsInherit;
|
||||
}
|
||||
|
||||
public boolean chatEnabled()
|
||||
{
|
||||
return chatEnable;
|
||||
}
|
||||
|
||||
public boolean useActionBar()
|
||||
{
|
||||
return actionBar;
|
||||
}
|
||||
|
||||
public ChatColor getChatColor()
|
||||
{
|
||||
return chatColor;
|
||||
}
|
||||
|
||||
public int getMinMoveUpdateInterval()
|
||||
{
|
||||
return minMoveUpdate;
|
||||
}
|
||||
|
||||
public FlagPermissions getGlobalCreatorDefaultFlags()
|
||||
{
|
||||
return globalCreatorDefaults;
|
||||
}
|
||||
|
||||
public FlagPermissions getGlobalResidenceDefaultFlags()
|
||||
{
|
||||
return globalResidenceDefaults;
|
||||
}
|
||||
|
||||
public Map<String,FlagPermissions> getGlobalGroupDefaultFlags()
|
||||
{
|
||||
return globalGroupDefaults;
|
||||
}
|
||||
|
||||
public String getLanguage()
|
||||
{
|
||||
return language;
|
||||
}
|
||||
|
||||
public boolean preventRentModify()
|
||||
{
|
||||
return preventBuildInRent;
|
||||
}
|
||||
public boolean stopOnSaveError()
|
||||
{
|
||||
return stopOnSaveError;
|
||||
}
|
||||
public boolean showIntervalMessages()
|
||||
{
|
||||
return showIntervalMessages;
|
||||
}
|
||||
public boolean enableSpout()
|
||||
{
|
||||
return spoutEnable;
|
||||
}
|
||||
public boolean enableLeaseMoneyAccount()
|
||||
{
|
||||
return enableLeaseMoneyAccount;
|
||||
}
|
||||
public boolean debugEnabled()
|
||||
{
|
||||
return enableDebug;
|
||||
}
|
||||
|
||||
public List<Integer> getCustomContainers()
|
||||
{
|
||||
return customContainers;
|
||||
}
|
||||
|
||||
public List<Integer> getCustomBothClick()
|
||||
{
|
||||
return customBothClick;
|
||||
}
|
||||
|
||||
public List<Integer> getCustomRightClick()
|
||||
{
|
||||
return customRightClick;
|
||||
}
|
||||
|
||||
public boolean getEnforceAreaInsideArea() {
|
||||
return enforceAreaInsideArea;
|
||||
public boolean useLegacyPermissions() {
|
||||
return legacyperms;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* To change this template, choose Tools | Templates and open the template in the editor.
|
||||
*/
|
||||
package com.bekvon.bukkit.residence;
|
||||
|
||||
@@ -57,8 +56,8 @@ import com.bekvon.bukkit.residence.selection.WorldEditSelectionManager;
|
||||
import com.bekvon.bukkit.residence.text.Language;
|
||||
import com.bekvon.bukkit.residence.text.help.HelpEntry;
|
||||
import com.bekvon.bukkit.residence.text.help.InformationPager;
|
||||
import com.bekvon.bukkit.residence.utils.ZipLibrary;
|
||||
import com.bekvon.bukkit.residence.vaultinterface.ResidenceVaultAdapter;
|
||||
import com.bekvon.bukkit.residence.vaultinterface.ZipLibrary;
|
||||
import com.earth2me.essentials.Essentials;
|
||||
|
||||
/**
|
||||
@@ -233,8 +232,7 @@ public class Residence extends JavaPlugin {
|
||||
public void run() {
|
||||
rentmanager.checkCurrentRents();
|
||||
if (cmanager.showIntervalMessages()) {
|
||||
System.out
|
||||
.println("[Residence] - Rent Expirations checked!");
|
||||
System.out.println("[Residence] - Rent Expirations checked!");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -244,8 +242,7 @@ public class Residence extends JavaPlugin {
|
||||
public void run() {
|
||||
leasemanager.doExpirations();
|
||||
if (cmanager.showIntervalMessages()) {
|
||||
System.out
|
||||
.println("[Residence] - Lease Expirations checked!");
|
||||
System.out.println("[Residence] - Lease Expirations checked!");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -258,9 +255,7 @@ public class Residence extends JavaPlugin {
|
||||
saveYml();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger("Minecraft").log(
|
||||
Level.SEVERE,
|
||||
"[Residence] 插件数据 保存 错误", ex);
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, "[Residence] 插件数据 保存 错误", ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user