From 6fe1c855923809d7a9c0cfa4f1be7d2c51f9835e Mon Sep 17 00:00:00 2001 From: T00thpick1 Date: Thu, 4 Jul 2013 17:31:46 -0400 Subject: [PATCH] Save on logout --- .../com/gmail/nossr50/listeners/PlayerListener.java | 2 ++ .../runnables/player/PlayerProfileSaveTask.java | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index f3229fb0c..6fc3f9674 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -262,6 +262,8 @@ public class PlayerListener implements Listener { /* GARBAGE COLLECTION */ BleedTimerTask.bleedOut(player); // Bleed it out + UserManager.getPlayer(player).getProfile().save(); + UserManager.remove(player.getName()); } /** diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java index 8b8933cfc..57872b76b 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java @@ -1,29 +1,19 @@ package com.gmail.nossr50.runnables.player; -import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.PlayerProfile; -import com.gmail.nossr50.util.player.UserManager; public class PlayerProfileSaveTask extends BukkitRunnable { - private McMMOPlayer mcMMOPlayer; private PlayerProfile playerProfile; public PlayerProfileSaveTask(McMMOPlayer mcMMOPlayer) { - this.mcMMOPlayer = mcMMOPlayer; this.playerProfile = mcMMOPlayer.getProfile(); } @Override public void run() { playerProfile.save(); - - Player player = mcMMOPlayer.getPlayer(); - - if (!player.isOnline()) { - UserManager.remove(player.getName()); - } } }