mirror of
https://github.com/aikar/commands.git
synced 2026-06-10 10:17:35 +00:00
Fix Command Replacements not being applied correctly to aliases - fixes #37
This commit is contained in:
@@ -112,12 +112,13 @@ public class BaseCommand extends Command {
|
||||
void onRegister(CommandManager manager, String cmd) {
|
||||
this.manager = manager;
|
||||
final Class<? extends BaseCommand> self = this.getClass();
|
||||
CommandAlias rootCmdAlias = self.getAnnotation(CommandAlias.class);
|
||||
CommandAlias rootCmdAliasAnno = self.getAnnotation(CommandAlias.class);
|
||||
String rootCmdAlias = rootCmdAliasAnno != null ? manager.getCommandReplacements().replace(rootCmdAliasAnno.value()).toLowerCase() : null;
|
||||
if (cmd == null) {
|
||||
if (rootCmdAlias == null) {
|
||||
cmd = "__" + self.getSimpleName();
|
||||
} else {
|
||||
cmd = ACFPatterns.PIPE.split(manager.getCommandReplacements().replace(rootCmdAlias.value()))[0];
|
||||
cmd = ACFPatterns.PIPE.split(rootCmdAlias)[0];
|
||||
}
|
||||
cmd = cmd.toLowerCase();
|
||||
try {
|
||||
@@ -185,7 +186,7 @@ public class BaseCommand extends Command {
|
||||
|
||||
if (rootCmdAlias != null) {
|
||||
Set<String> cmdList = new HashSet<>();
|
||||
Collections.addAll(cmdList, ACFPatterns.PIPE.split(rootCmdAlias.value().toLowerCase()));
|
||||
Collections.addAll(cmdList, ACFPatterns.PIPE.split(rootCmdAlias));
|
||||
cmdList.remove(cmd);
|
||||
for (String cmdAlias : cmdList) {
|
||||
register(cmdAlias, this);
|
||||
|
||||
Reference in New Issue
Block a user