diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/Command.java b/api/src/main/java/net/md_5/bungee/api/plugin/Command.java index 9f5d088f3..d58431d16 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/Command.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/Command.java @@ -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; diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java index cfcc72f09..feb124c8d 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java @@ -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;