Save on logout

This commit is contained in:
T00thpick1 2013-07-04 17:31:46 -04:00 committed by GJ
parent 79346d92d7
commit 6fe1c85592
2 changed files with 2 additions and 10 deletions

View File

@ -262,6 +262,8 @@ public class PlayerListener implements Listener {
/* GARBAGE COLLECTION */ /* GARBAGE COLLECTION */
BleedTimerTask.bleedOut(player); // Bleed it out BleedTimerTask.bleedOut(player); // Bleed it out
UserManager.getPlayer(player).getProfile().save();
UserManager.remove(player.getName());
} }
/** /**

View File

@ -1,29 +1,19 @@
package com.gmail.nossr50.runnables.player; package com.gmail.nossr50.runnables.player;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.util.player.UserManager;
public class PlayerProfileSaveTask extends BukkitRunnable { public class PlayerProfileSaveTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private PlayerProfile playerProfile; private PlayerProfile playerProfile;
public PlayerProfileSaveTask(McMMOPlayer mcMMOPlayer) { public PlayerProfileSaveTask(McMMOPlayer mcMMOPlayer) {
this.mcMMOPlayer = mcMMOPlayer;
this.playerProfile = mcMMOPlayer.getProfile(); this.playerProfile = mcMMOPlayer.getProfile();
} }
@Override @Override
public void run() { public void run() {
playerProfile.save(); playerProfile.save();
Player player = mcMMOPlayer.getPlayer();
if (!player.isOnline()) {
UserManager.remove(player.getName());
}
} }
} }