mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-24 17:47:41 +01:00
Case insensitive commands
This commit is contained in:
parent
a2ebb92d56
commit
bd39fad41b
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user