public void removeSCPlayer(UUID uuid) { if (scPlayers.containsKey(uuid)) scPlayers.remove(uuid); rankManager.setSQLRank(uuid, rankManager.getRank(uuid)); permissionsManager.removeAttachment(uuid); statsManager.unloadStats(uuid); }
public void addSCPlayer(UUID uuid) { if (scPlayers.containsKey(uuid)) return; scPlayers.put(uuid, new SCPlayer(instance, uuid)); rankManager.setRank(uuid, rankManager.getRank(uuid)); permissionsManager.setAttachment(Bukkit.getPlayer(uuid)); statsManager.loadStats(uuid); }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerQuit(final PlayerQuitEvent e) { Player player = e.getPlayer(); SCPlayer scPlayer = getSCPlayer(player.getUniqueId()); e.setQuitMessage(null); if (scPlayer.isCombatTagged()) { player.setHealth(0); scPlayer.removeCombatTag(); broadcast( new FancyMessage(scPlayer.getTag()) .tooltip(scPlayer.getHoverText()) .then(" §5has logged off while in combat!")); } if (rankManager.getRank(player.getUniqueId()).getId() >= Rank.MOD.getId()) staff( new FancyMessage("§9[STAFF] ") .then(scPlayer.getTag()) .tooltip(scPlayer.getHoverText()) .then(" §edisconnected.")); removeSCPlayer(player.getUniqueId()); }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(final PlayerJoinEvent e) { Player player = e.getPlayer(); addSCPlayer(player.getUniqueId()); SCPlayer scPlayer = getSCPlayer(player.getUniqueId()); if (rankManager.getRank(player.getUniqueId()).getId() >= Rank.MOD.getId()) staff( new FancyMessage("§9[STAFF] ") .then(scPlayer.getTag()) .tooltip(scPlayer.getHoverText()) .then(" §econnected.")); e.setJoinMessage(null); }