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.PlayerInventory;
import com.massivecraft.massivecore.adapter.BackstringEnumSetAdapter;
import com.massivecraft.massivecore.adapter.EntryAdapter;
import com.massivecraft.massivecore.adapter.InventoryAdapter;
import com.massivecraft.massivecore.adapter.ItemStackAdapter;
import com.massivecraft.massivecore.adapter.JsonElementAdapter;
import com.massivecraft.massivecore.adapter.MassiveListAdapter;
import com.massivecraft.massivecore.adapter.MassiveMapAdapter;
import com.massivecraft.massivecore.adapter.MassiveSetAdapter;
import com.massivecraft.massivecore.adapter.MassiveTreeMapAdapter;
import com.massivecraft.massivecore.adapter.MassiveTreeSetAdapter;
import com.massivecraft.massivecore.adapter.ModdedEnumTypeAdapter;
import com.massivecraft.massivecore.adapter.MsonAdapter;
import com.massivecraft.massivecore.adapter.MsonEventAdapter;
import com.massivecraft.massivecore.adapter.PlayerInventoryAdapter;
import com.massivecraft.massivecore.adapter.SoundAdapter;
import com.massivecraft.massivecore.adapter.UUIDAdapter;
import com.massivecraft.massivecore.adapter.AdapterBackstringEnumSet;
import com.massivecraft.massivecore.adapter.AdapterEntry;
import com.massivecraft.massivecore.adapter.AdapterInventory;
import com.massivecraft.massivecore.adapter.AdapterItemStack;
import com.massivecraft.massivecore.adapter.AdapterJsonElement;
import com.massivecraft.massivecore.adapter.AdapterMassiveList;
import com.massivecraft.massivecore.adapter.AdapterMassiveMap;
import com.massivecraft.massivecore.adapter.AdapterMassiveSet;
import com.massivecraft.massivecore.adapter.AdapterMassiveTreeMap;
import com.massivecraft.massivecore.adapter.AdapterMassiveTreeSet;
import com.massivecraft.massivecore.adapter.AdapterModdedEnumType;
import com.massivecraft.massivecore.adapter.AdapterMson;
import com.massivecraft.massivecore.adapter.AdapterMsonEvent;
import com.massivecraft.massivecore.adapter.AdapterPlayerInventory;
import com.massivecraft.massivecore.adapter.AdapterSound;
import com.massivecraft.massivecore.adapter.AdapterUUID;
import com.massivecraft.massivecore.collections.BackstringEnumSet;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveListDef;
@ -138,35 +138,35 @@ public class MassiveCore extends MassivePlugin
.setPrettyPrinting()
.disableHtmlEscaping()
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
.registerTypeAdapter(JsonNull.class, JsonElementAdapter.get())
.registerTypeAdapter(JsonPrimitive.class, JsonElementAdapter.get())
.registerTypeAdapter(JsonArray.class, JsonElementAdapter.get())
.registerTypeAdapter(JsonObject.class, JsonElementAdapter.get())
.registerTypeAdapter(Sound.class, SoundAdapter.get())
.registerTypeAdapter(UUID.class, UUIDAdapter.get())
.registerTypeAdapter(ItemStack.class, ItemStackAdapter.get())
.registerTypeAdapter(Inventory.class, InventoryAdapter.get())
.registerTypeAdapter(PlayerInventory.class, PlayerInventoryAdapter.get())
.registerTypeAdapter(JsonNull.class, AdapterJsonElement.get())
.registerTypeAdapter(JsonPrimitive.class, AdapterJsonElement.get())
.registerTypeAdapter(JsonArray.class, AdapterJsonElement.get())
.registerTypeAdapter(JsonObject.class, AdapterJsonElement.get())
.registerTypeAdapter(Sound.class, AdapterSound.get())
.registerTypeAdapter(UUID.class, AdapterUUID.get())
.registerTypeAdapter(ItemStack.class, AdapterItemStack.get())
.registerTypeAdapter(Inventory.class, AdapterInventory.get())
.registerTypeAdapter(PlayerInventory.class, AdapterPlayerInventory.get())
.registerTypeAdapter(PS.class, PSAdapter.get())
.registerTypeAdapter(MassiveList.class, MassiveListAdapter.get())
.registerTypeAdapter(MassiveListDef.class, MassiveListAdapter.get())
.registerTypeAdapter(MassiveMap.class, MassiveMapAdapter.get())
.registerTypeAdapter(MassiveMapDef.class, MassiveMapAdapter.get())
.registerTypeAdapter(MassiveSet.class, MassiveSetAdapter.get())
.registerTypeAdapter(MassiveSetDef.class, MassiveSetAdapter.get())
.registerTypeAdapter(MassiveTreeMap.class, MassiveTreeMapAdapter.get())
.registerTypeAdapter(MassiveTreeMapDef.class, MassiveTreeMapAdapter.get())
.registerTypeAdapter(MassiveTreeSet.class, MassiveTreeSetAdapter.get())
.registerTypeAdapter(MassiveTreeSetDef.class, MassiveTreeSetAdapter.get())
.registerTypeAdapter(MassiveList.class, AdapterMassiveList.get())
.registerTypeAdapter(MassiveListDef.class, AdapterMassiveList.get())
.registerTypeAdapter(MassiveMap.class, AdapterMassiveMap.get())
.registerTypeAdapter(MassiveMapDef.class, AdapterMassiveMap.get())
.registerTypeAdapter(MassiveSet.class, AdapterMassiveSet.get())
.registerTypeAdapter(MassiveSetDef.class, AdapterMassiveSet.get())
.registerTypeAdapter(MassiveTreeMap.class, AdapterMassiveTreeMap.get())
.registerTypeAdapter(MassiveTreeMapDef.class, AdapterMassiveTreeMap.get())
.registerTypeAdapter(MassiveTreeSet.class, AdapterMassiveTreeSet.get())
.registerTypeAdapter(MassiveTreeSetDef.class, AdapterMassiveTreeSet.get())
.registerTypeAdapter(Mson.class, MsonAdapter.get())
.registerTypeAdapter(MsonEvent.class, MsonEventAdapter.get())
.registerTypeAdapter(Mson.class, AdapterMson.get())
.registerTypeAdapter(MsonEvent.class, AdapterMsonEvent.get())
.registerTypeAdapter(BackstringEnumSet.class, BackstringEnumSetAdapter.get())
.registerTypeAdapter(Entry.class, EntryAdapter.get())
.registerTypeAdapter(BackstringEnumSet.class, AdapterBackstringEnumSet.get())
.registerTypeAdapter(Entry.class, AdapterEntry.get())
.registerTypeAdapterFactory(ModdedEnumTypeAdapter.ENUM_FACTORY);
.registerTypeAdapterFactory(AdapterModdedEnumType.ENUM_FACTORY);
}
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.reflect.TypeToken;
public class BackstringEnumSetAdapter implements JsonDeserializer<BackstringEnumSet<?>>, JsonSerializer<BackstringEnumSet<?>>
public class AdapterBackstringEnumSet implements JsonDeserializer<BackstringEnumSet<?>>, JsonSerializer<BackstringEnumSet<?>>
{
// -------------------------------------------- //
// CONSTANTS
@ -25,8 +25,8 @@ public class BackstringEnumSetAdapter implements JsonDeserializer<BackstringEnum
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static BackstringEnumSetAdapter i = new BackstringEnumSetAdapter();
public static BackstringEnumSetAdapter get() { return i; }
private static AdapterBackstringEnumSet i = new AdapterBackstringEnumSet();
public static AdapterBackstringEnumSet get() { return i; }
// -------------------------------------------- //
// 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.JsonSerializer;
public class EntryAdapter implements JsonDeserializer<Entry<?, ?>>, JsonSerializer<Entry<?, ?>>
public class AdapterEntry implements JsonDeserializer<Entry<?, ?>>, JsonSerializer<Entry<?, ?>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static EntryAdapter i = new EntryAdapter();
public static EntryAdapter get() { return i; }
private static AdapterEntry i = new AdapterEntry();
public static AdapterEntry get() { return i; }
// -------------------------------------------- //
// 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.JsonPrimitive;
public class FireworkEffectAdapter
public class AdapterFireworkEffect
{
// -------------------------------------------- //
// 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
* 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
@ -53,8 +53,8 @@ public class InventoryAdapter implements JsonDeserializer<Inventory>, JsonSerial
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static InventoryAdapter i = new InventoryAdapter();
public static InventoryAdapter get() { return i; }
private static AdapterInventory i = new AdapterInventory();
public static AdapterInventory get() { return i; }
// -------------------------------------------- //
// 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
* 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
// -------------------------------------------- //
public static ItemStackAdapter i = new ItemStackAdapter();
public static ItemStackAdapter get() { return i; }
public static AdapterItemStack i = new AdapterItemStack();
public static AdapterItemStack get() { return i; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private ItemStackAdapterInner inner;
public ItemStackAdapterInner getInner() { return this.inner; }
public void setInner(ItemStackAdapterInner inner) { this.inner = inner; }
private AdapterItemStackInner inner;
public AdapterItemStackInner getInner() { return this.inner; }
public void setInner(AdapterItemStackInner inner) { this.inner = inner; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public ItemStackAdapter()
public AdapterItemStack()
{
// 1.9
try
{
this.inner = ItemStackAdapterInner19.get();
this.inner = AdapterItemStackInner19.get();
return;
}
catch (Throwable t)
@ -53,7 +53,7 @@ public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerial
// 1.8
try
{
this.inner = ItemStackAdapterInner18.get();
this.inner = AdapterItemStackInner18.get();
return;
}
catch (Throwable t)
@ -62,7 +62,7 @@ public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerial
}
// 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.JsonObject;
public interface ItemStackAdapterInner
public interface AdapterItemStackInner
{
public Object provoke();

View File

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

View File

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

View File

@ -19,7 +19,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject;
@SuppressWarnings("deprecation")
public class ItemStackAdapterInner19 extends ItemStackAdapterInner18
public class AdapterItemStackInner19 extends AdapterItemStackInner18
{
// -------------------------------------------- //
// CONSTANTS: POTION
@ -32,8 +32,8 @@ public class ItemStackAdapterInner19 extends ItemStackAdapterInner18
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
public static ItemStackAdapterInner19 i = new ItemStackAdapterInner19();
public static ItemStackAdapterInner19 get() { return i; }
public static AdapterItemStackInner19 i = new AdapterItemStackInner19();
public static AdapterItemStackInner19 get() { return i; }
// -------------------------------------------- //
// 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.JsonSerializer;
public class JsonElementAdapter implements JsonDeserializer<JsonElement>, JsonSerializer<JsonElement>
public class AdapterJsonElement implements JsonDeserializer<JsonElement>, JsonSerializer<JsonElement>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static JsonElementAdapter i = new JsonElementAdapter();
public static JsonElementAdapter get() { return i; }
private static AdapterJsonElement i = new AdapterJsonElement();
public static AdapterJsonElement get() { return i; }
// -------------------------------------------- //
// 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.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
@ -24,12 +24,12 @@ public class LowercaseEnumAdapter<T extends Enum<T>> implements JsonDeserializer
// 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.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.JsonElement;
public class MassiveListAdapter extends MassiveXAdapter<MassiveList<?>>
public class AdapterMassiveList extends AdapterMassiveX<MassiveList<?>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveListAdapter i = new MassiveListAdapter();
public static MassiveListAdapter get() { return i; }
private static AdapterMassiveList i = new AdapterMassiveList();
public static AdapterMassiveList get() { return i; }
// -------------------------------------------- //
// 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.JsonElement;
public class MassiveMapAdapter extends MassiveXAdapter<MassiveMap<?, ?>>
public class AdapterMassiveMap extends AdapterMassiveX<MassiveMap<?, ?>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveMapAdapter i = new MassiveMapAdapter();
public static MassiveMapAdapter get() { return i; }
private static AdapterMassiveMap i = new AdapterMassiveMap();
public static AdapterMassiveMap get() { return i; }
// -------------------------------------------- //
// 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.JsonElement;
public class MassiveSetAdapter extends MassiveXAdapter<MassiveSet<?>>
public class AdapterMassiveSet extends AdapterMassiveX<MassiveSet<?>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveSetAdapter i = new MassiveSetAdapter();
public static MassiveSetAdapter get() { return i; }
private static AdapterMassiveSet i = new AdapterMassiveSet();
public static AdapterMassiveSet get() { return i; }
// -------------------------------------------- //
// 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.JsonElement;
public class MassiveTreeMapAdapter extends MassiveXAdapter<MassiveTreeMap<?, ?, ?>>
public class AdapterMassiveTreeMap extends AdapterMassiveX<MassiveTreeMap<?, ?, ?>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveTreeMapAdapter i = new MassiveTreeMapAdapter();
public static MassiveTreeMapAdapter get() { return i; }
private static AdapterMassiveTreeMap i = new AdapterMassiveTreeMap();
public static AdapterMassiveTreeMap get() { return i; }
// -------------------------------------------- //
// 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.JsonElement;
public class MassiveTreeSetAdapter extends MassiveXAdapter<MassiveTreeSet<?, ?>>
public class AdapterMassiveTreeSet extends AdapterMassiveX<MassiveTreeSet<?, ?>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveTreeSetAdapter i = new MassiveTreeSetAdapter();
public static MassiveTreeSetAdapter get() { return i; }
private static AdapterMassiveTreeSet i = new AdapterMassiveTreeSet();
public static AdapterMassiveTreeSet get() { return i; }
// -------------------------------------------- //
// 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 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

View File

@ -40,11 +40,11 @@ import java.util.Map;
*
* @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<T, String> constantToName = new HashMap<T, String>();
public ModdedEnumTypeAdapter(Class<T> classOfT) {
public AdapterModdedEnumType(Class<T> classOfT) {
for (T constant : classOfT.getEnumConstants()) {
String name = constant.name();
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()) {
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.JsonSerializer;
public class MsonAdapter implements JsonDeserializer<Mson>, JsonSerializer<Mson>
public class AdapterMson implements JsonDeserializer<Mson>, JsonSerializer<Mson>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
public static MsonAdapter i = new MsonAdapter();
public static MsonAdapter get() { return i; }
public MsonAdapter() {}
public static AdapterMson i = new AdapterMson();
public static AdapterMson get() { return i; }
public AdapterMson() {}
// -------------------------------------------- //
// 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.JsonSerializer;
public class MsonEventAdapter implements JsonDeserializer<MsonEvent>, JsonSerializer<MsonEvent>
public class AdapterMsonEvent implements JsonDeserializer<MsonEvent>, JsonSerializer<MsonEvent>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
public static MsonEventAdapter i = new MsonEventAdapter();
public static MsonEventAdapter get() { return i; }
public MsonEventAdapter() {}
public static AdapterMsonEvent i = new AdapterMsonEvent();
public static AdapterMsonEvent get() { return i; }
public AdapterMsonEvent() {}
// -------------------------------------------- //
// 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.JsonSerializer;
public class PlayerInventoryAdapter implements JsonDeserializer<PlayerInventory>, JsonSerializer<PlayerInventory>
public class AdapterPlayerInventory implements JsonDeserializer<PlayerInventory>, JsonSerializer<PlayerInventory>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static PlayerInventoryAdapter i = new PlayerInventoryAdapter();
public static PlayerInventoryAdapter get() { return i; }
private static AdapterPlayerInventory i = new AdapterPlayerInventory();
public static AdapterPlayerInventory get() { return i; }
// -------------------------------------------- //
// OVERRIDE
@ -27,13 +27,13 @@ public class PlayerInventoryAdapter implements JsonDeserializer<PlayerInventory>
@Override
public JsonElement serialize(PlayerInventory src, Type typeOfSrc, JsonSerializationContext context)
{
return InventoryAdapter.toJson(src);
return AdapterInventory.toJson(src);
}
@Override
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.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 VALUE = "value";

View File

@ -7,7 +7,7 @@ import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonObject;
@SuppressWarnings("deprecation")
public class PotionEffectAdapter
public class AdapterPotionEffect
{
// -------------------------------------------- //
// 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.JsonSerializer;
public class SoundAdapter implements JsonDeserializer<Sound>, JsonSerializer<Sound>
public class AdapterSound implements JsonDeserializer<Sound>, JsonSerializer<Sound>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
public static SoundAdapter i = new SoundAdapter();
public static SoundAdapter get() { return i; }
public SoundAdapter() {}
public static AdapterSound i = new AdapterSound();
public static AdapterSound get() { return i; }
public AdapterSound() {}
// -------------------------------------------- //
// 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.JsonSerializer;
public class UUIDAdapter implements JsonDeserializer<UUID>, JsonSerializer<UUID>
public class AdapterUUID implements JsonDeserializer<UUID>, JsonSerializer<UUID>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static UUIDAdapter i = new UUIDAdapter();
public static UUIDAdapter get() { return i; }
private static AdapterUUID i = new AdapterUUID();
public static AdapterUUID get() { return i; }
// -------------------------------------------- //
// OVERRIDE

View File

@ -16,7 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
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.command.MassiveCommand;
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 LowercaseEnumAdapter<ChatColor> ADAPTER_LOWERCASE_CHAT_COLOR = LowercaseEnumAdapter.get(ChatColor.class);
public static final LowercaseEnumAdapter<MsonEventAction> ADAPTER_LOWERCASE_MSON_EVENT_ACTION = LowercaseEnumAdapter.get(MsonEventAction.class);
public static final AdapterLowercaseEnum<ChatColor> ADAPTER_LOWERCASE_CHAT_COLOR = AdapterLowercaseEnum.get(ChatColor.class);
public static final AdapterLowercaseEnum<MsonEventAction> ADAPTER_LOWERCASE_MSON_EVENT_ACTION = AdapterLowercaseEnum.get(MsonEventAction.class);
// -------------------------------------------- //
// CONSTANTS: REUSABLE MSONS