mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
Fix all the bugs
This commit is contained in:
@ -82,15 +82,15 @@ public class Command_list extends FreedomCommand
|
||||
|
||||
List<String> n = new ArrayList<>();
|
||||
|
||||
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(sender).getRank().isAtLeast(Rank.MOD))
|
||||
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(playerSender).getRank().isAtLeast(Rank.MOD))
|
||||
{
|
||||
List<StaffMember> connectedStaffMembers = plugin.btb.getConnectedAdmins();
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" staff connected to telnet.");
|
||||
.append(" staff members connected to telnet.");
|
||||
for (StaffMember staffMember : connectedStaffMembers)
|
||||
{
|
||||
n.add(plugin.rm.getDisplay(staffMember).getColoredTag() + staffMember.getName());
|
||||
n.add(staffMember.getName());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -139,13 +139,11 @@ public class Command_list extends FreedomCommand
|
||||
.append(": ")
|
||||
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
|
||||
if (senderIsConsole)
|
||||
|
||||
{
|
||||
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
||||
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
sender.sendMessage(onlineStats.toString());
|
||||
sender.sendMessage(onlineUsers.toString());
|
||||
|
@ -19,7 +19,7 @@ public class Command_setlimit extends FreedomCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
amount = Math.max(1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[0])));
|
||||
amount = Math.max(-1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[0])));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
@ -0,0 +1,66 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets a specific player's WorldEdit block modification limit to the default limit or to a custom limit.", usage = "/<command> <player> [limit]", aliases = "setpl,spl")
|
||||
public class Command_setplayerlimit extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
int amount;
|
||||
if (args.length > 0)
|
||||
{
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
amount = Math.max(-1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[1])));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("Invalid number: " + args[1], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = plugin.web.getDefaultLimit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
boolean success = false;
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
try
|
||||
{
|
||||
plugin.web.setLimit(player, amount);
|
||||
success = true;
|
||||
}
|
||||
catch (NoClassDefFoundError | NullPointerException ex)
|
||||
{
|
||||
msg("WorldEdit is not enabled on this server.");
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
FUtil.staffAction(sender.getName(), "Setting " + player.getName() + "'s WorldEdit block modification limit to " + amount + ".", true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user