Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Monitor PlayerQuitEvents.
- * <p>
- * These events are monitored for the purpose of resetting player
- * variables and other garbage collection tasks that must take place when
- * a player exits the server.
- *
- * @param event The event to monitor
- */
- @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
- public void onPlayerQuit(PlayerQuitEvent event) {
- Player player = event.getPlayer();
- if (!UserManager.hasPlayerDataKey(player)) {
- return;
- }
- McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
- mcMMOPlayer.resetAbilityMode();
- BleedTimerTask.bleedOut(player);
- mcMMOPlayer.getProfile().scheduleAsyncSave();
- UserManager.remove(player);
- ScoreboardManager.teardownPlayer(player);
- if (mcMMOPlayer.inParty()) {
- mcMMOPlayer.logoutParty();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement