Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main/java/ch/njol/skript/command/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ public static boolean scriptCommandExists(String command) {

public static void registerCommand(ScriptCommand command) {
// Validate that there are no duplicates
ScriptCommand existingCommand = commands.get(command.getLabel());
if (existingCommand != null && existingCommand.getLabel().equals(command.getLabel())) {
ScriptCommand existingCommand = commands.get(command.getName());
if (existingCommand != null && existingCommand.getName().equals(command.getName())) {
Script script = existingCommand.getScript();
Skript.error("A command with the name /" + existingCommand.getName() + " is already defined"
+ (script != null ? (" in " + script.getConfig().getFileName()) : "")
Expand All @@ -244,11 +244,10 @@ public static void registerCommand(ScriptCommand command) {
assert cmKnownCommands != null;// && cmAliases != null;
command.register(commandMap, cmKnownCommands, cmAliases);
}
commands.put(command.getLabel(), command);
for (String alias : command.getActiveAliases()) {
commands.put(command.getName(), command);
for (String alias : command.getAliases()) {
commands.put(alias.toLowerCase(Locale.ENGLISH), command);
}
command.registerHelp();
}

@Deprecated(since = "2.7.0", forRemoval = true)
Expand All @@ -264,7 +263,6 @@ public static int unregisterCommands(File script) {
}

public static void unregisterCommand(ScriptCommand scriptCommand) {
scriptCommand.unregisterHelp();
if (commandMap != null) {
assert cmKnownCommands != null;// && cmAliases != null;
scriptCommand.unregister(commandMap, cmKnownCommands, cmAliases);
Expand Down
Loading
Loading