mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Move PlayerQuit logic to mcMMOPlayer.logout()
This commit is contained in:
parent
3b441073fd
commit
f4406bd9cf
@ -5,6 +5,9 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -879,4 +882,22 @@ public class McMMOPlayer {
|
||||
public FixedMetadataValue getPlayerMetadata() {
|
||||
return playerMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by PlayerQuitEvent to tear down the mcMMOPlayer.
|
||||
*/
|
||||
public void logout() {
|
||||
Player thisPlayer = getPlayer();
|
||||
resetAbilityMode();
|
||||
BleedTimerTask.bleedOut(thisPlayer);
|
||||
|
||||
getProfile().scheduleAsyncSave();
|
||||
|
||||
UserManager.remove(thisPlayer);
|
||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||
|
||||
if (inParty()) {
|
||||
party.removeOnlineMember(thisPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
@ -62,7 +61,6 @@ import com.gmail.nossr50.util.MobHealthbarUtils;
|
||||
import com.gmail.nossr50.util.Motd;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
@ -361,16 +359,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
mcMMOPlayer.resetAbilityMode();
|
||||
BleedTimerTask.bleedOut(player);
|
||||
mcMMOPlayer.getProfile().scheduleAsyncSave();
|
||||
UserManager.remove(player);
|
||||
ScoreboardManager.teardownPlayer(player);
|
||||
|
||||
if (mcMMOPlayer.inParty()) {
|
||||
mcMMOPlayer.logoutParty();
|
||||
}
|
||||
mcMMOPlayer.logout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user