Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void stopLag(CommandContext args, CommandSender sender) throws CommandException
- {
- ConfigurationManager configManager = plugin.getGlobalStateManager();
- configManager.activityHaltToggle = (!args.hasFlag('c'));
- if (configManager.activityHaltToggle) {
- if (!(sender instanceof Player)) {
- sender.sendMessage(ChatColor.YELLOW + "ALL intensive server activity halted.");
- }
- plugin.getServer().broadcastMessage(ChatColor.YELLOW + "ALL intensive server activity halted by " + plugin.toName(sender) + ".");
- for (World world : plugin.getServer().getWorlds()) {
- int removed = 0;
- for (Entity entity : world.getEntities()) {
- if (BukkitUtil.isIntensiveEntity(entity)) {
- entity.remove();
- removed++;
- }
- }
- if (removed > 10) {
- sender.sendMessage("" + removed + " entities (>10) auto-removed from " + world.getName());
- }
- }
- }
- else
- {
- if (!(sender instanceof Player)) {
- sender.sendMessage(ChatColor.YELLOW + "ALL intensive server activity no longer halted.");
- }
- plugin.getServer().broadcastMessage(ChatColor.YELLOW + "ALL intensive server activity is now allowed.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment