Skip to content

Commit

Permalink
Executor containsError() update
Browse files Browse the repository at this point in the history
Never converted containsError to the new style of returning error
messages.
  • Loading branch information
FerusGrim committed May 2, 2014
1 parent 17e91d9 commit 1bd408e
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/main/java/io/github/ferusgrim/GrimList/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,17 @@ private boolean containsError(CommandSender sender, String[] args) {
}
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!");
} else {
plugin.log("WARNING", "Missing username!");
}
sender.sendMessage((sender instanceof Player ? plugin.mStart : "") + "Missing username!");
return true;
}
if (!args[1].matches("[a-zA-Z0-9_]{3,16}")) {
if (sender instanceof Player) {
sender.sendMessage(plugin.mStart + "Invalid username!");
} else {
plugin.log("WARNING", "Invalid username!");
}
sender.sendMessage((sender instanceof Player ? plugin.mStart : "") + "Invalid username!");
return true;
}
}
if (function.equals("set")) {
if (args.length < 3) {
if (sender instanceof Player) {
sender.sendMessage(plugin.mStart + "Not enough arguments to use this command!");
} else {
plugin.log("WARNING", "Not enough arguments to use this command!");
}
return true;
}
if (function.equals("set") && args.length < 3) {
sender.sendMessage((sender instanceof Player ? plugin.mStart : "") + "Not enough arguments to use this command!");
return true;
}
return false;
}
Expand Down

0 comments on commit 1bd408e

Please sign in to comment.