From 0638f4c437e1a56a0261907c369aee65747708da Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 5 Jun 2019 23:50:39 -0700 Subject: [PATCH] 2.1.69 --- pom.xml | 2 +- .../com/gmail/nossr50/datatypes/player/PlayerProfile.java | 4 ++-- src/main/java/com/gmail/nossr50/listeners/PlayerListener.java | 4 +++- src/main/java/com/gmail/nossr50/mcMMO.java | 2 +- src/main/java/com/gmail/nossr50/util/player/UserManager.java | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 6e46fabb5..313aa80ed 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.69-SNAPSHOT + 2.1.69 mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java index ba3567363..a9582c095 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -144,9 +144,9 @@ public class PlayerProfile { " Check your console for errors and inspect your DB for issues."); } + } else { + saveAttempts = 0; } - - saveAttempts = 0; } public String getPlayerName() { diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index ff9c6cd46..6b29f41e8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -502,7 +502,9 @@ public class PlayerListener implements Listener { } McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - mcMMOPlayer.logout(false); + //There's an issue with using Async saves on player quit + //Basically there are conditions in which an async task does not execute fast enough to save the data if the server shutdown shortly after this task was scheduled + mcMMOPlayer.logout(true); } /** diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 6aa845ae7..3e20e8f15 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -332,7 +332,7 @@ public class mcMMO extends JavaPlugin { placeStore.saveAll(); // Save our metadata placeStore.cleanUp(); // Cleanup empty metadata stores } - catch (NullPointerException e) { e.printStackTrace(); } + catch (Exception e) { e.printStackTrace(); } debug("Canceling all tasks..."); getServer().getScheduler().cancelTasks(this); // This removes our tasks diff --git a/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/src/main/java/com/gmail/nossr50/util/player/UserManager.java index d20f39356..c635300c5 100644 --- a/src/main/java/com/gmail/nossr50/util/player/UserManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/UserManager.java @@ -33,7 +33,8 @@ public final class UserManager { } public static void cleanupPlayer(McMMOPlayer mcMMOPlayer) { - playerDataSet.remove(mcMMOPlayer); + if(playerDataSet != null && playerDataSet.contains(mcMMOPlayer)) + playerDataSet.remove(mcMMOPlayer); } /**