diff --git a/pom.xml b/pom.xml index de4aa4b0a..c7bb70308 100755 --- a/pom.xml +++ b/pom.xml @@ -136,7 +136,7 @@ org.bukkit bukkit - 1.7.10-R0.1-SNAPSHOT + 1.7.9-R0.2 jar provided diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index a818d7665..4f8bcf019 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -5,6 +5,9 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import com.gmail.nossr50.runnables.skills.BleedTimerTask; +import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; @@ -585,10 +588,6 @@ public class McMMOPlayer { party.addOnlineMember(this.getPlayer()); } - public void logoutParty() { - party.removeOnlineMember(this.getPlayer()); - } - public int getItemShareModifier() { if (itemShareModifier < 10) { setItemShareModifier(10); @@ -879,4 +878,28 @@ public class McMMOPlayer { public FixedMetadataValue getPlayerMetadata() { return playerMetadata; } + + /** + * This method is called by PlayerQuitEvent to tear down the mcMMOPlayer. + * + * @param syncSave if true, data is saved synchronously + */ + public void logout(boolean syncSave) { + Player thisPlayer = getPlayer(); + resetAbilityMode(); + BleedTimerTask.bleedOut(thisPlayer); + + if (syncSave) { + getProfile().save(); + } else { + getProfile().scheduleAsyncSave(); + } + + UserManager.remove(thisPlayer); + ScoreboardManager.teardownPlayer(thisPlayer); + + if (inParty()) { + party.removeOnlineMember(thisPlayer); + } + } } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 3e6893834..6f546cb63 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -42,7 +42,6 @@ import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask; -import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.skills.fishing.FishingManager; import com.gmail.nossr50.skills.herbalism.HerbalismManager; import com.gmail.nossr50.skills.mining.MiningManager; @@ -62,7 +61,6 @@ import com.gmail.nossr50.util.MobHealthbarUtils; import com.gmail.nossr50.util.Motd; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.player.UserManager; -import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.skills.SkillUtils; public class PlayerListener implements Listener { @@ -361,16 +359,7 @@ public class PlayerListener implements Listener { } McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - - mcMMOPlayer.resetAbilityMode(); - BleedTimerTask.bleedOut(player); - mcMMOPlayer.getProfile().scheduleAsyncSave(); - UserManager.remove(player); - ScoreboardManager.teardownPlayer(player); - - if (mcMMOPlayer.inParty()) { - mcMMOPlayer.logoutParty(); - } + mcMMOPlayer.logout(false); } /**