diff --git a/src/com/massivecraft/factions/adapters/FLocToStringSetTypeAdapter.java b/src/com/massivecraft/factions/adapters/FLocToStringSetTypeAdapter.java deleted file mode 100644 index 58f1225a..00000000 --- a/src/com/massivecraft/factions/adapters/FLocToStringSetTypeAdapter.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.massivecraft.factions.adapters; - -import java.lang.reflect.Type; -import java.util.concurrent.ConcurrentHashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.Map.Entry; - -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.P; - - -// TODO: Is this one even used anymore?? -public class FLocToStringSetTypeAdapter implements JsonDeserializer>>, JsonSerializer>> -{ - - @Override - public Map> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException - { - try { - JsonObject obj = json.getAsJsonObject(); - if (obj == null) - { - return null; - } - - Map> locationMap = new ConcurrentHashMap>(); - Set nameSet; - Iterator iter; - String worldName; - String[] coords; - int x, z; - - for (Entry entry : obj.entrySet()) - { - worldName = entry.getKey(); - for (Entry entry2 : entry.getValue().getAsJsonObject().entrySet()) - { - coords = entry2.getKey().trim().split("[,\\s]+"); - x = Integer.parseInt(coords[0]); - z = Integer.parseInt(coords[1]); - - nameSet = new HashSet(); - iter = entry2.getValue().getAsJsonArray().iterator(); - while (iter.hasNext()) - { - nameSet.add(iter.next().getAsString()); - } - - locationMap.put(new FLocation(worldName, x, z), nameSet); - } - } - - return locationMap; - - } - catch (Exception ex) - { - ex.printStackTrace(); - P.p.log(Level.WARNING, "Error encountered while deserializing a Map of FLocations to String Sets."); - return null; - } - } - - @Override - public JsonElement serialize(Map> src, Type typeOfSrc, JsonSerializationContext context) - { - JsonObject obj = new JsonObject(); - - try { - if (src != null) - { - FLocation loc; - String locWorld; - Set nameSet; - Iterator iter; - JsonArray nameArray; - JsonPrimitive nameElement; - - for (Entry> entry : src.entrySet()) - { - loc = entry.getKey(); - locWorld = loc.getWorldName(); - nameSet = entry.getValue(); - - if (nameSet == null || nameSet.isEmpty()) - { - continue; - } - - nameArray = new JsonArray(); - iter = nameSet.iterator(); - while (iter.hasNext()) - { - nameElement = new JsonPrimitive(iter.next()); - nameArray.add(nameElement); - } - - if ( ! obj.has(locWorld)) - { - obj.add(locWorld, new JsonObject()); - } - - obj.get(locWorld).getAsJsonObject().add(loc.getCoordString(), nameArray); - } - } - return obj; - - } - catch (Exception ex) - { - ex.printStackTrace(); - P.p.log(Level.WARNING, "Error encountered while serializing a Map of FLocations to String Sets."); - return obj; - } - } -} diff --git a/src/com/massivecraft/factions/struct/ChatMode.java b/src/com/massivecraft/factions/struct/ChatMode.java deleted file mode 100644 index 436a1cd2..00000000 --- a/src/com/massivecraft/factions/struct/ChatMode.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.massivecraft.factions.struct; - -public enum ChatMode -{ - FACTION(2, "faction chat"), - ALLIANCE(1, "alliance chat"), - PUBLIC(0, "public chat"); - - public final int value; - public final String nicename; - - private ChatMode(final int value, final String nicename) - { - this.value = value; - this.nicename = nicename; - } - - public boolean isAtLeast(ChatMode role) - { - return this.value >= role.value; - } - - public boolean isAtMost(ChatMode role) - { - return this.value <= role.value; - } - - @Override - public String toString() - { - return this.nicename; - } - - public ChatMode getNext() - { - if (this == PUBLIC) return ALLIANCE; - if (this == ALLIANCE)return FACTION; - return PUBLIC; - } -}