Remove ignore list save/load

Due to uuids i had to remove it. Now this list is only temporal.
This commit is contained in:
Shevchik 2014-07-09 09:23:41 +04:00
parent e8c930e418
commit 80d877390b
2 changed files with 5 additions and 54 deletions

View File

@ -1,57 +1,12 @@
package com.cnaude.chairs.commands;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import com.cnaude.chairs.core.Chairs;
public class ChairsIgnoreList {
@SuppressWarnings("serial")
public class ChairsIgnoreList implements Serializable {
private static HashSet<String> ignoreList = new HashSet<String>();
private static ArrayList<String> ignoreList = new ArrayList<String>();
private static final String IGNORE_FILE = "plugins"+File.separator+"Chairs"+File.separator+"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()) {
plugin.logInfo("Ignore file '"+file.getAbsolutePath()+"' does not exist.");
return;
}
try {
FileInputStream f_in = new FileInputStream(file);
ObjectInputStream obj_in = new ObjectInputStream (f_in);
ignoreList = (ArrayList<String>) obj_in.readObject();
obj_in.close();
plugin.logInfo("Loaded ignore list. (Count = "+ignoreList.size()+")");
}
catch(Exception e) {
plugin.logError(e.getMessage());
}
}
public void save() {
try {
File file = new File(IGNORE_FILE);
FileOutputStream f_out = new FileOutputStream (file);
ObjectOutputStream obj_out = new ObjectOutputStream (f_out);
obj_out.writeObject (ignoreList);
obj_out.close();
plugin.logInfo("Saved ignore list. (Count = "+ignoreList.size()+")");
}
catch(Exception e) {
plugin.logError(e.getMessage());
}
public ChairsIgnoreList() {
}
public void addPlayer(String s) {

View File

@ -66,8 +66,7 @@ public class Chairs extends JavaPlugin {
return;
}
chairEffects = new ChairEffects(this);
ignoreList = new ChairsIgnoreList(this);
ignoreList.load();
ignoreList = new ChairsIgnoreList();
psitdata = new PlayerSitData(this);
getConfig().options().copyDefaults(true);
saveConfig();
@ -95,9 +94,6 @@ public class Chairs extends JavaPlugin {
}
}
}
if (ignoreList != null) {
ignoreList.save();
}
if (chairEffects != null) {
chairEffects.cancelHealing();
chairEffects.cancelPickup();