diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index 1ec31b1..ad54b67 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -2,6 +2,7 @@ package com.cnaude.chairs; import java.io.File; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.logging.Level; @@ -25,7 +26,6 @@ import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; public class Chairs extends JavaPlugin { - private static Chairs instance = null; public static ChairEffects chairEffects; public List allowedBlocks; public List validSigns; @@ -49,8 +49,7 @@ public class Chairs extends JavaPlugin { @Override public void onEnable() { - instance = this; - ignoreList = new ChairsIgnoreList(); + ignoreList = new ChairsIgnoreList(this); ignoreList.load(); pm = this.getServer().getPluginManager(); pluginFolder = getDataFolder(); @@ -67,7 +66,6 @@ public class Chairs extends JavaPlugin { } protocolManager = ProtocolLibrary.getProtocolManager(); new PacketListener(protocolManager, this); - } @Override @@ -87,7 +85,6 @@ public class Chairs extends JavaPlugin { chairEffects.cancel(); } HandlerList.unregisterAll(this); - instance = null; } public void restartEffectsTask() { @@ -257,9 +254,6 @@ public class Chairs extends JavaPlugin { log.log(Level.SEVERE, String.format("%s %s", LOG_HEADER, _message)); } - public static Chairs get() { - return instance; - } } diff --git a/src/com/cnaude/chairs/ChairsIgnoreList.java b/src/com/cnaude/chairs/ChairsIgnoreList.java index 6b473c6..7ecc657 100644 --- a/src/com/cnaude/chairs/ChairsIgnoreList.java +++ b/src/com/cnaude/chairs/ChairsIgnoreList.java @@ -9,18 +9,24 @@ import java.util.ArrayList; /** * - * @author naudec + * @author cnaude */ @SuppressWarnings("serial") public class ChairsIgnoreList implements Serializable{ private static ArrayList ignoreList = new ArrayList(); private static final String IGNORE_FILE = "plugins/Chairs/ignores.ser"; + private Chairs plugin; + public ChairsIgnoreList(Chairs plugin) + { + this.plugin = plugin; + } + @SuppressWarnings("unchecked") public void load() { File file = new File(IGNORE_FILE); if (!file.exists()) { - Chairs.get().logInfo("Ignore file '"+file.getAbsolutePath()+"' does not exist."); + plugin.logInfo("Ignore file '"+file.getAbsolutePath()+"' does not exist."); return; } try { @@ -28,10 +34,10 @@ public class ChairsIgnoreList implements Serializable{ ObjectInputStream obj_in = new ObjectInputStream (f_in); ignoreList = (ArrayList) obj_in.readObject(); obj_in.close(); - Chairs.get().logInfo("Loaded ignore list. (Count = "+ignoreList.size()+")"); + plugin.logInfo("Loaded ignore list. (Count = "+ignoreList.size()+")"); } catch(Exception e) { - Chairs.get().logError(e.getMessage()); + plugin.logError(e.getMessage()); } } @@ -42,10 +48,10 @@ public class ChairsIgnoreList implements Serializable{ ObjectOutputStream obj_out = new ObjectOutputStream (f_out); obj_out.writeObject (ignoreList); obj_out.close(); - Chairs.get().logInfo("Saved ignore list. (Count = "+ignoreList.size()+")"); + plugin.logInfo("Saved ignore list. (Count = "+ignoreList.size()+")"); } catch(Exception e) { - Chairs.get().logError(e.getMessage()); + plugin.logError(e.getMessage()); } } diff --git a/target/Chairs.jar b/target/Chairs.jar index 69de59b..802a7ab 100644 Binary files a/target/Chairs.jar and b/target/Chairs.jar differ