mcMMO/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java
2013-03-20 03:11:16 -04:00

27 lines
755 B
Java

package com.gmail.nossr50.runnables.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();
if (!mcMMOPlayer.getPlayer().isOnline()) {
UserManager.remove(playerProfile.getPlayerName());
}
}
}