Fixing json nulls

Este commit está contenido en:
samo_lego 2020-07-29 14:47:12 +02:00
padre 8a51f271ad
commit 32de5d188f
Se han modificado 1 ficheros con 4 adiciones y 4 borrados

Ver fichero

@ -76,10 +76,10 @@ public class PlayerCache {
if (lastLoc != null) {
// Getting DB coords
JsonObject lastLocation = gson.fromJson(lastLoc.getAsString(), JsonObject.class);
this.lastDim = lastLocation.get("dim").getAsString();
this.lastX = lastLocation.get("x").getAsDouble();
this.lastY = lastLocation.get("y").getAsDouble();
this.lastZ = lastLocation.get("z").getAsDouble();
this.lastDim = lastLocation.get("dim").isJsonNull() ? config.worldSpawn.dimension : lastLocation.get("dim").getAsString();
this.lastX = lastLocation.get("x").isJsonNull() ? config.worldSpawn.x : lastLocation.get("x").getAsDouble();
this.lastY = lastLocation.get("y").isJsonNull() ? config.worldSpawn.y : lastLocation.get("y").getAsDouble();
this.lastZ = lastLocation.get("z").isJsonNull() ? config.worldSpawn.z : lastLocation.get("z").getAsDouble();
// Removing location data from DB
json.remove("lastLocation");