Merge pull request #761 from Techcable/fix/null-gson

Make P.gson final
This commit is contained in:
Trent Hensler 2017-12-19 00:20:37 -08:00 committed by GitHub
commit 3bce7ae619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View File

@ -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();

View File

@ -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() {

View File

@ -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
// -------------------------------------------- // // -------------------------------------------- //