mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Save on logout
This commit is contained in:
parent
79346d92d7
commit
6fe1c85592
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user