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
|
* To change this template, choose Tools | Templates and open the template in the editor.
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
*/
|
||||||
package com.bekvon.bukkit.residence;
|
package com.bekvon.bukkit.residence;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
@@ -43,7 +42,7 @@ public class ConfigManager {
|
|||||||
protected int minMoveUpdate;
|
protected int minMoveUpdate;
|
||||||
protected FlagPermissions globalCreatorDefaults;
|
protected FlagPermissions globalCreatorDefaults;
|
||||||
protected FlagPermissions globalResidenceDefaults;
|
protected FlagPermissions globalResidenceDefaults;
|
||||||
protected Map<String,FlagPermissions> globalGroupDefaults;
|
protected Map<String, FlagPermissions> globalGroupDefaults;
|
||||||
protected String language;
|
protected String language;
|
||||||
protected boolean preventBuildInRent;
|
protected boolean preventBuildInRent;
|
||||||
protected boolean stopOnSaveError;
|
protected boolean stopOnSaveError;
|
||||||
@@ -58,14 +57,133 @@ public class ConfigManager {
|
|||||||
protected List<Integer> customRightClick;
|
protected List<Integer> customRightClick;
|
||||||
private boolean enforceAreaInsideArea;
|
private boolean enforceAreaInsideArea;
|
||||||
|
|
||||||
public ConfigManager(FileConfiguration config)
|
public ConfigManager(FileConfiguration config) {
|
||||||
{
|
|
||||||
globalCreatorDefaults = new FlagPermissions();
|
globalCreatorDefaults = new FlagPermissions();
|
||||||
globalResidenceDefaults = new FlagPermissions();
|
globalResidenceDefaults = new FlagPermissions();
|
||||||
globalGroupDefaults = new HashMap<String,FlagPermissions>();
|
globalGroupDefaults = new HashMap<String, FlagPermissions>();
|
||||||
this.load(config);
|
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")
|
@SuppressWarnings("deprecation")
|
||||||
private void load(FileConfiguration config) {
|
private void load(FileConfiguration config) {
|
||||||
defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase();
|
defaultGroup = config.getString("Global.DefaultGroup", "default").toLowerCase();
|
||||||
@@ -87,13 +205,15 @@ public class ConfigManager {
|
|||||||
chatEnable = config.getBoolean("Global.ResidenceChatEnable", true);
|
chatEnable = config.getBoolean("Global.ResidenceChatEnable", true);
|
||||||
actionBar = config.getBoolean("Global.UseActionBar", true);
|
actionBar = config.getBoolean("Global.UseActionBar", true);
|
||||||
enforceAreaInsideArea = config.getBoolean("Global.EnforceAreaInsideArea", false);
|
enforceAreaInsideArea = config.getBoolean("Global.EnforceAreaInsideArea", false);
|
||||||
language = config.getString("Global.Language","English");
|
language = config.getString("Global.Language", "English");
|
||||||
globalCreatorDefaults = FlagPermissions.parseFromConfigNode("CreatorDefault", config.getConfigurationSection("Global"));
|
globalCreatorDefaults = FlagPermissions.parseFromConfigNode("CreatorDefault",
|
||||||
globalResidenceDefaults = FlagPermissions.parseFromConfigNode("ResidenceDefault", config.getConfigurationSection("Global"));
|
config.getConfigurationSection("Global"));
|
||||||
|
globalResidenceDefaults = FlagPermissions.parseFromConfigNode("ResidenceDefault",
|
||||||
|
config.getConfigurationSection("Global"));
|
||||||
preventBuildInRent = config.getBoolean("Global.PreventRentModify", true);
|
preventBuildInRent = config.getBoolean("Global.PreventRentModify", true);
|
||||||
stopOnSaveError = config.getBoolean("Global.StopOnSaveFault",true);
|
stopOnSaveError = config.getBoolean("Global.StopOnSaveFault", true);
|
||||||
legacyperms = config.getBoolean("Global.LegacyPermissions",false);
|
legacyperms = config.getBoolean("Global.LegacyPermissions", false);
|
||||||
namefix = config.getString("Global.ResidenceNameRegex",null);//"[^a-zA-Z0-9\\-\\_]"
|
namefix = config.getString("Global.ResidenceNameRegex", null);// "[^a-zA-Z0-9\\-\\_]"
|
||||||
showIntervalMessages = config.getBoolean("Global.ShowIntervalMessages", false);
|
showIntervalMessages = config.getBoolean("Global.ShowIntervalMessages", false);
|
||||||
spoutEnable = config.getBoolean("Global.EnableSpout", false);
|
spoutEnable = config.getBoolean("Global.EnableSpout", false);
|
||||||
enableLeaseMoneyAccount = config.getBoolean("Global.EnableLeaseMoneyAccount", true);
|
enableLeaseMoneyAccount = config.getBoolean("Global.EnableLeaseMoneyAccount", true);
|
||||||
@@ -102,188 +222,46 @@ public class ConfigManager {
|
|||||||
customBothClick = config.getIntegerList("Global.CustomBothClick");
|
customBothClick = config.getIntegerList("Global.CustomBothClick");
|
||||||
customRightClick = config.getIntegerList("Global.CustomRightClick");
|
customRightClick = config.getIntegerList("Global.CustomRightClick");
|
||||||
ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault");
|
ConfigurationSection node = config.getConfigurationSection("Global.GroupDefault");
|
||||||
if(node!=null)
|
if (node != null) {
|
||||||
{
|
|
||||||
Set<String> keys = node.getConfigurationSection(defaultGroup).getKeys(false);
|
Set<String> keys = node.getConfigurationSection(defaultGroup).getKeys(false);
|
||||||
if(keys!=null)
|
if (keys != null) {
|
||||||
{
|
for (String key : keys) {
|
||||||
for(String key: keys)
|
globalGroupDefaults.put(
|
||||||
{
|
key,
|
||||||
globalGroupDefaults.put(key, FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.GroupDefault")));
|
FlagPermissions.parseFromConfigNode(key,
|
||||||
|
config.getConfigurationSection("Global.GroupDefault")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
chatColor = ChatColor.valueOf(config.getString("Global.ResidenceChatColor", "DARK_PURPLE"));
|
chatColor = ChatColor.valueOf(config.getString("Global.ResidenceChatColor",
|
||||||
|
"DARK_PURPLE"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
chatColor = ChatColor.DARK_PURPLE;
|
chatColor = ChatColor.DARK_PURPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useLegacyPermissions()
|
public boolean preventRentModify() {
|
||||||
{
|
return preventBuildInRent;
|
||||||
return legacyperms;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultGroup() {
|
public boolean showIntervalMessages() {
|
||||||
return defaultGroup;
|
return showIntervalMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResidenceNameRegex()
|
public boolean stopOnSaveError() {
|
||||||
{
|
return stopOnSaveError;
|
||||||
return namefix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enableEconomy() {
|
public boolean useActionBar() {
|
||||||
return enableEconomy && Residence.getEconomyManager()!=null;
|
return actionBar;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean enabledRentSystem()
|
|
||||||
{
|
|
||||||
return enableRentSystem && enableEconomy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useLeases() {
|
public boolean useLeases() {
|
||||||
return useLeases;
|
return useLeases;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean allowAdminsOnly() {
|
public boolean useLegacyPermissions() {
|
||||||
return adminsOnly;
|
return legacyperms;
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* To change this template, choose Tools | Templates
|
* To change this template, choose Tools | Templates and open the template in the editor.
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
*/
|
||||||
package com.bekvon.bukkit.residence;
|
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.Language;
|
||||||
import com.bekvon.bukkit.residence.text.help.HelpEntry;
|
import com.bekvon.bukkit.residence.text.help.HelpEntry;
|
||||||
import com.bekvon.bukkit.residence.text.help.InformationPager;
|
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.ResidenceVaultAdapter;
|
||||||
import com.bekvon.bukkit.residence.vaultinterface.ZipLibrary;
|
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,8 +232,7 @@ public class Residence extends JavaPlugin {
|
|||||||
public void run() {
|
public void run() {
|
||||||
rentmanager.checkCurrentRents();
|
rentmanager.checkCurrentRents();
|
||||||
if (cmanager.showIntervalMessages()) {
|
if (cmanager.showIntervalMessages()) {
|
||||||
System.out
|
System.out.println("[Residence] - Rent Expirations checked!");
|
||||||
.println("[Residence] - Rent Expirations checked!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -244,8 +242,7 @@ public class Residence extends JavaPlugin {
|
|||||||
public void run() {
|
public void run() {
|
||||||
leasemanager.doExpirations();
|
leasemanager.doExpirations();
|
||||||
if (cmanager.showIntervalMessages()) {
|
if (cmanager.showIntervalMessages()) {
|
||||||
System.out
|
System.out.println("[Residence] - Lease Expirations checked!");
|
||||||
.println("[Residence] - Lease Expirations checked!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -258,9 +255,7 @@ public class Residence extends JavaPlugin {
|
|||||||
saveYml();
|
saveYml();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.getLogger("Minecraft").log(
|
Logger.getLogger("Minecraft").log(Level.SEVERE, "[Residence] 插件数据 保存 错误", ex);
|
||||||
Level.SEVERE,
|
|
||||||
"[Residence] 插件数据 保存 错误", ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user