Skip to content

Commit

Permalink
InferAlias / Executor Bugfix
Browse files Browse the repository at this point in the history
Discovered ArrayOutOfBounds exceptions when using an alias. Forgot to
put InferAlias() inside of the containsError() check, which prevents
these types of things.
  • Loading branch information
FerusGrim committed Apr 30, 2014
1 parent 473fec2 commit cdfd98f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/io/github/ferusgrim/GrimList/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}

private boolean containsError(CommandSender sender, String[] args) {
String function = inferAlias(args[0].toLowerCase());
if (!sender.hasPermission("grimlist." + args[0])) {
sender.sendMessage(plugin.mStart + "Insufficient privileges!");
return true;
}
if (args[0].equals("add") || args[0].equals("remove") || args[0].equals("delete") || args[0].equals("view") || args[0].equals("getid")) {
if (function.equals("add") || function.equals("remove") || function.equals("delete") || function.equals("view") || function.equals("getid")) {
if (args.length < 2) {
if (sender instanceof Player) {
sender.sendMessage(plugin.mStart + "Missing username!");
Expand All @@ -82,7 +83,7 @@ private boolean containsError(CommandSender sender, String[] args) {
return true;
}
}
if (args[0].equals("set")) {
if (function.equals("set")) {
if (args.length < 3) {
if (sender instanceof Player) {
sender.sendMessage(plugin.mStart + "Not enough arguments to use this command!");
Expand Down

0 comments on commit cdfd98f

Please sign in to comment.