Reverse Adapter Naming

This commit is contained in:
Olof Larsson 2016-04-24 09:27:34 +02:00
parent cfff653649
commit cfa0c23b3d
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474
27 changed files with 128 additions and 128 deletions

View File

@ -12,22 +12,22 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import com.massivecraft.massivecore.adapter.BackstringEnumSetAdapter; import com.massivecraft.massivecore.adapter.AdapterBackstringEnumSet;
import com.massivecraft.massivecore.adapter.EntryAdapter; import com.massivecraft.massivecore.adapter.AdapterEntry;
import com.massivecraft.massivecore.adapter.InventoryAdapter; import com.massivecraft.massivecore.adapter.AdapterInventory;
import com.massivecraft.massivecore.adapter.ItemStackAdapter; import com.massivecraft.massivecore.adapter.AdapterItemStack;
import com.massivecraft.massivecore.adapter.JsonElementAdapter; import com.massivecraft.massivecore.adapter.AdapterJsonElement;
import com.massivecraft.massivecore.adapter.MassiveListAdapter; import com.massivecraft.massivecore.adapter.AdapterMassiveList;
import com.massivecraft.massivecore.adapter.MassiveMapAdapter; import com.massivecraft.massivecore.adapter.AdapterMassiveMap;
import com.massivecraft.massivecore.adapter.MassiveSetAdapter; import com.massivecraft.massivecore.adapter.AdapterMassiveSet;
import com.massivecraft.massivecore.adapter.MassiveTreeMapAdapter; import com.massivecraft.massivecore.adapter.AdapterMassiveTreeMap;
import com.massivecraft.massivecore.adapter.MassiveTreeSetAdapter; import com.massivecraft.massivecore.adapter.AdapterMassiveTreeSet;
import com.massivecraft.massivecore.adapter.ModdedEnumTypeAdapter; import com.massivecraft.massivecore.adapter.AdapterModdedEnumType;
import com.massivecraft.massivecore.adapter.MsonAdapter; import com.massivecraft.massivecore.adapter.AdapterMson;
import com.massivecraft.massivecore.adapter.MsonEventAdapter; import com.massivecraft.massivecore.adapter.AdapterMsonEvent;
import com.massivecraft.massivecore.adapter.PlayerInventoryAdapter; import com.massivecraft.massivecore.adapter.AdapterPlayerInventory;
import com.massivecraft.massivecore.adapter.SoundAdapter; import com.massivecraft.massivecore.adapter.AdapterSound;
import com.massivecraft.massivecore.adapter.UUIDAdapter; import com.massivecraft.massivecore.adapter.AdapterUUID;
import com.massivecraft.massivecore.collections.BackstringEnumSet; import com.massivecraft.massivecore.collections.BackstringEnumSet;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveListDef; import com.massivecraft.massivecore.collections.MassiveListDef;
@ -138,35 +138,35 @@ public class MassiveCore extends MassivePlugin
.setPrettyPrinting() .setPrettyPrinting()
.disableHtmlEscaping() .disableHtmlEscaping()
.excludeFieldsWithModifiers(Modifier.TRANSIENT) .excludeFieldsWithModifiers(Modifier.TRANSIENT)
.registerTypeAdapter(JsonNull.class, JsonElementAdapter.get()) .registerTypeAdapter(JsonNull.class, AdapterJsonElement.get())
.registerTypeAdapter(JsonPrimitive.class, JsonElementAdapter.get()) .registerTypeAdapter(JsonPrimitive.class, AdapterJsonElement.get())
.registerTypeAdapter(JsonArray.class, JsonElementAdapter.get()) .registerTypeAdapter(JsonArray.class, AdapterJsonElement.get())
.registerTypeAdapter(JsonObject.class, JsonElementAdapter.get()) .registerTypeAdapter(JsonObject.class, AdapterJsonElement.get())
.registerTypeAdapter(Sound.class, SoundAdapter.get()) .registerTypeAdapter(Sound.class, AdapterSound.get())
.registerTypeAdapter(UUID.class, UUIDAdapter.get()) .registerTypeAdapter(UUID.class, AdapterUUID.get())
.registerTypeAdapter(ItemStack.class, ItemStackAdapter.get()) .registerTypeAdapter(ItemStack.class, AdapterItemStack.get())
.registerTypeAdapter(Inventory.class, InventoryAdapter.get()) .registerTypeAdapter(Inventory.class, AdapterInventory.get())
.registerTypeAdapter(PlayerInventory.class, PlayerInventoryAdapter.get()) .registerTypeAdapter(PlayerInventory.class, AdapterPlayerInventory.get())
.registerTypeAdapter(PS.class, PSAdapter.get()) .registerTypeAdapter(PS.class, PSAdapter.get())
.registerTypeAdapter(MassiveList.class, MassiveListAdapter.get()) .registerTypeAdapter(MassiveList.class, AdapterMassiveList.get())
.registerTypeAdapter(MassiveListDef.class, MassiveListAdapter.get()) .registerTypeAdapter(MassiveListDef.class, AdapterMassiveList.get())
.registerTypeAdapter(MassiveMap.class, MassiveMapAdapter.get()) .registerTypeAdapter(MassiveMap.class, AdapterMassiveMap.get())
.registerTypeAdapter(MassiveMapDef.class, MassiveMapAdapter.get()) .registerTypeAdapter(MassiveMapDef.class, AdapterMassiveMap.get())
.registerTypeAdapter(MassiveSet.class, MassiveSetAdapter.get()) .registerTypeAdapter(MassiveSet.class, AdapterMassiveSet.get())
.registerTypeAdapter(MassiveSetDef.class, MassiveSetAdapter.get()) .registerTypeAdapter(MassiveSetDef.class, AdapterMassiveSet.get())
.registerTypeAdapter(MassiveTreeMap.class, MassiveTreeMapAdapter.get()) .registerTypeAdapter(MassiveTreeMap.class, AdapterMassiveTreeMap.get())
.registerTypeAdapter(MassiveTreeMapDef.class, MassiveTreeMapAdapter.get()) .registerTypeAdapter(MassiveTreeMapDef.class, AdapterMassiveTreeMap.get())
.registerTypeAdapter(MassiveTreeSet.class, MassiveTreeSetAdapter.get()) .registerTypeAdapter(MassiveTreeSet.class, AdapterMassiveTreeSet.get())
.registerTypeAdapter(MassiveTreeSetDef.class, MassiveTreeSetAdapter.get()) .registerTypeAdapter(MassiveTreeSetDef.class, AdapterMassiveTreeSet.get())
.registerTypeAdapter(Mson.class, MsonAdapter.get()) .registerTypeAdapter(Mson.class, AdapterMson.get())
.registerTypeAdapter(MsonEvent.class, MsonEventAdapter.get()) .registerTypeAdapter(MsonEvent.class, AdapterMsonEvent.get())
.registerTypeAdapter(BackstringEnumSet.class, BackstringEnumSetAdapter.get()) .registerTypeAdapter(BackstringEnumSet.class, AdapterBackstringEnumSet.get())
.registerTypeAdapter(Entry.class, EntryAdapter.get()) .registerTypeAdapter(Entry.class, AdapterEntry.get())
.registerTypeAdapterFactory(ModdedEnumTypeAdapter.ENUM_FACTORY); .registerTypeAdapterFactory(AdapterModdedEnumType.ENUM_FACTORY);
} }
public static String getServerId() { return ConfServer.serverid; } public static String getServerId() { return ConfServer.serverid; }

View File

@ -13,7 +13,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken; import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken;
public class BackstringEnumSetAdapter implements JsonDeserializer<BackstringEnumSet<?>>, JsonSerializer<BackstringEnumSet<?>> public class AdapterBackstringEnumSet implements JsonDeserializer<BackstringEnumSet<?>>, JsonSerializer<BackstringEnumSet<?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -25,8 +25,8 @@ public class BackstringEnumSetAdapter implements JsonDeserializer<BackstringEnum
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static BackstringEnumSetAdapter i = new BackstringEnumSetAdapter(); private static AdapterBackstringEnumSet i = new AdapterBackstringEnumSet();
public static BackstringEnumSetAdapter get() { return i; } public static AdapterBackstringEnumSet get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -14,14 +14,14 @@ import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class EntryAdapter implements JsonDeserializer<Entry<?, ?>>, JsonSerializer<Entry<?, ?>> public class AdapterEntry implements JsonDeserializer<Entry<?, ?>>, JsonSerializer<Entry<?, ?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static EntryAdapter i = new EntryAdapter(); private static AdapterEntry i = new AdapterEntry();
public static EntryAdapter get() { return i; } public static AdapterEntry get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -16,7 +16,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject; import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive; import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
public class FireworkEffectAdapter public class AdapterFireworkEffect
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELD CONSTANTS // FIELD CONSTANTS

View File

@ -23,7 +23,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
* It handles all inventories as CraftInventoryCustom "Chest"s with size of your choice * It handles all inventories as CraftInventoryCustom "Chest"s with size of your choice
* except for PlayerInventory which it handles pretty darn well! * except for PlayerInventory which it handles pretty darn well!
*/ */
public class InventoryAdapter implements JsonDeserializer<Inventory>, JsonSerializer<Inventory> public class AdapterInventory implements JsonDeserializer<Inventory>, JsonSerializer<Inventory>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -53,8 +53,8 @@ public class InventoryAdapter implements JsonDeserializer<Inventory>, JsonSerial
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static InventoryAdapter i = new InventoryAdapter(); private static AdapterInventory i = new AdapterInventory();
public static InventoryAdapter get() { return i; } public static AdapterInventory get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -16,33 +16,33 @@ import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
* way. This serializer requires manual updating to work but produces clean * way. This serializer requires manual updating to work but produces clean
* json. See the file itemstackformat.txt for more info. * json. See the file itemstackformat.txt for more info.
*/ */
public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerializer<ItemStack> public class AdapterItemStack implements JsonDeserializer<ItemStack>, JsonSerializer<ItemStack>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE // INSTANCE
// -------------------------------------------- // // -------------------------------------------- //
public static ItemStackAdapter i = new ItemStackAdapter(); public static AdapterItemStack i = new AdapterItemStack();
public static ItemStackAdapter get() { return i; } public static AdapterItemStack get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
private ItemStackAdapterInner inner; private AdapterItemStackInner inner;
public ItemStackAdapterInner getInner() { return this.inner; } public AdapterItemStackInner getInner() { return this.inner; }
public void setInner(ItemStackAdapterInner inner) { this.inner = inner; } public void setInner(AdapterItemStackInner inner) { this.inner = inner; }
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public ItemStackAdapter() public AdapterItemStack()
{ {
// 1.9 // 1.9
try try
{ {
this.inner = ItemStackAdapterInner19.get(); this.inner = AdapterItemStackInner19.get();
return; return;
} }
catch (Throwable t) catch (Throwable t)
@ -53,7 +53,7 @@ public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerial
// 1.8 // 1.8
try try
{ {
this.inner = ItemStackAdapterInner18.get(); this.inner = AdapterItemStackInner18.get();
return; return;
} }
catch (Throwable t) catch (Throwable t)
@ -62,7 +62,7 @@ public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerial
} }
// 1.7 // 1.7
this.inner = ItemStackAdapterInner17.get(); this.inner = AdapterItemStackInner17.get();
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -5,7 +5,7 @@ import org.bukkit.inventory.ItemStack;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject; import com.massivecraft.massivecore.xlib.gson.JsonObject;
public interface ItemStackAdapterInner public interface AdapterItemStackInner
{ {
public Object provoke(); public Object provoke();

View File

@ -32,7 +32,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive; import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class ItemStackAdapterInner17 implements ItemStackAdapterInner public class AdapterItemStackInner17 implements AdapterItemStackInner
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS: NAMES // CONSTANTS: NAMES
@ -73,9 +73,9 @@ public class ItemStackAdapterInner17 implements ItemStackAdapterInner
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static ItemStackAdapterInner17 i = new ItemStackAdapterInner17(); public static AdapterItemStackInner17 i = new AdapterItemStackInner17();
public static ItemStackAdapterInner17 get() { return i; } public static AdapterItemStackInner17 get() { return i; }
public ItemStackAdapterInner17() public AdapterItemStackInner17()
{ {
this.provoke(); this.provoke();
} }
@ -535,13 +535,13 @@ public class ItemStackAdapterInner17 implements ItemStackAdapterInner
if (meta2json) if (meta2json)
{ {
if (!meta.hasEffect()) return; if (!meta.hasEffect()) return;
json.add(FIREWORK_EFFECT, FireworkEffectAdapter.toJson(meta.getEffect())); json.add(FIREWORK_EFFECT, AdapterFireworkEffect.toJson(meta.getEffect()));
} }
else else
{ {
JsonElement element = json.get(FIREWORK_EFFECT); JsonElement element = json.get(FIREWORK_EFFECT);
if (element == null) return; if (element == null) return;
meta.setEffect(FireworkEffectAdapter.fromJson(element)); meta.setEffect(AdapterFireworkEffect.fromJson(element));
} }
} }
@ -643,7 +643,7 @@ public class ItemStackAdapterInner17 implements ItemStackAdapterInner
JsonArray ret = new JsonArray(); JsonArray ret = new JsonArray();
for (PotionEffect e : potionEffects) for (PotionEffect e : potionEffects)
{ {
ret.add(PotionEffectAdapter.toJson(e)); ret.add(AdapterPotionEffect.toJson(e));
} }
return ret; return ret;
} }
@ -659,7 +659,7 @@ public class ItemStackAdapterInner17 implements ItemStackAdapterInner
Iterator<JsonElement> iter = array.iterator(); Iterator<JsonElement> iter = array.iterator();
while(iter.hasNext()) while(iter.hasNext())
{ {
PotionEffect e = PotionEffectAdapter.fromJson(iter.next()); PotionEffect e = AdapterPotionEffect.fromJson(iter.next());
if (e == null) continue; if (e == null) continue;
ret.add(e); ret.add(e);
} }
@ -673,7 +673,7 @@ public class ItemStackAdapterInner17 implements ItemStackAdapterInner
JsonArray ret = new JsonArray(); JsonArray ret = new JsonArray();
for (FireworkEffect fe : fireworkEffects) for (FireworkEffect fe : fireworkEffects)
{ {
ret.add(FireworkEffectAdapter.toJson(fe)); ret.add(AdapterFireworkEffect.toJson(fe));
} }
return ret; return ret;
} }
@ -689,7 +689,7 @@ public class ItemStackAdapterInner17 implements ItemStackAdapterInner
Iterator<JsonElement> iter = array.iterator(); Iterator<JsonElement> iter = array.iterator();
while(iter.hasNext()) while(iter.hasNext())
{ {
FireworkEffect fe = FireworkEffectAdapter.fromJson(iter.next()); FireworkEffect fe = AdapterFireworkEffect.fromJson(iter.next());
if (fe == null) continue; if (fe == null) continue;
ret.add(fe); ret.add(fe);
} }

View File

@ -26,7 +26,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive; import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class ItemStackAdapterInner18 extends ItemStackAdapterInner17 public class AdapterItemStackInner18 extends AdapterItemStackInner17
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS: NAMES // CONSTANTS: NAMES
@ -43,8 +43,8 @@ public class ItemStackAdapterInner18 extends ItemStackAdapterInner17
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static ItemStackAdapterInner18 i = new ItemStackAdapterInner18(); public static AdapterItemStackInner18 i = new AdapterItemStackInner18();
public static ItemStackAdapterInner18 get() { return i; } public static AdapterItemStackInner18 get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// PROVOKE // PROVOKE

View File

@ -19,7 +19,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject; import com.massivecraft.massivecore.xlib.gson.JsonObject;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class ItemStackAdapterInner19 extends ItemStackAdapterInner18 public class AdapterItemStackInner19 extends AdapterItemStackInner18
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS: POTION // CONSTANTS: POTION
@ -32,8 +32,8 @@ public class ItemStackAdapterInner19 extends ItemStackAdapterInner18
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static ItemStackAdapterInner19 i = new ItemStackAdapterInner19(); public static AdapterItemStackInner19 i = new AdapterItemStackInner19();
public static ItemStackAdapterInner19 get() { return i; } public static AdapterItemStackInner19 get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// PROVOKE // PROVOKE

View File

@ -9,14 +9,14 @@ import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class JsonElementAdapter implements JsonDeserializer<JsonElement>, JsonSerializer<JsonElement> public class AdapterJsonElement implements JsonDeserializer<JsonElement>, JsonSerializer<JsonElement>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static JsonElementAdapter i = new JsonElementAdapter(); private static AdapterJsonElement i = new AdapterJsonElement();
public static JsonElementAdapter get() { return i; } public static AdapterJsonElement get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -11,7 +11,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class LowercaseEnumAdapter<T extends Enum<T>> implements JsonDeserializer<T>, JsonSerializer<T> public class AdapterLowercaseEnum<T extends Enum<T>> implements JsonDeserializer<T>, JsonSerializer<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
@ -24,12 +24,12 @@ public class LowercaseEnumAdapter<T extends Enum<T>> implements JsonDeserializer
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static <T extends Enum<T>> LowercaseEnumAdapter<T> get(Class<T> clazz) public static <T extends Enum<T>> AdapterLowercaseEnum<T> get(Class<T> clazz)
{ {
return new LowercaseEnumAdapter<T>(clazz); return new AdapterLowercaseEnum<T>(clazz);
} }
public LowercaseEnumAdapter(Class<T> clazz) public AdapterLowercaseEnum(Class<T> clazz)
{ {
if (clazz == null) throw new IllegalArgumentException("passed clazz param is null"); if (clazz == null) throw new IllegalArgumentException("passed clazz param is null");
if ( ! clazz.isEnum()) throw new IllegalArgumentException("passed clazz param must be an enum"); if ( ! clazz.isEnum()) throw new IllegalArgumentException("passed clazz param must be an enum");

View File

@ -8,14 +8,14 @@ import com.massivecraft.massivecore.collections.MassiveListDef;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
public class MassiveListAdapter extends MassiveXAdapter<MassiveList<?>> public class AdapterMassiveList extends AdapterMassiveX<MassiveList<?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static MassiveListAdapter i = new MassiveListAdapter(); private static AdapterMassiveList i = new AdapterMassiveList();
public static MassiveListAdapter get() { return i; } public static AdapterMassiveList get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -8,14 +8,14 @@ import com.massivecraft.massivecore.collections.MassiveMapDef;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
public class MassiveMapAdapter extends MassiveXAdapter<MassiveMap<?, ?>> public class AdapterMassiveMap extends AdapterMassiveX<MassiveMap<?, ?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static MassiveMapAdapter i = new MassiveMapAdapter(); private static AdapterMassiveMap i = new AdapterMassiveMap();
public static MassiveMapAdapter get() { return i; } public static AdapterMassiveMap get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -8,14 +8,14 @@ import com.massivecraft.massivecore.collections.MassiveSetDef;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
public class MassiveSetAdapter extends MassiveXAdapter<MassiveSet<?>> public class AdapterMassiveSet extends AdapterMassiveX<MassiveSet<?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static MassiveSetAdapter i = new MassiveSetAdapter(); private static AdapterMassiveSet i = new AdapterMassiveSet();
public static MassiveSetAdapter get() { return i; } public static AdapterMassiveSet get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -8,14 +8,14 @@ import com.massivecraft.massivecore.collections.MassiveTreeMapDef;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
public class MassiveTreeMapAdapter extends MassiveXAdapter<MassiveTreeMap<?, ?, ?>> public class AdapterMassiveTreeMap extends AdapterMassiveX<MassiveTreeMap<?, ?, ?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static MassiveTreeMapAdapter i = new MassiveTreeMapAdapter(); private static AdapterMassiveTreeMap i = new AdapterMassiveTreeMap();
public static MassiveTreeMapAdapter get() { return i; } public static AdapterMassiveTreeMap get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -8,14 +8,14 @@ import com.massivecraft.massivecore.collections.MassiveTreeSetDef;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
public class MassiveTreeSetAdapter extends MassiveXAdapter<MassiveTreeSet<?, ?>> public class AdapterMassiveTreeSet extends AdapterMassiveX<MassiveTreeSet<?, ?>>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static MassiveTreeSetAdapter i = new MassiveTreeSetAdapter(); private static AdapterMassiveTreeSet i = new AdapterMassiveTreeSet();
public static MassiveTreeSetAdapter get() { return i; } public static AdapterMassiveTreeSet get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -21,7 +21,7 @@ import com.massivecraft.massivecore.xlib.gson.internal.$Gson$Types;
* It makes sure Def instances "handle empty as null". * It makes sure Def instances "handle empty as null".
* It makes sure we avoid infinite GSON recurse loops by recursing with supertype. * It makes sure we avoid infinite GSON recurse loops by recursing with supertype.
*/ */
public abstract class MassiveXAdapter<T> implements JsonDeserializer<T>, JsonSerializer<T> public abstract class AdapterMassiveX<T> implements JsonDeserializer<T>, JsonSerializer<T>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -40,11 +40,11 @@ import java.util.Map;
* *
* @author OniBait * @author OniBait
*/ */
public final class ModdedEnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> { public final class AdapterModdedEnumType<T extends Enum<T>> extends TypeAdapter<T> {
private final Map<String, T> nameToConstant = new HashMap<String, T>(); private final Map<String, T> nameToConstant = new HashMap<String, T>();
private final Map<T, String> constantToName = new HashMap<T, String>(); private final Map<T, String> constantToName = new HashMap<T, String>();
public ModdedEnumTypeAdapter(Class<T> classOfT) { public AdapterModdedEnumType(Class<T> classOfT) {
for (T constant : classOfT.getEnumConstants()) { for (T constant : classOfT.getEnumConstants()) {
String name = constant.name(); String name = constant.name();
try { // MassiveCore - Ignore when the field can't be found since modified enums won't have it. try { // MassiveCore - Ignore when the field can't be found since modified enums won't have it.
@ -82,7 +82,7 @@ public final class ModdedEnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<
if (!rawType.isEnum()) { if (!rawType.isEnum()) {
rawType = rawType.getSuperclass(); // handle anonymous subclasses rawType = rawType.getSuperclass(); // handle anonymous subclasses
} }
return (TypeAdapter<T>) new ModdedEnumTypeAdapter(rawType); return (TypeAdapter<T>) new AdapterModdedEnumType(rawType);
} }
}; };
} }

View File

@ -11,15 +11,15 @@ import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class MsonAdapter implements JsonDeserializer<Mson>, JsonSerializer<Mson> public class AdapterMson implements JsonDeserializer<Mson>, JsonSerializer<Mson>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static MsonAdapter i = new MsonAdapter(); public static AdapterMson i = new AdapterMson();
public static MsonAdapter get() { return i; } public static AdapterMson get() { return i; }
public MsonAdapter() {} public AdapterMson() {}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -11,15 +11,15 @@ import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class MsonEventAdapter implements JsonDeserializer<MsonEvent>, JsonSerializer<MsonEvent> public class AdapterMsonEvent implements JsonDeserializer<MsonEvent>, JsonSerializer<MsonEvent>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static MsonEventAdapter i = new MsonEventAdapter(); public static AdapterMsonEvent i = new AdapterMsonEvent();
public static MsonEventAdapter get() { return i; } public static AdapterMsonEvent get() { return i; }
public MsonEventAdapter() {} public AdapterMsonEvent() {}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -11,14 +11,14 @@ import com.massivecraft.massivecore.xlib.gson.JsonParseException;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class PlayerInventoryAdapter implements JsonDeserializer<PlayerInventory>, JsonSerializer<PlayerInventory> public class AdapterPlayerInventory implements JsonDeserializer<PlayerInventory>, JsonSerializer<PlayerInventory>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static PlayerInventoryAdapter i = new PlayerInventoryAdapter(); private static AdapterPlayerInventory i = new AdapterPlayerInventory();
public static PlayerInventoryAdapter get() { return i; } public static AdapterPlayerInventory get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
@ -27,13 +27,13 @@ public class PlayerInventoryAdapter implements JsonDeserializer<PlayerInventory>
@Override @Override
public JsonElement serialize(PlayerInventory src, Type typeOfSrc, JsonSerializationContext context) public JsonElement serialize(PlayerInventory src, Type typeOfSrc, JsonSerializationContext context)
{ {
return InventoryAdapter.toJson(src); return AdapterInventory.toJson(src);
} }
@Override @Override
public PlayerInventory deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException public PlayerInventory deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{ {
return (PlayerInventory) InventoryAdapter.fromJson(json); return (PlayerInventory) AdapterInventory.fromJson(json);
} }
} }

View File

@ -12,7 +12,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class PolymorphicAdapter<T> implements JsonDeserializer<T>, JsonSerializer<T> public class AdapterPolymorphic<T> implements JsonDeserializer<T>, JsonSerializer<T>
{ {
public static final String TYPE = "type"; public static final String TYPE = "type";
public static final String VALUE = "value"; public static final String VALUE = "value";

View File

@ -7,7 +7,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject; import com.massivecraft.massivecore.xlib.gson.JsonObject;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class PotionEffectAdapter public class AdapterPotionEffect
{ {
// -------------------------------------------- // // -------------------------------------------- //
// FIELD CONSTANTS // FIELD CONSTANTS

View File

@ -13,15 +13,15 @@ import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class SoundAdapter implements JsonDeserializer<Sound>, JsonSerializer<Sound> public class AdapterSound implements JsonDeserializer<Sound>, JsonSerializer<Sound>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public static SoundAdapter i = new SoundAdapter(); public static AdapterSound i = new AdapterSound();
public static SoundAdapter get() { return i; } public static AdapterSound get() { return i; }
public SoundAdapter() {} public AdapterSound() {}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -11,14 +11,14 @@ import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext; import com.massivecraft.massivecore.xlib.gson.JsonSerializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonSerializer; import com.massivecraft.massivecore.xlib.gson.JsonSerializer;
public class UUIDAdapter implements JsonDeserializer<UUID>, JsonSerializer<UUID> public class AdapterUUID implements JsonDeserializer<UUID>, JsonSerializer<UUID>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
private static UUIDAdapter i = new UUIDAdapter(); private static AdapterUUID i = new AdapterUUID();
public static UUIDAdapter get() { return i; } public static AdapterUUID get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -16,7 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.massivecraft.massivecore.adapter.LowercaseEnumAdapter; import com.massivecraft.massivecore.adapter.AdapterLowercaseEnum;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
@ -38,8 +38,8 @@ public class Mson implements Serializable
public static final Pattern PARSE_PREFIX = Pattern.compile("\u00A7"); public static final Pattern PARSE_PREFIX = Pattern.compile("\u00A7");
public static final LowercaseEnumAdapter<ChatColor> ADAPTER_LOWERCASE_CHAT_COLOR = LowercaseEnumAdapter.get(ChatColor.class); public static final AdapterLowercaseEnum<ChatColor> ADAPTER_LOWERCASE_CHAT_COLOR = AdapterLowercaseEnum.get(ChatColor.class);
public static final LowercaseEnumAdapter<MsonEventAction> ADAPTER_LOWERCASE_MSON_EVENT_ACTION = LowercaseEnumAdapter.get(MsonEventAction.class); public static final AdapterLowercaseEnum<MsonEventAction> ADAPTER_LOWERCASE_MSON_EVENT_ACTION = AdapterLowercaseEnum.get(MsonEventAction.class);
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS: REUSABLE MSONS // CONSTANTS: REUSABLE MSONS