Fix potential IOOBE in /stfu. Fixes #1750

This commit is contained in:
JeromSar 2016-08-26 12:39:56 +02:00
parent 174a782759
commit f2260d56a4

View File

@ -23,7 +23,7 @@ public class Command_stfu extends FreedomCommand
return false; return false;
} }
if (args[0].equalsIgnoreCase("list")) if (args[0].equals("list"))
{ {
msg("Muted players:"); msg("Muted players:");
FPlayer info; FPlayer info;
@ -45,7 +45,7 @@ public class Command_stfu extends FreedomCommand
return true; return true;
} }
if (args[0].equalsIgnoreCase("purge")) if (args[0].equals("purge"))
{ {
FUtil.adminAction(sender.getName(), "Unmuting all players.", true); FUtil.adminAction(sender.getName(), "Unmuting all players.", true);
FPlayer info; FPlayer info;
@ -63,7 +63,7 @@ public class Command_stfu extends FreedomCommand
return true; return true;
} }
if (args[0].equalsIgnoreCase("all")) if (args[0].equals("all"))
{ {
FUtil.adminAction(sender.getName(), "Muting all non-Superadmins", true); FUtil.adminAction(sender.getName(), "Muting all non-Superadmins", true);
@ -83,10 +83,16 @@ public class Command_stfu extends FreedomCommand
return true; return true;
} }
// -s option (smite)
boolean smite = args[0].equals("-s"); boolean smite = args[0].equals("-s");
if (smite) if (smite)
{ {
args = ArrayUtils.subarray(args, 1, args.length); args = ArrayUtils.subarray(args, 1, args.length);
if (args.length < 1)
{
return false;
}
} }
final Player player = getPlayer(args[0]); final Player player = getPlayer(args[0]);