Case insensitive commands

This commit is contained in:
md_5 2013-02-06 17:41:20 +11:00
parent a2ebb92d56
commit bd39fad41b
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package net.md_5.bungee.api.plugin;
import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@ -37,6 +38,7 @@ public abstract class Command
*/
public Command(String name, String permission, String... aliases)
{
Preconditions.checkArgument(name != null, "name");
this.name = name;
this.permission = permission;
this.aliases = aliases;

View File

@ -41,7 +41,7 @@ public class PluginManager
*/
public void registerCommand(Command command)
{
commandMap.put(command.getName(), command);
commandMap.put(command.getName().toLowerCase(), command);
for (String alias : command.getAliases())
{
commandMap.put(alias, command);
@ -69,7 +69,7 @@ public class PluginManager
public boolean dispatchCommand(CommandSender sender, String commandLine)
{
String[] split = argsSplit.split(commandLine);
Command command = commandMap.get(split[0]);
Command command = commandMap.get(split[0].toLowerCase());
if (command == null)
{
return false;