Ejemplo n.º 1
0
  public void removeSCPlayer(UUID uuid) {

    if (scPlayers.containsKey(uuid)) scPlayers.remove(uuid);

    rankManager.setSQLRank(uuid, rankManager.getRank(uuid));
    permissionsManager.removeAttachment(uuid);
    statsManager.unloadStats(uuid);
  }
Ejemplo n.º 2
0
  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);
  }
Ejemplo n.º 3
0
  @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());
  }
Ejemplo n.º 4
0
  @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);
  }