mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-16 12:43:52 -07:00
Fixed 'bad aliases' error output.
By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
@@ -152,7 +152,7 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
|
|
||||||
public void registerServerAliases() {
|
public void registerServerAliases() {
|
||||||
Map<String, String[]> values = server.getCommandAliases();
|
Map<String, String[]> values = server.getCommandAliases();
|
||||||
|
|
||||||
for (String alias : values.keySet()) {
|
for (String alias : values.keySet()) {
|
||||||
String[] targetNames = values.get(alias);
|
String[] targetNames = values.get(alias);
|
||||||
List<Command> targets = new ArrayList<Command>();
|
List<Command> targets = new ArrayList<Command>();
|
||||||
@@ -162,16 +162,14 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
Command command = getCommand(name);
|
Command command = getCommand(name);
|
||||||
|
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
if (bad.length() > 0) {
|
bad += name + ", ";
|
||||||
bad += ", ";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
targets.add(command);
|
targets.add(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We register these as commands so they have absolute priority.
|
// We register these as commands so they have absolute priority.
|
||||||
|
|
||||||
if (targets.size() > 0) {
|
if (targets.size() > 0) {
|
||||||
knownCommands.put(alias.toLowerCase(), new MultipleCommandAlias(alias.toLowerCase(), targets.toArray(new Command[0])));
|
knownCommands.put(alias.toLowerCase(), new MultipleCommandAlias(alias.toLowerCase(), targets.toArray(new Command[0])));
|
||||||
} else {
|
} else {
|
||||||
@@ -179,6 +177,7 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bad.length() > 0) {
|
if (bad.length() > 0) {
|
||||||
|
bad = bad.substring(0, bad.length() - 2);
|
||||||
server.getLogger().warning("The following command(s) could not be aliased under '" + alias + "' because they do not exist: " + bad);
|
server.getLogger().warning("The following command(s) could not be aliased under '" + alias + "' because they do not exist: " + bad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user