mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-18 05:16:12 +00:00
293ea04c56
* rename everything containing staff back to admin (as requested by ryan i've renamed commands like slconfig to saconfig but left "slconfig" as an alias) * format almost every file correctly * a few other improvements
50 lines
1.8 KiB
Java
50 lines
1.8 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
|
@CommandParameters(description = "Sets everyone's WorldEdit block modification limit to the default limit or to a custom limit.", usage = "/<command> [limit]", aliases = "setl,swl")
|
|
public class Command_setlimit extends FreedomCommand
|
|
{
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
int amount = plugin.web.getDefaultLimit();
|
|
if (args.length > 0)
|
|
{
|
|
try
|
|
{
|
|
amount = Math.max(-1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[0])));
|
|
}
|
|
catch (NumberFormatException ex)
|
|
{
|
|
msg("Invalid number: " + args[0], ChatColor.RED);
|
|
return true;
|
|
}
|
|
}
|
|
boolean success = false;
|
|
for (final Player player : server.getOnlinePlayers())
|
|
{
|
|
try
|
|
{
|
|
plugin.web.setLimit(player, amount);
|
|
success = true;
|
|
}
|
|
catch (NoClassDefFoundError | NullPointerException ex)
|
|
{
|
|
msg("WorldEdit is not enabled on this server.");
|
|
success = false;
|
|
}
|
|
}
|
|
if (success)
|
|
{
|
|
FUtil.adminAction(sender.getName(), "Setting everyone's WorldEdit block modification limit to " + amount + ".", true);
|
|
}
|
|
return true;
|
|
}
|
|
} |