Make commands case insensitive.
Note that this doesn't make the arguments for commands case insensitive. Each command is still responsible for lowercasing their arguments if it makes sense for them to do so. This closes #446.
This commit is contained in:
@@ -1264,7 +1264,7 @@ public class ArenaListener
|
||||
}
|
||||
|
||||
// This is safe, because commands will always have at least one element.
|
||||
String base = event.getMessage().split(" ")[0];
|
||||
String base = event.getMessage().split(" ")[0].toLowerCase();
|
||||
|
||||
// Check if the entire base command is allowed.
|
||||
if (plugin.getArenaMaster().isAllowed(base)) {
|
||||
@@ -1272,7 +1272,7 @@ public class ArenaListener
|
||||
}
|
||||
|
||||
// If not, check if the specific command is allowed.
|
||||
String noslash = event.getMessage().substring(1);
|
||||
String noslash = event.getMessage().substring(1).toLowerCase();
|
||||
if (plugin.getArenaMaster().isAllowed(noslash)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ public class CommandHandler implements CommandExecutor
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, org.bukkit.command.Command bcmd, String label, String[] args) {
|
||||
// Grab the base and arguments.
|
||||
String base = (args.length > 0 ? args[0] : "");
|
||||
String last = (args.length > 0 ? args[args.length - 1] : "");
|
||||
String base = (args.length > 0 ? args[0] : "").toLowerCase();
|
||||
String last = (args.length > 0 ? args[args.length - 1] : "").toLowerCase();
|
||||
|
||||
// If the player is in a convo (Setup Mode), bail
|
||||
if (sender instanceof Conversable && ((Conversable) sender).isConversing()) {
|
||||
|
||||
Reference in New Issue
Block a user