diff --git a/src/com/massivecraft/mcore/MPlugin.java b/src/com/massivecraft/mcore/MPlugin.java index 015694e4..721616dc 100644 --- a/src/com/massivecraft/mcore/MPlugin.java +++ b/src/com/massivecraft/mcore/MPlugin.java @@ -55,7 +55,7 @@ public abstract class MPlugin extends JavaPlugin implements Listener // Collection shutdowns. for (Coll coll : Coll.instances) { - if (coll.getMplugin() != this) continue; + if (coll.getPlugin() != this) continue; coll.examineThread().interrupt(); coll.syncAll(); // TODO: Save outwards only? We may want to avoid loads at this stage... Coll.instances.remove(coll); diff --git a/src/com/massivecraft/mcore/store/Coll.java b/src/com/massivecraft/mcore/store/Coll.java index 77d833c0..1ee9f9af 100644 --- a/src/com/massivecraft/mcore/store/Coll.java +++ b/src/com/massivecraft/mcore/store/Coll.java @@ -12,12 +12,15 @@ import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.CopyOnWriteArrayList; +import org.bukkit.plugin.Plugin; + import com.massivecraft.mcore.MCore; import com.massivecraft.mcore.MPlugin; import com.massivecraft.mcore.Predictate; import com.massivecraft.mcore.store.accessor.Accessor; import com.massivecraft.mcore.store.idstrategy.IdStrategy; import com.massivecraft.mcore.store.storeadapter.StoreAdapter; +import com.massivecraft.mcore.xlib.gson.Gson; public class Coll> implements CollInterface { @@ -50,8 +53,19 @@ public class Coll> implements CollInterface db; @Override public Db getDb() { return this.db; } @@ -577,7 +591,7 @@ public class Coll> implements CollInterface db, MPlugin mplugin, String idStrategyName, String name, Class entityClass, Class idClass, boolean creative, Comparator idComparator, Comparator entityComparator) + public Coll(Db db, Plugin plugin, String idStrategyName, String name, Class entityClass, Class idClass, boolean creative, Comparator idComparator, Comparator entityComparator) { // Setup the name and the parsed parts this.name = name; @@ -598,7 +612,7 @@ public class Coll> implements CollInterface> implements CollInterface db, MPlugin mplugin, String idStrategyName, String name, Class entityClass, Class idClass, boolean creative) + public Coll(Db db, Plugin plugin, String idStrategyName, String name, Class entityClass, Class idClass, boolean creative) { - this(db, mplugin, idStrategyName, name, entityClass, idClass, creative, null, null); + this(db, plugin, idStrategyName, name, entityClass, idClass, creative, null, null); } - public Coll(MPlugin mplugin, String idStrategyName, String name, Class entityClass, Class idClass, boolean creative) + public Coll(Plugin plugin, String idStrategyName, String name, Class entityClass, Class idClass, boolean creative) { - this(MCore.getDb(), mplugin, idStrategyName, name, entityClass, idClass, creative); + this(MCore.getDb(), plugin, idStrategyName, name, entityClass, idClass, creative); } @Override diff --git a/src/com/massivecraft/mcore/store/CollInterface.java b/src/com/massivecraft/mcore/store/CollInterface.java index 15776b35..0e13c25f 100644 --- a/src/com/massivecraft/mcore/store/CollInterface.java +++ b/src/com/massivecraft/mcore/store/CollInterface.java @@ -4,7 +4,8 @@ import java.util.Collection; import java.util.Comparator; import java.util.Map; -import com.massivecraft.mcore.MPlugin; +import org.bukkit.plugin.Plugin; + import com.massivecraft.mcore.Predictate; import com.massivecraft.mcore.store.idstrategy.IdStrategy; import com.massivecraft.mcore.store.storeadapter.StoreAdapter; @@ -23,7 +24,7 @@ public interface CollInterface> // -------------------------------------------- // // SUPPORTING SYSTEM // -------------------------------------------- // - public MPlugin getMplugin(); + public Plugin getPlugin(); public Db getDb(); public Driver getDriver(); diff --git a/src/com/massivecraft/mcore/store/DriverGson.java b/src/com/massivecraft/mcore/store/DriverGson.java index 4a3ffc57..e9c15425 100644 --- a/src/com/massivecraft/mcore/store/DriverGson.java +++ b/src/com/massivecraft/mcore/store/DriverGson.java @@ -140,7 +140,7 @@ public class DriverGson extends DriverAbstract public > Long save(Coll coll, L id, Object rawData) { File file = fileFromId(coll, id); - String content = coll.getMplugin().gson.toJson((JsonElement)rawData); + String content = coll.getGson().toJson((JsonElement)rawData); if (DiscUtil.writeCatch(file, content) == false) return null; return file.lastModified(); } diff --git a/src/com/massivecraft/mcore/store/Entity.java b/src/com/massivecraft/mcore/store/Entity.java index 2d435612..72380995 100644 --- a/src/com/massivecraft/mcore/store/Entity.java +++ b/src/com/massivecraft/mcore/store/Entity.java @@ -90,7 +90,7 @@ public abstract class Entity, L extends Comparable coll = this.getColl(); - if (coll != null) gson = coll.getMplugin().gson; + if (coll != null) gson = coll.getGson(); return this.getClass().getSimpleName()+gson.toJson(this, this.getClass()); } diff --git a/src/com/massivecraft/mcore/store/SenderColl.java b/src/com/massivecraft/mcore/store/SenderColl.java index ad5e5cd4..92c57ec2 100644 --- a/src/com/massivecraft/mcore/store/SenderColl.java +++ b/src/com/massivecraft/mcore/store/SenderColl.java @@ -6,8 +6,8 @@ import java.util.Comparator; import java.util.List; import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; -import com.massivecraft.mcore.MPlugin; import com.massivecraft.mcore.Predictate; import com.massivecraft.mcore.mixin.Mixin; import com.massivecraft.mcore.util.MUtil; @@ -39,25 +39,25 @@ public class SenderColl> extends Coll imple // CONSTRUCT // -------------------------------------------- // - public SenderColl(Db db, MPlugin mplugin, String name, Class entityClass, boolean creative, boolean lowercasing, Comparator idComparator, Comparator entityComparator) + public SenderColl(Db db, Plugin plugin, String name, Class entityClass, boolean creative, boolean lowercasing, Comparator idComparator, Comparator entityComparator) { - super(db, mplugin, "ai", name, entityClass, String.class, creative, idComparator, entityComparator); + super(db, plugin, "ai", name, entityClass, String.class, creative, idComparator, entityComparator); this.lowercasing = lowercasing; } - public SenderColl(Db db, MPlugin mplugin, String name, Class entityClass, boolean creative, boolean lowercasing) + public SenderColl(Db db, Plugin plugin, String name, Class entityClass, boolean creative, boolean lowercasing) { - this(db, mplugin, name, entityClass, creative, lowercasing, null, null); + this(db, plugin, name, entityClass, creative, lowercasing, null, null); } - public SenderColl(Db db, MPlugin mplugin, String name, Class entityClass, boolean creative) + public SenderColl(Db db, Plugin plugin, String name, Class entityClass, boolean creative) { - this(db, mplugin, name, entityClass, creative, DEFAULT_LOWERCASING); + this(db, plugin, name, entityClass, creative, DEFAULT_LOWERCASING); } - public SenderColl(Db db, MPlugin mplugin, String name, Class entityClass) + public SenderColl(Db db, Plugin plugin, String name, Class entityClass) { - this(db, mplugin, name, entityClass, DEFAULT_CREATIVE); + this(db, plugin, name, entityClass, DEFAULT_CREATIVE); } // -------------------------------------------- // diff --git a/src/com/massivecraft/mcore/store/storeadapter/StoreAdapterGson.java b/src/com/massivecraft/mcore/store/storeadapter/StoreAdapterGson.java index b79f8da1..3856f645 100644 --- a/src/com/massivecraft/mcore/store/storeadapter/StoreAdapterGson.java +++ b/src/com/massivecraft/mcore/store/storeadapter/StoreAdapterGson.java @@ -13,7 +13,7 @@ public class StoreAdapterGson extends StoreAdapterAbstract @Override public Object read(Coll coll, Object entity) { - return coll.getMplugin().gson.toJsonTree(entity, coll.getEntityClass()); + return coll.getGson().toJsonTree(entity, coll.getEntityClass()); } @Override @@ -21,7 +21,7 @@ public class StoreAdapterGson extends StoreAdapterAbstract { if (raw == null) throw new NullPointerException("raw"); if (entity == null) throw new NullPointerException("entity"); - Object temp = coll.getMplugin().gson.fromJson((JsonElement)raw, coll.getEntityClass()); + Object temp = coll.getGson().fromJson((JsonElement)raw, coll.getEntityClass()); coll.copy(temp, entity); }