Hopefully fixing #40

This commit is contained in:
samo_lego 2020-11-23 11:12:25 +01:00
parent 1e937b423c
commit fbdb43684f
1 changed files with 7 additions and 2 deletions

View File

@ -83,8 +83,13 @@ public class PlayerCache {
logInfo("Creating cache for " + Objects.requireNonNull(player).getGameProfile().getName()); logInfo("Creating cache for " + Objects.requireNonNull(player).getGameProfile().getName());
String json = DB.getUserData(fakeUuid); String json = DB.getUserData(fakeUuid);
// Parsing data from DB PlayerCache playerCache;
PlayerCache playerCache = gson.fromJson(json, PlayerCache.class); if(!json.isEmpty()) {
// Parsing data from DB
playerCache = gson.fromJson(json, PlayerCache.class);
}
else
playerCache = new PlayerCache();
if(player != null) { if(player != null) {
// Setting position cache // Setting position cache
playerCache.lastLocation.dimension = player.getServerWorld(); playerCache.lastLocation.dimension = player.getServerWorld();