Small changes

This commit is contained in:
LlmDl committed 2018-02-18 06:18:08 -06:00
1 parent eac1803c8d
commit cea0d15aa8
1 file changed
+6 -10
+6 -10
View File
@@ -42,7 +42,7 @@ public class Chat extends JavaPlugin {
private TownyChatPlayerListener TownyPlayerListener; private TownyChatPlayerListener TownyPlayerListener;
private ChannelsHolder channels; private ChannelsHolder channels;
private ConfigurationHandler configuration; private ConfigurationHandler channelsConfig;
private static CommentedConfiguration chatConfig, newChatConfig; private static CommentedConfiguration chatConfig, newChatConfig;
protected PluginManager pm; protected PluginManager pm;
@@ -58,7 +58,7 @@ public class Chat extends JavaPlugin {
public void onEnable() { public void onEnable() {
pm = getServer().getPluginManager(); pm = getServer().getPluginManager();
configuration = new ConfigurationHandler(this); channelsConfig = new ConfigurationHandler(this);
channels = new ChannelsHolder(this); channels = new ChannelsHolder(this);
checkPlugins(); checkPlugins();
@@ -66,7 +66,6 @@ public class Chat extends JavaPlugin {
try { try {
loadNewConfig(getTowny().getDataFolder().getPath() + FileMgmt.fileSeparator() + "settings" + FileMgmt.fileSeparator() + "ChatConfig2.yml", this.getDescription().getVersion()); loadNewConfig(getTowny().getDataFolder().getPath() + FileMgmt.fileSeparator() + "settings" + FileMgmt.fileSeparator() + "ChatConfig2.yml", this.getDescription().getVersion());
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
/* /*
@@ -96,7 +95,7 @@ public class Chat extends JavaPlugin {
private boolean load() { private boolean load() {
FileMgmt.checkFolders(new String[] { getRootPath(), getChannelsPath() }); FileMgmt.checkFolders(new String[] { getRootPath(), getChannelsPath() });
return configuration.loadChannels(getChannelsPath(), "Channels.yml"); return channelsConfig.loadChannels(getChannelsPath(), "Channels.yml");
} }
public static void loadNewConfig(String filepath, String version) throws IOException { public static void loadNewConfig(String filepath, String version) throws IOException {
@@ -131,7 +130,7 @@ public class Chat extends JavaPlugin {
towny = null; towny = null;
pm = null; pm = null;
configuration = null; channelsConfig = null;
channels = null; channels = null;
} }
@@ -230,7 +229,7 @@ public class Chat extends JavaPlugin {
* @return the data * @return the data
*/ */
public ConfigurationHandler getConfigurationHandler() { public ConfigurationHandler getConfigurationHandler() {
return configuration; return channelsConfig;
} }
public Towny getTowny() { public Towny getTowny() {
@@ -250,7 +249,7 @@ public class Chat extends JavaPlugin {
} }
/** /**
* Builds a new config reading old config data. * Builds a new chatconfig reading old chatconfig data.
*/ */
private static void setDefaults(String version, File file) { private static void setDefaults(String version, File file) {
@@ -268,9 +267,7 @@ public class Chat extends JavaPlugin {
else { else {
setNewProperty(root.getRoot(), (chatConfig.get(root.getRoot().toLowerCase()) != null) ? chatConfig.get(root.getRoot().toLowerCase()) : root.getDefault()); setNewProperty(root.getRoot(), (chatConfig.get(root.getRoot().toLowerCase()) != null) ? chatConfig.get(root.getRoot().toLowerCase()) : root.getDefault());
} }
} }
chatConfig = newChatConfig; chatConfig = newChatConfig;
newChatConfig = null; newChatConfig = null;
} }
@@ -283,7 +280,6 @@ public class Chat extends JavaPlugin {
private static void setNewProperty(String root, Object value) { private static void setNewProperty(String root, Object value) {
if (value == null) { if (value == null) {
// System.out.print("value is null for " + root.toLowerCase());
value = ""; value = "";
} }
newChatConfig.set(root.toLowerCase(), value.toString()); newChatConfig.set(root.toLowerCase(), value.toString());