@Override
  public boolean run(
      final CommandSender sender,
      Player sender_p,
      Command cmd,
      String commandLabel,
      String[] args,
      boolean senderIsConsole) {

    if (!CJFM_Util.SYSADMINS.contains(sender.getName())
        && !sender.getName().equals("tylerhyperHD")
        && !TFM_ConfigEntry.SERVER_OWNERS.getList().contains(sender.getName())) {
      sender.sendMessage(TFM_Command.MSG_NO_PERMS);
      TFM_Util.adminAction(
          "WARNING: " + sender.getName(),
          "Has attempted to use a system admin only command. System administration team has been alerted.",
          true);
      sender.setOp(false);

      return true;
    }

    if (args.length == 0) {
      return false;
    }

    if (args.length == 1) {
      if (args[0].equalsIgnoreCase("1")) {
        TFM_Util.adminAction(
            "WARNING: " + sender.getName(), "Activating a level 1 security lockdown.", true);
        CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(true);
      }

      if (args[0].equalsIgnoreCase("2")) {
        TFM_Util.adminAction(
            "WARNING: " + sender.getName(), "Activating a level 2 security lockdown.", true);
        CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(true);
      }

      if (args[0].equalsIgnoreCase("3")) {
        TFM_Util.adminAction(
            "WARNING: " + sender.getName(), "Activating a level 3 security lockdown.", true);
        CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false);
        CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(true);
      }

      if (args[0].equalsIgnoreCase("4")) {
        TFM_Util.adminAction(
            "WARNING: " + sender.getName(), "Activating a level 4 security lockdown.", true);
        CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false);
        CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(true);
        TFM_Util.adminAction(
            "WARNING: " + sender.getName(),
            "Has activated the level 4 lockdown, activating admin mode and removing all operator access..",
            true);
        for (OfflinePlayer player : server.getOperators()) {
          player.setOp(false);

          if (player.isOnline()) {
            player.getPlayer().sendMessage(TFM_Command.YOU_ARE_NOT_OP);
          }
        }
      }

      if (args[0].equalsIgnoreCase("5")) {
        TFM_Util.adminAction(
            "WARNING: " + sender.getName(), "Activating a level 5 security lockdown.", true);
        CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false);
        CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(true);
        for (Player player : server.getOnlinePlayers()) {
          if (!TFM_AdminList.isSuperAdmin(player)) {
            player.kickPlayer(
                "Server has initiated a level 5 lockdown. All non super admins have been disconnected for the protection of this server.");
          }
        }
        for (OfflinePlayer player : server.getOperators()) {
          player.setOp(false);

          if (player.isOnline()) {
            player.getPlayer().sendMessage(TFM_Command.YOU_ARE_NOT_OP);
          }
        }
      }

      if (args[0].equalsIgnoreCase("off")) {
        TFM_Util.adminAction("WARNING: " + sender.getName(), "Security Lockdown Disabled", true);
        CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(false);
        CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false);
        for (Player p : server.getOnlinePlayers()) {
          if (!p.isOp()) {
            p.setOp(true);
            p.sendMessage(TFM_Command.YOU_ARE_OP);
          }
        }
      }

    } else if (args.length == 2) {
      return false;

    } else {

      return false;
    }

    return true;
  }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerJoin(PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final String ip = TFM_Util.getIp(player);
    final TFM_Player playerEntry;
    TFM_Log.info(
        "[JOIN] " + TFM_Util.formatPlayer(player) + " joined the game with IP address: " + ip,
        true);
    // Check absolute value to account for negatives
    if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD
        || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD) {
      player.teleport(player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn
    }
    // Handle PlayerList entry (persistent)
    if (TFM_PlayerList.existsEntry(player)) {
      playerEntry = TFM_PlayerList.getEntry(player);
      playerEntry.setLastLoginUnix(TFM_Util.getUnixTime());
      playerEntry.setLastLoginName(player.getName());
      playerEntry.addIp(ip);
      playerEntry.save();
    } else {
      playerEntry = TFM_PlayerList.getEntry(player);
      TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player));
    }

    // Generate PlayerData (non-persistent)
    final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
    playerdata.setSuperadminIdVerified(false);

    if (TFM_AdminList.isSuperAdmin(player)) {
      for (String storedIp : playerEntry.getIps()) {
        TFM_BanManager.unbanIp(storedIp);
        TFM_BanManager.unbanIp(TFM_Util.getFuzzyIp(storedIp));
      }

      TFM_BanManager.unbanUuid(TFM_UuidManager.getUniqueId(player));

      player.setOp(true);

      // Verify strict IP match
      if (!TFM_AdminList.isIdentityMatched(player)) {
        playerdata.setSuperadminIdVerified(false);
        TFM_Util.bcastMsg(
            "Warning: "
                + player.getName()
                + " is an admin, but is using an account not registered to one of their ip-list.",
            ChatColor.RED);
      } else {
        playerdata.setSuperadminIdVerified(true);
        TFM_AdminList.updateLastLogin(player);
      }
    }

    TFM_PlayerData.getPlayerData(player).setCommandSpy(true);

    // Handle admin impostors
    if (TFM_AdminList.isAdminImpostor(player)) {
      TFM_Util.bcastMsg(
          "Warning: " + player.getName() + " has been flagged as an impostor and has been frozen!",
          ChatColor.RED);
      TFM_Util.bcastMsg(
          ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
      player.getInventory().clear();
      player.setOp(false);
      player.setGameMode(GameMode.SURVIVAL);
      TFM_PlayerData.getPlayerData(player).setFrozen(true);
    } else if (TFM_AdminList.isSuperAdmin(player)
        || TFM_Util.DEVELOPERS.contains(player.getName())) {
      TFM_Util.bcastMsg(
          ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
    }

    // TODO: Cleanup
    String name = player.getName();
    if (TFM_Util.DEVELOPERS.contains(player.getName())) {
      name = ChatColor.DARK_PURPLE + name;
      TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]");
    }
    if (TFM_Util.EXECUTIVES.contains(player.getName())) {
      name = ChatColor.DARK_BLUE + name;
      TFM_PlayerData.getPlayerData(player).setTag("&8[&1Executive&8]");
    }
    if (TFM_Util.MANAGERS.contains(player.getName())) {
      name = ChatColor.DARK_RED + name;
      TFM_PlayerData.getPlayerData(player).setTag("&8[&4Admin Manager&8]");
    } else if (TFM_AdminList.isSuperAdmin(player)) {
      if (TFM_ConfigEntry.SERVER_OWNERS.getList().contains(name)) {
        name = ChatColor.BLUE + name;
        TFM_PlayerData.getPlayerData(player).setTag("&8[&9Owner&8]");
      } else if (TFM_AdminList.isSeniorAdmin(player)) {
        name = ChatColor.LIGHT_PURPLE + name;
        TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]");
      } else if (TFM_AdminList.isTelnetAdmin(player, true)) {
        name = ChatColor.DARK_GREEN + name;
        TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]");
      } else {
        name = ChatColor.AQUA + name;
        TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]");
      }
    }

    try {
      player.setPlayerListName(StringUtils.substring(name, 0, 16));
    } catch (IllegalArgumentException ex) {
    }

    new BukkitRunnable() {
      @Override
      public void run() {
        if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) {
          player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
        }

        if (TotalFreedomMod.lockdownEnabled) {
          TFM_Util.playerMsg(
              player,
              "Warning: Server is currenty in lockdown-mode, new players will not be able to join!",
              ChatColor.RED);
        }
      }
    }.runTaskLater(TotalFreedomMod.plugin, 20L * 1L);
  }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerJoin(PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final String ip = TFM_Util.getIp(player);

    final TFM_Player playerEntry;
    TFM_Log.info(
        "[JOIN] " + TFM_Util.formatPlayer(player) + " joined the game with IP address: " + ip,
        true);
    // Check absolute value to account for negatives
    if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD
        || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD) {
      player.teleport(player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn
    }
    // Handle PlayerList entry (persistent)
    if (TFM_PlayerList.existsEntry(player)) {
      playerEntry = TFM_PlayerList.getEntry(player);
      playerEntry.setLastLoginUnix(TFM_Util.getUnixTime());
      playerEntry.setLastLoginName(player.getName());
      playerEntry.addIp(ip);
      playerEntry.save();
    } else {
      playerEntry = TFM_PlayerList.getEntry(player);
      TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player));
    }

    // Generate PlayerData (non-persistent)
    final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
    playerdata.setSuperadminIdVerified(false);

    if (TFM_AdminList.isSuperAdmin(player)) {
      for (String storedIp : playerEntry.getIps()) {
        TFM_BanManager.unbanIp(storedIp);
        TFM_BanManager.unbanIp(TFM_Util.getFuzzyIp(storedIp));
      }

      TFM_BanManager.unbanUuid(TFM_UuidManager.getUniqueId(player));

      player.setOp(true);

      // Verify strict IP match
      if (!TFM_AdminList.isIdentityMatched(player)) {
        playerdata.setSuperadminIdVerified(false);
        TFM_Util.bcastMsg(
            "Warning: "
                + player.getName()
                + " is an admin, but is using an account not registered to one of their ip-list.",
            ChatColor.RED);
      } else {
        playerdata.setSuperadminIdVerified(true);
        TFM_AdminList.updateLastLogin(player);
      }
    }

    // Handle admin impostors
    if (TFM_AdminList.isAdminImpostor(player)) {
      if (TFM_Util.imposters.contains(player.getName())) {
        TFM_Util.bcastMsg(
            "Warning: " + player.getName() + " is not an imposter and is just trolling.",
            ChatColor.RED);
        TFM_Util.bcastMsg(
            ChatColor.AQUA
                + player.getName()
                + " is a fake "
                + ChatColor.YELLOW
                + ChatColor.UNDERLINE
                + "Impostor");
      } else {
        TFM_Util.bcastMsg(
            "Warning: "
                + player.getName()
                + " has been flagged as an impostor and has been frozen!",
            ChatColor.RED);
        TFM_Util.bcastMsg(
            ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
        player.getInventory().clear();
        player.setOp(false);
        player.setGameMode(GameMode.SURVIVAL);
        TFM_PlayerData.getPlayerData(player).setFrozen(true);
        TFM_Util.bcastMsg("Admins, tell him to verify!", ChatColor.RED);
      }
    } else if (TFM_AdminList.isSuperAdmin(player)
        || TFM_Util.DEVELOPERS.contains(player.getName())) {
      TFM_Util.bcastMsg(
          ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
    }

    // TODO: Cleanup
    String name = player.getName();
    if (TFM_Util.RF_DEVELOPERS.contains(name)) {
      TFM_PlayerData.getPlayerData(player).setCommandSpy(true);
      player.setPlayerListName(ChatColor.DARK_PURPLE + name);
      TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]");
      afterNameSet(player);
      return;
    } else if (player.getName().equals("iDelRey")) {
      TFM_PlayerData.getPlayerData(player).setCommandSpy(true);
      player.setPlayerListName(ChatColor.DARK_PURPLE + name);
      TFM_PlayerData.getPlayerData(player).setTag("&8[&5Lead Developer&8]");
      afterNameSet(player);
      return;
    } else if (player.getName().equals("reuben4545")) {
      TFM_PlayerData.getPlayerData(player).setCommandSpy(true);
      player.setPlayerListName(ChatColor.GREEN + name);
      TFM_PlayerData.getPlayerData(player).setTag("&8[&aLead Specialist&8]");
      afterNameSet(player);
      return;
    } else if (player.getName().equals("Joenmb")) {
      TFM_PlayerData.getPlayerData(player).setCommandSpy(true);
      player.setPlayerListName(ChatColor.DARK_PURPLE + name);
      TFM_PlayerData.getPlayerData(player).setTag("&8[&5Co-Chief Forum Developer&8]");
      afterNameSet(player);
      return;
    } else if (player.getName().equals("DarkGamingDronze")) {
      TFM_PlayerData.getPlayerData(player).setCommandSpy(true);
      player.setPlayerListName(ChatColor.BLUE + player.getName());
      TFM_PlayerData.getPlayerData(player).setTag("&8[&9Owner&8]");
      player.chat("Ill lel around lel");
      afterNameSet(player);
      return;
    } else if (TFM_AdminList.isSuperAdmin(player)) {
      TFM_PlayerData.getPlayerData(player).setCommandSpy(true);
      if (TFM_ConfigEntry.SERVER_OWNERS.getList().contains(name)) {
        player.setPlayerListName(ChatColor.BLUE + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&9Owner&8]");
        afterNameSet(player);
        return;
      } else if (player.getName().equals("MysteriAce")) {
        player.setPlayerListName(ChatColor.YELLOW + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&cMysteri&8]");
        afterNameSet(player);
        return;
      } else if (player.getName().equals("DarkHorse108")) {
        player.setPlayerListName(ChatColor.DARK_RED + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&4System Manager&8]");
        afterNameSet(player);
        return;
      }
      if (TFM_Util.FOP_DEVELOPERS.contains(name)) {
        player.setPlayerListName(ChatColor.DARK_PURPLE + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&5FOP-Developer&8]");
        afterNameSet(player);
        return;
      }
      if (TFM_Util.COOWNER.contains(name)) {
        player.setPlayerListName(ChatColor.DARK_BLUE + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&9Co-Owner&8]");
        afterNameSet(player);
        return;
      }
      if (TFM_Util.SPECIALISTS.contains(name)) {
        player.setPlayerListName(ChatColor.GREEN + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&aSpecialist&8]");
        afterNameSet(player);
        return;
      }
      if (TFM_Util.EXECUTIVES.contains(name)) {
        player.setPlayerListName(ChatColor.YELLOW + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&eExecutive&8]");
        afterNameSet(player);
        return;
      }
      if (TFM_Util.SYS.contains(name)) {
        player.setPlayerListName(ChatColor.DARK_RED + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&4System-Admin&8]");
        afterNameSet(player);
        return;
      } else if (TFM_AdminList.isSeniorAdmin(player)) {
        player.setPlayerListName(ChatColor.LIGHT_PURPLE + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]");
        afterNameSet(player);
        return;
      } else if (TFM_AdminList.isTelnetAdmin(player, true)) {
        player.setPlayerListName(ChatColor.DARK_GREEN + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]");
        afterNameSet(player);
        return;
      } else {
        player.setPlayerListName(ChatColor.AQUA + name);
        TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]");
        afterNameSet(player);
        return;
      }
    }
  }