Advertisement
riking

Untitled

Nov 24th, 2014
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1.     /**
  2.      * Monitor PlayerQuitEvents.
  3.      * <p>
  4.      * These events are monitored for the purpose of resetting player
  5.      * variables and other garbage collection tasks that must take place when
  6.      * a player exits the server.
  7.      *
  8.      * @param event The event to monitor
  9.      */
  10.     @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  11.     public void onPlayerQuit(PlayerQuitEvent event) {
  12.         Player player = event.getPlayer();
  13.  
  14.         if (!UserManager.hasPlayerDataKey(player)) {
  15.             return;
  16.         }
  17.  
  18.         McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
  19.  
  20.         mcMMOPlayer.resetAbilityMode();
  21.         BleedTimerTask.bleedOut(player);
  22.         mcMMOPlayer.getProfile().scheduleAsyncSave();
  23.         UserManager.remove(player);
  24.         ScoreboardManager.teardownPlayer(player);
  25.  
  26.         if (mcMMOPlayer.inParty()) {
  27.             mcMMOPlayer.logoutParty();
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement