/** * Toggles the player being invisible/visible to players Also toggles off Picking up of items * while invisibility is on. * * @param player */ public void vanish(Player player) { String playerName = player.getName(); // Check permissions to use the command if (AdminPermissions.has(player, Perms.VANISH)) { // If the player is already vanished - unvanish them. if (AdminHandler.isInvisible(playerName)) { AdminHandler.setInvis(playerName, false); AdminHandler.setNoPickup(playerName, false); admins.goVisible(player); player.sendMessage( ChatColor.RED + " No-Pickup & Invisibility " + ChatColor.WHITE + "are now " + ChatColor.RED + "disabled."); } else { // Check if the player is in the admin map - add if not if (!AdminHandler.contains(playerName)) AdminHandler.add(playerName); // Now enable invis, no pickup and send the message AdminHandler.setInvis(playerName, true); AdminHandler.setNoPickup(playerName, true); admins.goInvisibleInitial(player); player.sendMessage( ChatColor.GREEN + "No-Pickup & Invisibility " + ChatColor.WHITE + "are now " + ChatColor.GREEN + "enabled."); } AdminHandler.savePlayer(playerName); } else { // Let the player know they don't have permission AdminPermissions.noPermsMessage(player); } }