Make P.gson final
Before it could be null, triggering weird issues.
This commit is contained in:
parent
5721473a16
commit
b118d4d18c
@ -33,7 +33,7 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
public PermUtil perm;
|
public PermUtil perm;
|
||||||
|
|
||||||
// Persist related
|
// Persist related
|
||||||
public Gson gson;
|
public final Gson gson = this.getGsonBuilder().create();
|
||||||
private Integer saveTask = null;
|
private Integer saveTask = null;
|
||||||
private boolean autoSave = true;
|
private boolean autoSave = true;
|
||||||
protected boolean loadSuccessful = false;
|
protected boolean loadSuccessful = false;
|
||||||
@ -80,10 +80,6 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
this.perm = new PermUtil(this);
|
this.perm = new PermUtil(this);
|
||||||
this.persist = new Persist(this);
|
this.persist = new Persist(this);
|
||||||
|
|
||||||
// GSON 2.1 is now embedded in CraftBukkit, used by the auto-updater: https://github.com/Bukkit/CraftBukkit/commit/0ed1d1fdbb1e0bc09a70bc7bfdf40c1de8411665
|
|
||||||
// if ( ! lib.require("gson.jar", "http://search.maven.org/remotecontent?filepath=com/google/code/gson/gson/2.1/gson-2.1.jar")) return false;
|
|
||||||
this.gson = this.getGsonBuilder().create();
|
|
||||||
|
|
||||||
this.txt = new TextUtil();
|
this.txt = new TextUtil();
|
||||||
initTXT();
|
initTXT();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class MemoryFactions extends Factions {
|
public abstract class MemoryFactions extends Factions {
|
||||||
public Map<String, Faction> factions = new ConcurrentHashMap<String, Faction>();
|
public final Map<String, Faction> factions = new ConcurrentHashMap<String, Faction>();
|
||||||
public int nextId = 1;
|
public int nextId = 1;
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
|
@ -22,26 +22,18 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class JSONFactions extends MemoryFactions {
|
public class JSONFactions extends MemoryFactions {
|
||||||
// Info on how to persist
|
// Info on how to persist
|
||||||
private Gson gson;
|
private final Gson gson;
|
||||||
|
|
||||||
public Gson getGson() {
|
public Gson getGson() {
|
||||||
return gson;
|
return gson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGson(Gson gson) {
|
private final File file;
|
||||||
this.gson = gson;
|
|
||||||
}
|
|
||||||
|
|
||||||
private File file;
|
|
||||||
|
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFile(File file) {
|
|
||||||
this.file = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user