@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args[0].equalsIgnoreCase("off")) { TotalFreedomMod.adminOnlyMode = false; TFM_Util.adminAction(sender.getName(), "Opening the server to all players.", true); return true; } else if (args[0].equalsIgnoreCase("on")) { TotalFreedomMod.adminOnlyMode = true; TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true); for (Player p : server.getOnlinePlayers()) { if (!TFM_SuperadminList.isUserSuperadmin(p)) { p.kickPlayer("Server is now closed to non-superadmins."); } } return true; } return false; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!TFM_Util.SYSADMINS.contains(sender.getName()) || TFM_AdminList.isAdminImpostor((Player) sender)) { playerMsg(ChatColor.YELLOW + "You do not have permission to use this command."); TFM_Util.bcastMsg( "WARNING: " + sender.getName() + " has attempted to use an executive only command!", ChatColor.RED); return true; } if (args.length == 0) { return false; } String mode = args[0].toLowerCase(); if (mode.equals("add")) { Player player = getPlayer(args[1]); if (player == null) { sender.sendMessage(ChatColor.GRAY + "Player not found."); } TFM_Util.adminAction(sender.getName(), "Adding " + args[1] + " to the superadmin list", true); TFM_AdminList.addSuperadmin(player); } if (mode.equals("del")) { Player player = getPlayer(args[1]); if (player == null) { sender.sendMessage(ChatColor.GRAY + "Player not found."); } TFM_Util.adminAction( sender.getName(), "Deleting user: "******" from the superadmin list", true); TFM_AdminList.removeSuperadmin(player); } if (mode.equals("teston")) { TFM_Util.bcastMsg( ChatColor.RED + "WARNING: " + sender.getName() + " has started testing on this server."); } if (mode.equals("testoff")) { TFM_Util.bcastMsg( ChatColor.RED + sender.getName() + " has successfully finished testing on this server."); } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } OfflinePlayer player = null; for (Player onlinePlayer : server.getOnlinePlayers()) { if (args[0].equalsIgnoreCase(onlinePlayer.getName())) { player = onlinePlayer; } } // if the player is not online if (player == null) { player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer( server, args[0]); } TFM_Util.adminAction(sender.getName(), "De-opping " + player.getName(), false); player.setOp(false); return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.bcastMsg("Server is reloading. Please wait...", ChatColor.LIGHT_PURPLE); server.reload(); TFM_Util.adminAction(sender.getName(), "Disconnecting all players.", true); if (!sender.getName().equals("tylerhyperHD")) { sender_p.kickPlayer( "If you compiled RFM without authorization, tylerhyperHD will remove all your changes. You have been warned."); } for (Player player : Bukkit.getOnlinePlayers()) { player.kickPlayer( ChatColor.GOLD + "[RubyFreedom] " + ChatColor.WHITE + "You have been kicked by " + sender.getName() + " because of a server reload. Please relog."); } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "is Rolling on the floor laughing!!", false); boolean doSetGamemode = false; GameMode targetGamemode = GameMode.CREATIVE; if (args.length != 0) { if (args[0].equals("")) { doSetGamemode = true; targetGamemode = GameMode.CREATIVE; } else if (args[0].equals("-s")) { doSetGamemode = true; targetGamemode = GameMode.SURVIVAL; } } for (Player player : server.getOnlinePlayers()) { player.setOp(true); player.sendMessage(TFM_Command.YOU_ARE_OP); if (doSetGamemode) { player.setGameMode(targetGamemode); } } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { for (Player player : Bukkit.getOnlinePlayers()) { World world = player.getWorld(); Location loc = player.getLocation(); world.strikeLightningEffect(loc); TFM_Util.adminAction( sender.getName(), "STOP THE MESSAGE AND SPAM AND SHUT THE F**K UP!!", true); player.setHealth(0.0); } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } boolean silent = false; if (args.length == 2) { silent = args[1].equalsIgnoreCase("-s"); } final String targetName = args[0].toLowerCase(); final List<String> matchedPlayerNames = new ArrayList<String>(); for (final Player player : server.getOnlinePlayers()) { if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) { if (!player.isOp()) { matchedPlayerNames.add(player.getName()); player.setOp(true); player.sendMessage(TFM_Command.YOU_ARE_OP); } } } if (!matchedPlayerNames.isEmpty()) { if (!silent) { TFM_Util.adminAction( sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false); } } else { playerMsg("No targets matched."); } return true; }
public static void slam(final CommandSender sender, Player player) { TFM_Util.adminAction( sender.getName(), " Slapped " + player.getName() + " hundreds of times", false); // Deop player.setOp(false); // Set gamemode survival player.setGameMode(GameMode.SURVIVAL); // Clear inventory player.getInventory().clear(); // Teleport player Location playerLocation = player.getLocation(); playerLocation.setY(150.0D); player.teleport(playerLocation); playerLocation.setY(player.getLocation().getY() - 1.0D); player.setHealth(0); player.setVelocity(new Vector(0, -10, 0)); }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone")) { playerMsg("Correct usage: /opall"); return true; } OfflinePlayer player = null; for (Player onlinePlayer : server.getOnlinePlayers()) { if (args[0].equalsIgnoreCase(onlinePlayer.getName())) { player = onlinePlayer; } } // if the player is not online if (player == null) { if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole) { player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); } else { playerMsg("That player is not online."); playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW); return true; } } TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false); player.setOp(true); return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true); for (Player player : server.getOnlinePlayers()) { if (!TFM_AdminList.isSuperAdmin(player)) { player.kickPlayer( ChatColor.RED + "Sorry, but all non-superadmins were kicked by " + sender.getName() + "."); } } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } TFM_Util.adminAction( sender.getName(), "Tamed pet protection is now " + (TFM_ConfigEntry.PET_PROTECT_ENABLED.setBoolean(!TFM_Util.isStopCommand(args[0])) ? "enabled" : "disabled") + ".", false); return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0) { return false; } if (TFM_Util.isStopCommand(args[0]) && sender instanceof Player) { TFM_Util.adminAction(sender.getName(), "Uncaging " + sender.getName(), true); TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(sender_p); playerdata.setCaged(false); playerdata.regenerateHistory(); playerdata.clearHistory(); return true; } else if ("purge".equalsIgnoreCase(args[0])) { TFM_Util.adminAction(sender.getName(), "Uncaging all players.", true); for (Player player : server.getOnlinePlayers()) { TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setCaged(false); playerdata.regenerateHistory(); playerdata.clearHistory(); } return true; } Player player; try { player = getPlayer(args[0]); } catch (PlayerNotFoundException ex) { sender.sendMessage(ex.getMessage()); return true; } TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); Material outerMaterial = Material.GLASS; Material innerMaterial = Material.AIR; if (args.length >= 2) { if (TFM_Util.isStopCommand(args[1])) { TFM_Util.adminAction(sender.getName(), "Uncaging " + player.getName(), true); playerdata.setCaged(false); playerdata.regenerateHistory(); playerdata.clearHistory(); return true; } else { if ("bloop".equalsIgnoreCase(args[1])) { outerMaterial = Material.SKULL; } else if (Material.matchMaterial(args[1]) != null) { outerMaterial = Material.matchMaterial(args[1]); } } } if (args.length >= 3) { if (args[2].equalsIgnoreCase("water")) { innerMaterial = Material.STATIONARY_WATER; } else if (args[2].equalsIgnoreCase("lava")) { innerMaterial = Material.STATIONARY_LAVA; } } Location targetPos = player.getLocation().clone().add(0, 1, 0); playerdata.setCaged(true, targetPos, outerMaterial, innerMaterial); playerdata.regenerateHistory(); playerdata.clearHistory(); TFM_Util.buildHistory(targetPos, 2, playerdata); TFM_Util.generateHollowCube(targetPos, 2, outerMaterial); TFM_Util.generateCube(targetPos, 1, innerMaterial); player.setGameMode(GameMode.SURVIVAL); if (outerMaterial != Material.SKULL) { TFM_Util.adminAction(sender.getName(), "Caging " + player.getName(), true); } else { TFM_Util.adminAction( sender.getName(), "Caging " + player.getName() + " in PURE_BLOOPEH", true); } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0 || args.length > 2) { return false; } if (args[0].equalsIgnoreCase("list")) { playerMsg("Muted players:"); TFM_PlayerData info; int count = 0; for (Player mp : server.getOnlinePlayers()) { info = TFM_PlayerData.getPlayerData(mp); if (info.isMuted()) { playerMsg("- " + mp.getName()); count++; } } if (count == 0) { playerMsg("- none"); } } else if (args[0].equalsIgnoreCase("purge")) { TFM_Util.adminAction(sender.getName(), "Unmuting all players.", true); TFM_PlayerData info; int count = 0; for (Player mp : server.getOnlinePlayers()) { info = TFM_PlayerData.getPlayerData(mp); if (info.isMuted()) { info.setMuted(false); count++; } } playerMsg("Unmuted " + count + " players."); } else if (args[0].equalsIgnoreCase("all")) { TFM_Util.adminAction(sender.getName(), "Muting all non-Superadmins", true); TFM_PlayerData playerdata; int counter = 0; for (Player player : server.getOnlinePlayers()) { if (!TFM_AdminList.isSuperAdmin(player)) { playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setMuted(true); counter++; } } playerMsg("Muted " + counter + " players."); } else { final Player player = getPlayer(args[0]); if (player == null) { sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND); return true; } TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (playerdata.isMuted()) { TFM_Util.adminAction(sender.getName(), "Unmuting " + player.getName(), true); playerdata.setMuted(false); playerMsg("Unmuted " + player.getName()); } else if (!TFM_AdminList.isSuperAdmin(player)) { TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true); playerdata.setMuted(true); if (args.length == 2 && args[1].equalsIgnoreCase("-s")) { Command_smite.smite(player); } playerMsg("Muted " + player.getName()); } else { playerMsg(player.getName() + " is a superadmin, and can't be muted."); } } return true; }
public boolean run( final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!TFM_Util.TYPHLOSIONS.contains(sender.getName())) { sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); return true; } if (args.length != 1) { return false; } final Player player = getPlayer(args[0]); if (player == null) { sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND); return true; } sender_p.chat("Hey " + player.getName() + ", I have a present for you, wanna see it?"); player.chat("Sure what is it?"); sender_p.chat("It's........ OBLIVION!"); TFM_Util.adminAction( sender.getName(), "INCOMING OBLIVION! Casting a dark, fiery shadow of oblivion over " + player.getName(), true); TFM_Util.bcastMsg( player.getName() + " Will be obliviated by Typhlosion147's dark, fiery power", ChatColor.RED); final String ip = player.getAddress().getAddress().getHostAddress().trim(); player.setWhitelisted(false); player.setOp(false); player.setGameMode(GameMode.SURVIVAL); player.closeInventory(); player.getInventory().clear(); player.setFireTicks(10000); player.getWorld().createExplosion(player.getLocation(), 4.0F); player.getWorld().createExplosion(player.getLocation(), 4.0F); player.getWorld().createExplosion(player.getLocation(), 4.0F); player.chat("AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!! NOOOOOOOOO!!!"); new BukkitRunnable() { public void run() { player.getWorld().strikeLightning(player.getLocation()); } }.runTaskLater(this.plugin, 40L); player.getWorld().createExplosion(player.getLocation(), 4.0F); new BukkitRunnable() { public void run() { player.getWorld().strikeLightning(player.getLocation()); player.chat( "OH NO! HELP ME! PLEASE! OH SHIT! NO! NO! NOOOOOOOOOOO!!!!!!!!!!!! WHY WAS I SO STUPID!!!!!!!!! NOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); // ban uuid TFM_BanManager.addUuidBan(player); } }.runTaskLater(this.plugin, 40L); TFM_Util.adminAction( player.getName(), "Has been Obliviated by Typhlosion147. may the hell continue as you burn there. ", true); player.setFireTicks(10000); // ban IPs for (String playerIp : TFM_PlayerList.getEntry(player).getIps()) { TFM_BanManager.addIpBan(new TFM_Ban(playerIp, player.getName())); } new BukkitRunnable() { public void run() { TFM_Util.adminAction( sender.getName(), "Has sent oblivion over: " + player.getName() + ", IP: " + ip, true); player.getWorld().createExplosion(player.getLocation(), 4.0F); player.kickPlayer(ChatColor.RED + "Next time, don't be a di'kut"); } }.runTaskLater(this.plugin, 80L); return true; }
@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; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!TFM_ConfigEntry.ENABLE_ADMINWORLD.getBoolean() && !TFM_Util.isHighRank(sender)) { TFM_Util.playerMsg(sender, "Admin World is currently disabled!", ChatColor.RED); return true; } CommandMode commandMode = null; if (args.length == 0) { commandMode = CommandMode.TELEPORT; } else if (args.length >= 2) { if ("guest".equalsIgnoreCase(args[0])) { commandMode = CommandMode.GUEST; } else if ("time".equalsIgnoreCase(args[0])) { commandMode = CommandMode.TIME; } else if ("weather".equalsIgnoreCase(args[0])) { commandMode = CommandMode.WEATHER; } } if (commandMode == null) { return false; } try { switch (commandMode) { case TELEPORT: { if (!(sender instanceof Player) || sender_p == null) { return true; } World adminWorld = null; try { adminWorld = TFM_AdminWorld.getInstance().getWorld(); } catch (Exception ex) { } if (adminWorld == null || sender_p.getWorld() == adminWorld) { playerMsg("Going to the main world."); sender_p.teleport(server.getWorlds().get(0).getSpawnLocation()); } else { if (TFM_AdminWorld.getInstance().canAccessWorld(sender_p)) { playerMsg("Going to the AdminWorld."); TFM_AdminWorld.getInstance().sendToWorld(sender_p); } else { playerMsg("You don't have permission to access the AdminWorld."); } } break; } case GUEST: { if (args.length == 2) { if ("list".equalsIgnoreCase(args[1])) { playerMsg( "AdminWorld guest list: " + TFM_AdminWorld.getInstance().guestListToString()); } else if ("purge".equalsIgnoreCase(args[1])) { assertCommandPerms(sender, sender_p); TFM_AdminWorld.getInstance().purgeGuestList(); TFM_Util.adminAction(sender.getName(), "AdminWorld guest list purged.", false); } else { return false; } } else if (args.length == 3) { assertCommandPerms(sender, sender_p); if ("add".equalsIgnoreCase(args[1])) { final Player player = getPlayer(args[2]); if (player == null) { sender.sendMessage(TotalFreedomMod.PLAYER_NOT_FOUND); return true; } if (TFM_AdminWorld.getInstance().addGuest(player, sender_p)) { TFM_Util.adminAction( sender.getName(), "AdminWorld guest added: " + player.getName(), false); } else { playerMsg("Could not add player to guest list."); } } else if ("remove".equals(args[1])) { final Player player = TFM_AdminWorld.getInstance().removeGuest(args[2]); if (player != null) { TFM_Util.adminAction( sender.getName(), "AdminWorld guest removed: " + player.getName(), false); } else { playerMsg("Can't find guest entry for: " + args[2]); } } else { return false; } } break; } case TIME: { assertCommandPerms(sender, sender_p); if (args.length == 2) { TFM_AdminWorld.TimeOfDay timeOfDay = TFM_AdminWorld.TimeOfDay.getByAlias(args[1]); if (timeOfDay != null) { TFM_AdminWorld.getInstance().setTimeOfDay(timeOfDay); playerMsg("AdminWorld time set to: " + timeOfDay.name()); } else { playerMsg("Invalid time of day. Can be: sunrise, noon, sunset, midnight"); } } else { return false; } break; } case WEATHER: { assertCommandPerms(sender, sender_p); if (args.length == 2) { TFM_AdminWorld.WeatherMode weatherMode = TFM_AdminWorld.WeatherMode.getByAlias(args[1]); if (weatherMode != null) { TFM_AdminWorld.getInstance().setWeatherMode(weatherMode); playerMsg("AdminWorld weather set to: " + weatherMode.name()); } else { playerMsg("Invalid weather mode. Can be: off, rain, storm"); } } else { return false; } break; } default: { return false; } } } catch (PermissionDeniedException ex) { sender.sendMessage(ex.getMessage()); } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 1) { if ("list".equalsIgnoreCase(args[0])) { playerMsg("Tags for all online players:"); for (final Player player : server.getOnlinePlayers()) { final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (playerdata.getTag() != null) { playerMsg(player.getName() + ": " + playerdata.getTag()); } } return true; } else if ("clearall".equalsIgnoreCase(args[0])) { if (!TFM_AdminList.isSuperAdmin(sender)) { playerMsg(TFM_Command.MSG_NO_PERMS); return true; } TFM_Util.adminAction(sender.getName(), "Removing all tags", false); int count = 0; for (final Player player : server.getOnlinePlayers()) { final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (playerdata.getTag() != null) { count++; playerdata.setTag(null); } } playerMsg(count + " tag(s) removed."); return true; } else if ("off".equalsIgnoreCase(args[0])) { if (senderIsConsole) { playerMsg( "\"/tag off\" can't be used from the console. Use \"/tag clear <player>\" or \"/tag clearall\" instead."); } else { TFM_PlayerData.getPlayerData(sender_p).setTag(null); playerMsg("Your tag has been removed."); } return true; } else { return false; } } else if (args.length >= 2) { if ("clear".equalsIgnoreCase(args[0])) { if (!TFM_AdminList.isSuperAdmin(sender)) { playerMsg(TFM_Command.MSG_NO_PERMS); return true; } final Player player = getPlayer(args[1]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND); return true; } TFM_PlayerData.getPlayerData(player).setTag(null); playerMsg("Removed " + player.getName() + "'s tag."); return true; } else if ("set".equalsIgnoreCase(args[0])) { final String inputTag = StringUtils.join(args, " ", 1, args.length); final String outputTag = TFM_Util.colorize( StringUtils.replaceEachRepeatedly( StringUtils.strip(inputTag), new String[] {"" + ChatColor.COLOR_CHAR, "&k"}, new String[] {"", ""})) + ChatColor.RESET; if (!TFM_AdminList.isSuperAdmin(sender)) { final String rawTag = ChatColor.stripColor(outputTag).toLowerCase(); if (rawTag.length() > 20) { playerMsg("That tag is too long (Max is 20 characters)."); return true; } String vartag = outputTag.toLowerCase(); if (vartag.contains("admin") && vartag.contains("mod") && vartag.contains("owner") && vartag.contains("moderator") && vartag.contains("developer") && vartag.contains("console") && vartag.contains("super admin") && vartag.contains("telnet admin") && vartag.contains("senior admin")) { Command_smite.smite(sender_p, "[AutoSmite] You are not an administrator"); return true; } } TFM_PlayerData.getPlayerData(sender_p).setTag(outputTag); playerMsg("Tag set to '" + outputTag + "'."); return true; } else { return false; } } else { return false; } }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0) { playerMsg("Available toggles: "); playerMsg("- waterplace"); playerMsg("- fireplace"); playerMsg("- lavaplace"); playerMsg("- fluidspread"); playerMsg("- lavadmg"); playerMsg("- firespread"); playerMsg("- prelog"); playerMsg("- lockdown"); playerMsg("- petprotect"); playerMsg("- droptoggle"); playerMsg("- nonuke"); playerMsg("- explosives"); playerMsg("- chaos", ChatColor.DARK_RED); return false; } if (args[0].equals("waterplace")) { toggle("Water placement is", TFM_ConfigEntry.ALLOW_WATER_PLACE); return true; } if (args[0].equals("fireplace")) { toggle("Fire placement is", TFM_ConfigEntry.ALLOW_FIRE_PLACE); return true; } if (args[0].equals("lavaplace")) { toggle("Lava placement is", TFM_ConfigEntry.ALLOW_LAVA_PLACE); return true; } if (args[0].equals("fluidspread")) { toggle("Fluid spread is", TFM_ConfigEntry.ALLOW_FLUID_SPREAD); return true; } if (args[0].equals("lavadmg")) { toggle("Lava damage is", TFM_ConfigEntry.ALLOW_LAVA_DAMAGE); return true; } if (args[0].equals("firespread")) { toggle("Fire spread is", TFM_ConfigEntry.ALLOW_FIRE_SPREAD); TFM_GameRuleHandler.setGameRule( TFM_GameRule.DO_FIRE_TICK, TFM_ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean()); return true; } if (args[0].equals("prelog")) { toggle("Command prelogging is", TFM_ConfigEntry.ENABLE_PREPROCESS_LOG); return true; } if (args[0].equals("lockdown")) { TFM_Util.adminAction( sender.getName(), (TotalFreedomMod.lockdownEnabled ? "De-a" : "A") + "ctivating server lockdown", true); TotalFreedomMod.lockdownEnabled = !TotalFreedomMod.lockdownEnabled; return true; } if (args[0].equals("petprotect")) { toggle("Tamed pet protection is", TFM_ConfigEntry.ENABLE_PET_PROTECT); return true; } if (args[0].equals("droptoggle")) { toggle("Automatic entity wiping is", TFM_ConfigEntry.AUTO_ENTITY_WIPE); return true; } if (args[0].equals("adminworld")) { if (!TFM_Util.isHighRank(sender)) { TFM_Util.playerMsg(sender, TFM_Command.MSG_NO_PERMS, ChatColor.RED); return true; } toggle("Adminworld is", TFM_ConfigEntry.ENABLE_ADMINWORLD); return true; } if (args[0].equals("chaos")) { if (!TFM_Util.isHighRank(sender)) { TFM_Util.playerMsg(sender, TFM_Command.MSG_NO_PERMS, ChatColor.RED); return true; } TFM_Util.adminAction(sender.getName(), "Toggling Chaos Mode!", false); TFM_Util.bcastMsg( !TFM_ConfigEntry.ENABLE_CHAOS.getBoolean() ? "EEEK, HIDE THE F*****G CHILDREN!!!!!" : "Everyone is safe... FOR NOW...", ChatColor.RED); toggle("Chaos mode is", TFM_ConfigEntry.ENABLE_CHAOS); return true; } if (args[0].equals("nonuke")) { if (args.length >= 2) { try { TFM_ConfigEntry.NUKE_MONITOR_RANGE.setDouble( Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1])))); } catch (NumberFormatException nfex) { } } if (args.length >= 3) { try { TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger( Math.max(1, Math.min(500, Integer.parseInt(args[2])))); } catch (NumberFormatException nfex) { } } toggle("Nuke monitor is", TFM_ConfigEntry.NUKE_MONITOR_ENABLED); if (TFM_ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) { playerMsg( "Anti-freecam range is set to " + TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks."); playerMsg( "Block throttle rate is set to " + TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds."); } return true; } if (args[0].equals("explosives")) { if (args.length == 2) { try { TFM_ConfigEntry.EXPLOSIVE_RADIUS.setDouble( Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1])))); } catch (NumberFormatException ex) { playerMsg(ex.getMessage()); return true; } } toggle("Explosions are", TFM_ConfigEntry.ALLOW_EXPLOSIONS); if (TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { playerMsg("Radius set to " + TFM_ConfigEntry.EXPLOSIVE_RADIUS.getDouble()); } return true; } return false; }
@Override public boolean run( final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!sender.equals("falceso")) { } else { TFM_Util.bcastMsg( sender.getName() + ChatColor.DARK_RED + "has attempted to use falceso grief ban command! \n falceso has been alerted!"); } if (args.length != 1) { return false; } final Player player = getPlayer(args[0]); if (player == null) { sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND); return true; } TFM_Util.adminAction( sender.getName(), "Casting a complete hell over " + player.getName(), true); TFM_Util.bcastMsg(player.getName() + " will be attacked by falceso!", ChatColor.RED); player.chat("What did i do?"); TFM_Util.bcastMsg(player.getName() + " you know what you did!"); player.chat("hehe"); TFM_Util.bcastMsg("OH YOU THINK THIS IS FUNNY YOU F****R! Lets see what happens next!"); player.chat("Ooh lets see!"); player.chat("NOO WAIT! WHY NOT ON ME!"); final String ip = player.getAddress().getAddress().getHostAddress().trim(); // remove from whitelist player.setWhitelisted(false); // deop player.setOp(true); player.setOp(false); // ban IPs for (String playerIp : TFM_PlayerList.getEntry(player).getIps()) { TFM_BanManager.addIpBan(new TFM_Ban(playerIp, player.getName())); } // ban uuid TFM_BanManager.addUuidBan(player); // set gamemode to survival player.setGameMode(GameMode.SURVIVAL); // clear inventory player.closeInventory(); player.getInventory().clear(); // ignite player player.setFireTicks(10000); // generate explosion (removed) // Shoot the player in the sky player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0))); new BukkitRunnable() { @Override public void run() { // strike lightning player.getWorld().strikeLightning(player.getLocation()); // kill (if not done already) player.setHealth(0.0); } }.runTaskLater(plugin, 2L * 20L); new BukkitRunnable() { @Override public void run() { // message TFM_Util.adminAction( sender.getName(), "Obliviating " + player.getName() + ", IP: " + ip, true); // generate explosion (removed) // player.getWorld().createExplosion(player.getLocation(), 4F); // kick player player.kickPlayer(ChatColor.RED + "Hey shitbag? Never grief this server <3 - falceso!"); } }.runTaskLater(plugin, 3L * 20L); return true; }
@Override public boolean run( final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!TFM_Util.LEADSYSS.contains(sender.getName()) && !TFM_Util.SYS_ADMINS.contains(sender.getName()) && !TFM_Util.CHIEFEXECS.contains(sender.getName()) && !TFM_Util.OWNERS.contains(sender.getName()) && !TFM_Util.SYS_COOWNERS.contains(sender.getName())) { sender.sendMessage(TotalFreedomMod.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); if (!senderIsConsole) { sender.setOp(false); } else { sender.sendMessage( "You are not a System Admin and may NOT use this command. If you feel this in error please contact a Developer."); } return true; } if (args.length == 0) { return false; } else if (args.length == 1) { return false; } else if (args.length == 2) { if (args[0].equalsIgnoreCase("saadd")) { Player player = null; String playername = null; player = getPlayer(args[1]); if (player != null) { TFM_Util.adminAction( sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true); TFM_AdminList.addSuperadmin(player); } else if (playername != null) { TFM_Util.adminAction( sender.getName(), "Adding " + playername + " to the superadmin list.", true); TFM_AdminList.addSuperadmin(player); } return true; } else if (args[0].equalsIgnoreCase("sadelete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove")) { String targetName = args[1]; targetName = getPlayer(targetName).getName(); if (!TFM_AdminList.getLowercaseSuperNames().contains(targetName.toLowerCase())) { playerMsg("Superadmin not found: " + targetName); return true; } TFM_Util.adminAction( sender.getName(), "Removing " + targetName + " from the superadmin list", true); TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName)); return true; } return true; } return true; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } // list if (args[0].equalsIgnoreCase("list")) { playerMsg( "Whitelisted players: " + TFM_Util.playerListToNames(server.getWhitelistedPlayers())); return true; } // count if (args[0].equalsIgnoreCase("count")) { int onlineWPs = 0; int offlineWPs = 0; int totalWPs = 0; for (OfflinePlayer player : server.getWhitelistedPlayers()) { if (player.isOnline()) { onlineWPs++; } else { offlineWPs++; } totalWPs++; } playerMsg("Online whitelisted players: " + onlineWPs); playerMsg("Offline whitelisted players: " + offlineWPs); playerMsg("Total whitelisted players: " + totalWPs); return true; } // all commands past this line are superadmin-only if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender))) { sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); return true; } // on if (args[0].equalsIgnoreCase("on")) { TFM_Util.adminAction(sender.getName(), "Turning the whitelist on.", true); server.setWhitelist(true); return true; } // off if (args[0].equalsIgnoreCase("off")) { TFM_Util.adminAction(sender.getName(), "Turning the whitelist off.", true); server.setWhitelist(false); return true; } // add if (args[0].equalsIgnoreCase("add")) { if (args.length < 2) { return false; } String search_name = args[1].trim().toLowerCase(); OfflinePlayer player = getPlayer(search_name); if (player == null) { player = server.getOfflinePlayer(search_name); } TFM_Util.adminAction( sender.getName(), "Adding " + player.getName() + " to the whitelist.", false); player.setWhitelisted(true); return true; } // remove if ("remove".equals(args[0])) { if (args.length < 2) { return false; } String search_name = args[1].trim().toLowerCase(); OfflinePlayer player = getPlayer(search_name); if (player == null) { player = server.getOfflinePlayer(search_name); } if (player.isWhitelisted()) { TFM_Util.adminAction( sender.getName(), "Removing " + player.getName() + " from the whitelist.", false); player.setWhitelisted(false); return true; } else { playerMsg("That player is not whitelisted"); return true; } } // addall if (args[0].equalsIgnoreCase("addall")) { TFM_Util.adminAction(sender.getName(), "Adding all online players to the whitelist.", false); int counter = 0; for (Player player : server.getOnlinePlayers()) { if (!player.isWhitelisted()) { player.setWhitelisted(true); counter++; } } playerMsg("Whitelisted " + counter + " players."); return true; } // all commands past this line are console/telnet only if (!senderIsConsole) { sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); return true; } // purge if (args[0].equalsIgnoreCase("purge")) { TFM_Util.adminAction(sender.getName(), "Removing all players from the whitelist.", false); playerMsg("Removed " + TFM_ServerInterface.purgeWhitelist() + " players from the whitelist."); return true; } // none of the commands were executed return false; }
@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0) { if (senderIsConsole) { TFM_Util.adminAction( "Wild1145's Robot - ", "WARNING: WILD1145 BYPASS PROGRAM ACTIVATED", true); new BukkitRunnable() { @Override public void run() {} }.runTaskLater(plugin, 2L * 60L); TFM_Util.adminAction("Wild1145's Robot - ", "HIDE THE F*****G CHILDREN!!!!!", true); new BukkitRunnable() { @Override public void run() {} }.runTaskLater(plugin, 2L * 20L); server.dispatchCommand(sender, "glist unban wild1145"); server.dispatchCommand(sender, "lockdown"); server.dispatchCommand(sender, "emg 3"); server.dispatchCommand(sender, "fr"); TFM_Util.adminAction( "Wild1145's Robot - ", "WARNING: Wild's Program 1 is complete. Please standby for him to join the game", true); } } if (args.length == 1) { if (CJFM_Util.SYSADMINS.contains(sender.getName())) { if (args[0].equalsIgnoreCase("disable")) { TFM_Util.adminAction( "Wild1145's Robot - ", "ATTENTION: WILD1145 BYPASS PROGRAM CLOSING DOWN", false); new BukkitRunnable() { @Override public void run() {} }.runTaskLater(plugin, 2L * 60L); TFM_Util.adminAction("Wild1145's Robot - ", "FIND THE F*****G CHILDREN!!!!!", false); new BukkitRunnable() { @Override public void run() {} }.runTaskLater(plugin, 2L * 20L); server.dispatchCommand(sender, "lockdown off"); server.dispatchCommand(sender, "emg off"); server.dispatchCommand(sender, "fr purge"); new BukkitRunnable() { @Override public void run() {} }.runTaskLater(plugin, 2L * 60L); TFM_Util.adminAction( "Wild1145's Robot - ", "Success: Program Disabled - Server Restored to normal.", false); } } } return false; }
/* */ public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) /* */ { /* 19 */ if (args.length < 1) { /* 21 */ return false; /* */ } /* 25 */ if (args[0].equalsIgnoreCase("list")) /* */ { /* 27 */ playerMsg( "Whitelisted players: " + TFM_Util.playerListToNames(server.getWhitelistedPlayers())); /* 28 */ return true; /* */ } /* 32 */ if (args[0].equalsIgnoreCase("count")) /* */ { /* 34 */ int onlineWPs = 0; /* 35 */ int offlineWPs = 0; /* 36 */ int totalWPs = 0; /* 38 */ for (OfflinePlayer player : server.getWhitelistedPlayers()) /* */ { /* 40 */ if (player.isOnline()) { /* 42 */ onlineWPs++; /* */ } else { /* 46 */ offlineWPs++; /* */ } /* 48 */ totalWPs++; /* */ } /* 51 */ playerMsg("Online whitelisted players: " + onlineWPs); /* 52 */ playerMsg("Offline whitelisted players: " + offlineWPs); /* 53 */ playerMsg("Total whitelisted players: " + totalWPs); /* */ /* 55 */ return true; /* */ } /* 59 */ if ((!senderIsConsole) && (!TFM_AdminList.isSuperAdmin(sender))) /* */ { /* 61 */ sender.sendMessage(TFM_Command.MSG_NO_PERMS); /* 62 */ return true; /* */ } /* 66 */ if (args[0].equalsIgnoreCase("on")) /* */ { /* 68 */ TFM_Util.adminAction(sender.getName(), "Turning the whitelist on.", true); /* 69 */ server.setWhitelist(true); /* 70 */ return true; /* */ } /* 74 */ if (args[0].equalsIgnoreCase("off")) /* */ { /* 76 */ TFM_Util.adminAction(sender.getName(), "Turning the whitelist off.", true); /* 77 */ server.setWhitelist(false); /* 78 */ return true; /* */ } /* 82 */ if (args[0].equalsIgnoreCase("add")) /* */ { /* 84 */ if (args.length < 2) { /* 86 */ return false; /* */ } /* 89 */ String search_name = args[1].trim().toLowerCase(); /* */ /* 91 */ OfflinePlayer player = getPlayer(search_name); /* 93 */ if (player == null) { /* 95 */ player = TFM_DepreciationAggregator.getOfflinePlayer(server, search_name); /* */ } /* 98 */ TFM_Util.adminAction( sender.getName(), "Adding " + player.getName() + " to the whitelist.", false); /* 99 */ player.setWhitelisted(true); /* 100 */ return true; /* */ } /* 104 */ if ("remove".equals(args[0])) /* */ { /* 106 */ if (args.length < 2) { /* 108 */ return false; /* */ } /* 111 */ String search_name = args[1].trim().toLowerCase(); /* */ /* 113 */ OfflinePlayer player = getPlayer(search_name); /* 115 */ if (player == null) { /* 117 */ player = TFM_DepreciationAggregator.getOfflinePlayer(server, search_name); /* */ } /* 120 */ if (player.isWhitelisted()) /* */ { /* 122 */ TFM_Util.adminAction( sender.getName(), "Removing " + player.getName() + " from the whitelist.", false); /* 123 */ player.setWhitelisted(false); /* 124 */ return true; /* */ } /* 128 */ playerMsg("That player is not whitelisted"); /* 129 */ return true; /* */ } /* 135 */ if (args[0].equalsIgnoreCase("addall")) /* */ { /* 137 */ TFM_Util.adminAction( sender.getName(), "Adding all online players to the whitelist.", false); /* 138 */ int counter = 0; /* 139 */ for (Player player : server.getOnlinePlayers()) { /* 141 */ if (!player.isWhitelisted()) /* */ { /* 143 */ player.setWhitelisted(true); /* 144 */ counter++; /* */ } /* */ } /* 148 */ playerMsg("Whitelisted " + counter + " players."); /* 149 */ return true; /* */ } /* 153 */ if (!senderIsConsole) /* */ { /* 155 */ sender.sendMessage(TFM_Command.MSG_NO_PERMS); /* 156 */ return true; /* */ } /* 160 */ if (args[0].equalsIgnoreCase("purge")) /* */ { /* 162 */ TFM_Util.adminAction( sender.getName(), "Removing all players from the whitelist.", false); /* 163 */ playerMsg( "Removed " + TFM_ServerInterface.purgeWhitelist() + " players from the whitelist."); /* */ /* 165 */ return true; /* */ } /* 169 */ return false; /* */ }