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:
Andreas Troelsen 2018-12-31 14:47:05 +01:00
parent 74a7388701
commit 7bc6cf2800
3 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,7 @@ These changes will (most likely) be included in the next version.
- Spectators can no longer take damage when the arena isn't running.
- Pets can now teleport back to their owners if they get too far away.
- Enchantment names are now case insensitive (i.e. `FIRE_PROTECTION` is the same as `fire_protection`).
- All commands are now case insensitive. This means that typing `/ma join` is the same as typing `/MA JOIN`. This should help reduce the confusion with commands like `/ma l` where the L can be confused with a 1 (one).
## [0.103] - 2018-08-28
- It is now possible to add a fixed delay (in seconds) between waves with the new per-arena setting `next-wave-delay`.

View File

@ -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;
}

View File

@ -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()) {