/** * Toggles stealth login/logoff mode * * @param player */ public void stealth(Player player) { String playerName = player.getName(); // Check permissions to use the command if (AdminPermissions.has(player, Perms.STEALTH)) { // If the player is already stealthed, disable and send them a message if (AdminHandler.isStealthed(playerName)) { AdminHandler.setStealthed(playerName, false); AdminHandler.fakeLog(playerName, true); player.sendMessage( ChatColor.RED + "Stealth-Mode " + ChatColor.WHITE + "is now " + ChatColor.RED + "disabled."); } else { // Check if this player is in the admin map - add if necessary if (!AdminHandler.contains(playerName)) AdminHandler.add(playerName); // Now enable stealth mode and send the messages AdminHandler.setStealthed(playerName, true); AdminHandler.fakeLog(playerName, false); player.sendMessage( ChatColor.GREEN + "Stealth-Mode " + ChatColor.WHITE + "is now " + ChatColor.GREEN + "enabled."); } AdminHandler.savePlayer(playerName); } else { // If they don't have permissions let them know AdminPermissions.noPermsMessage(player); } }
/** * Sends a fake login message to all players connected that do not have all-messages permission */ public void fakeLogin(Player player) { if (AdminPermissions.has(player, Perms.FAKELOG)) { AdminHandler.fakeLog(player.getName(), true); } else { AdminPermissions.noPermsMessage(player); } }
/** * Toggles admin-mode for a player God, NoPickup, Stealth, Invis + Saves Location or Disables them * and returns to the saved location * * @param player */ public void adminMode(Player player) { String playerName = player.getName(); if (AdminPermissions.has(player, Perms.ADMINMODE)) { // If this player is already in admin-mode - toggle it off. if (AdminHandler.isAdminMode(playerName)) { AdminHandler.setAdminMode(playerName, false); if (AdminPermissions.has(player, Perms.FAKELOG)) AdminHandler.fakeLog(playerName, true); admins.goVisible(player); player.sendMessage( ChatColor.RED + "Admin-Mode " + ChatColor.WHITE + "is now " + ChatColor.RED + "disabled."); // Return the player a half-second later admins.returnPlayer(player); } else { // Check if this player is in the admin map - add if necessary if (!AdminHandler.contains(playerName)) AdminHandler.add(playerName); // Enable adminmode and send the message AdminHandler.setAdminMode(playerName, true); if (AdminPermissions.has(player, Perms.FAKELOG)) AdminHandler.fakeLog(playerName, true); admins.goInvisibleInitial(player); player.sendMessage( ChatColor.GREEN + "Admin-Mode " + ChatColor.WHITE + "is now " + ChatColor.GREEN + "enabled."); // Save the players current location as their origin. AdminHandler.setOrigin(playerName, player.getLocation()); player.sendMessage( "You have saved your location at: " + ChatColor.BLUE + AdminHandler.getLocationString(playerName)); } AdminHandler.savePlayer(playerName); } else { // If they don't have permissions let them know AdminPermissions.noPermsMessage(player); } }