This commit is contained in:
Shevchik 2013-09-01 17:17:43 +04:00
parent c4386ab262
commit 526f785677
3 changed files with 14 additions and 14 deletions

View File

@ -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<ChairBlock> allowedBlocks;
public List<Material> 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;
}
}

View File

@ -9,18 +9,24 @@ import java.util.ArrayList;
/**
*
* @author naudec
* @author cnaude
*/
@SuppressWarnings("serial")
public class ChairsIgnoreList implements Serializable{
private static ArrayList<String> ignoreList = new ArrayList<String>();
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<String>) 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());
}
}

Binary file not shown.