Skip to content

Commit 66fd2eb

Browse files
committed
Fix failing tests
1 parent 3d00ee0 commit 66fd2eb

File tree

1 file changed

+6
-4
lines changed
  • commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi

1 file changed

+6
-4
lines changed

commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/CommandAPIBukkit.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ private String generateCommandHelpPrefix(String command) {
299299
return (Bukkit.getPluginCommand(command) == null ? "/" : "/minecraft:") + command;
300300
}
301301

302+
private String generateCommandHelpPrefix(String command, String namespace) {
303+
return (Bukkit.getPluginCommand(command) == null ? "/" + namespace + ":" : "/minecraft:") + command;
304+
}
305+
302306
private void generateHelpUsage(StringBuilder sb, RegisteredCommand command) {
303307
// Generate usages
304308
String[] usages = getUsageList(command);
@@ -361,8 +365,7 @@ void updateHelpForCommands(List<RegisteredCommand> commands) {
361365
String commandPrefix = generateCommandHelpPrefix(command.commandName());
362366

363367
// Namespaced commands shouldn't have a help topic, we should save the namespaced command name
364-
commandPrefix = commandPrefix.substring(1); // Get rid of the '/' for the namespaced command
365-
namespacedCommandNames.add("/" + command.namespace() + ":" + commandPrefix); // Bukkit it stupid, it registers commands with a '/' in the help map
368+
namespacedCommandNames.add(generateCommandHelpPrefix(command.commandName(), command.namespace()));
366369

367370
StringBuilder aliasSb = new StringBuilder();
368371
final String shortDescription;
@@ -426,8 +429,7 @@ void updateHelpForCommands(List<RegisteredCommand> commands) {
426429
helpTopic = generateHelpTopic(commandPrefix, shortDescription, currentAliasSb.toString().trim(), permission);
427430

428431
// Namespaced commands shouldn't have a help topic, we should save the namespaced alias name
429-
commandPrefix = commandPrefix.substring(1); // Get rid of the '/' for the namespaced command
430-
namespacedCommandNames.add("/" + command.namespace() + ":" + commandPrefix); // Bukkit it stupid, it registers commands with a '/' in the help map
432+
namespacedCommandNames.add(generateCommandHelpPrefix(alias, command.namespace()));
431433
}
432434
helpTopicsToAdd.put(commandPrefix, helpTopic);
433435
}

0 commit comments

Comments
 (0)