/** * Checks permissions then: Saves a players current location to the admin map * * @param player */ public void saveLoc(Player player) { String playerName = player.getName(); if (AdminPermissions.has(player, Perms.RETURN)) { if (!AdminHandler.contains(playerName)) AdminHandler.add(playerName); AdminHandler.setOrigin(playerName, player.getLocation()); AdminHandler.savePlayer(playerName); player.sendMessage( "You have saved your location at: " + ChatColor.DARK_AQUA + AdminHandler.getLocationString(playerName)); } else { // If they don't have permissions let them know 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); } }