mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16: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 */
|
/* GARBAGE COLLECTION */
|
||||||
BleedTimerTask.bleedOut(player); // Bleed it out
|
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;
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user