Lookup command correctly in /vsu ci
This commit is contained in:
parent
13d27e81dd
commit
6c5c298195
2 changed files with 14 additions and 1 deletions
|
|
@ -260,7 +260,7 @@ public class CommandServerUtils extends BaseCommand {
|
|||
FormatBuilder builder = FormatBuilder.create(format)
|
||||
.orderedKeys("%key%", "%value%")
|
||||
.add("Name", node.getName())
|
||||
.add("Plugin", "<UNKNOWN>"); // TODO: fix plugin command
|
||||
.add("Plugin", plugin.getPluginCommandManager().findPluginId(command).orElse("<UNKNOWN>"));
|
||||
|
||||
builder.sendTo(sender);
|
||||
Messenger.sendMessage(sender, "serverutils.commandinfo.footer");
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import java.nio.file.Path;
|
|||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class VelocityPluginCommandManager {
|
||||
|
||||
|
|
@ -41,6 +42,18 @@ public class VelocityPluginCommandManager {
|
|||
return manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to find the plugin id for a given command alias.
|
||||
*/
|
||||
public Optional<String> findPluginId(String alias) {
|
||||
for (Map.Entry<String, String> entry : pluginCommands.entries()) {
|
||||
if (alias.equals(entry.getValue())) {
|
||||
return Optional.of(entry.getKey());
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Multimap<String, String> getPluginCommands() {
|
||||
return pluginCommands;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue