diff --git a/paper-api/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/paper-api/src/main/java/org/bukkit/command/FormattedCommandAlias.java index 84199292dc..40de5e2f5d 100644 --- a/paper-api/src/main/java/org/bukkit/command/FormattedCommandAlias.java +++ b/paper-api/src/main/java/org/bukkit/command/FormattedCommandAlias.java @@ -48,7 +48,6 @@ public class FormattedCommandAlias extends Command { } else { sender.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); } - Bukkit.getLogger().log(Level.WARNING, "Failed to parse command alias " + commandLabel + ": " + formatString, throwable); return false; } } diff --git a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java index 3f651de317..4bf79988e8 100644 --- a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -257,6 +257,11 @@ public class SimpleCommandMap implements CommandMap { Map values = server.getCommandAliases(); for (String alias : values.keySet()) { + if (alias.contains(":") || alias.contains(" ")) { + server.getLogger().warning("Could not register alias " + alias + " because it contains illegal characters"); + continue; + } + String[] commandStrings = values.get(alias); List targets = new ArrayList(); StringBuilder bad = new StringBuilder(); @@ -275,16 +280,17 @@ public class SimpleCommandMap implements CommandMap { } } + if (bad.length() > 0) { + server.getLogger().warning("Could not register alias " + alias + " because it contains commands that do not exist: " + bad); + continue; + } + // We register these as commands so they have absolute priority. if (targets.size() > 0) { knownCommands.put(alias.toLowerCase(), new FormattedCommandAlias(alias.toLowerCase(), targets.toArray(new String[targets.size()]))); } else { knownCommands.remove(alias.toLowerCase()); } - - if (bad.length() > 0) { - server.getLogger().warning("The following command(s) could not be aliased under '" + alias + "' because they do not exist: " + bad); - } } } }