Fixes quite a lot of warnings
This commit is contained in:
@@ -15,7 +15,7 @@ public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Boa
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static BoardAdapter i = new BoardAdapter();
|
||||
private static final BoardAdapter i = new BoardAdapter();
|
||||
|
||||
public static BoardAdapter get() {
|
||||
return i;
|
||||
@@ -25,7 +25,6 @@ public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Boa
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Board deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
return new Board(context.deserialize(json, Board.MAP_TYPE));
|
||||
|
@@ -7,8 +7,8 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
@@ -20,7 +20,7 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static BoardMapAdapter i = new BoardMapAdapter();
|
||||
private static final BoardMapAdapter i = new BoardMapAdapter();
|
||||
|
||||
public static BoardMapAdapter get() {
|
||||
return i;
|
||||
@@ -37,9 +37,9 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
|
||||
for (Entry<String, JsonElement> entry : jsonObject.entrySet()) {
|
||||
String[] ChunkCoordParts = entry.getKey().split("[,\\s]+");
|
||||
int chunkX = Integer.parseInt(ChunkCoordParts[0]);
|
||||
int chunkZ = Integer.parseInt(ChunkCoordParts[1]);
|
||||
String[] chunkCoordinateParts = entry.getKey().split("[,\\s]+");
|
||||
int chunkX = Integer.parseInt(chunkCoordinateParts[0]);
|
||||
int chunkZ = Integer.parseInt(chunkCoordinateParts[1]);
|
||||
PS chunk = PS.valueOf(chunkX, chunkZ);
|
||||
|
||||
TerritoryAccess territoryAccess = context.deserialize(entry.getValue(), TerritoryAccess.class);
|
||||
|
@@ -10,8 +10,8 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collections;
|
||||
@@ -34,7 +34,7 @@ public class TerritoryAccessAdapter implements JsonDeserializer<TerritoryAccess>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static TerritoryAccessAdapter i = new TerritoryAccessAdapter();
|
||||
private static final TerritoryAccessAdapter i = new TerritoryAccessAdapter();
|
||||
|
||||
public static TerritoryAccessAdapter get() {
|
||||
return i;
|
||||
@@ -68,28 +68,28 @@ public class TerritoryAccessAdapter implements JsonDeserializer<TerritoryAccess>
|
||||
hostFactionId = element.getAsString();
|
||||
|
||||
element = obj.get(HOST_FACTION_ALLOWED);
|
||||
if (element != null) {
|
||||
hostFactionAllowed = element.getAsBoolean();
|
||||
}
|
||||
if (element != null) {
|
||||
hostFactionAllowed = element.getAsBoolean();
|
||||
}
|
||||
|
||||
element = obj.get(GRANTED_IDS);
|
||||
if (element != null) {
|
||||
grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
|
||||
}
|
||||
if (element != null) {
|
||||
grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
|
||||
}
|
||||
|
||||
element = obj.get(CHUNK_NAME);
|
||||
if (element != null) {
|
||||
chunkName = element.getAsString();
|
||||
}
|
||||
if (element != null) {
|
||||
chunkName = element.getAsString();
|
||||
}
|
||||
|
||||
return TerritoryAccess.valueOf(hostFactionId, hostFactionAllowed, grantedIds, chunkName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(TerritoryAccess src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// isDefault <=> simple hostFactionId string
|
||||
if (src.isDefault()) {
|
||||
|
Reference in New Issue
Block a user