Skip to content

Commit

Permalink
add tag server.list_commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 30, 2019
1 parent ab313ff commit a1ca71a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Expand Up @@ -27,12 +27,12 @@

public class CommandScriptHelper implements Listener {

private static Map<String, DenizenCommand> denizenCommands = new ConcurrentHashMap<String, DenizenCommand>(8, 0.9f, 1);
private static Map<String, Command> overriddenCommands = new HashMap<String, Command>();
private static Map<String, HelpTopic> overriddenHelpTopics = new HashMap<String, HelpTopic>();
private static Map<String, Command> knownCommands = null;
private static Map<String, HelpTopic> helpTopics = null;
private static boolean hasCommandInformation = true;
public static Map<String, DenizenCommand> denizenCommands = new ConcurrentHashMap<String, DenizenCommand>(8, 0.9f, 1);
public static Map<String, Command> overriddenCommands = new HashMap<String, Command>();
public static Map<String, HelpTopic> overriddenHelpTopics = new HashMap<String, HelpTopic>();
public static Map<String, Command> knownCommands = null;
public static Map<String, HelpTopic> helpTopics = null;
public static boolean hasCommandInformation = true;

public CommandScriptHelper() {
try {
Expand Down
Expand Up @@ -15,6 +15,7 @@
import net.aufdemrand.denizen.scripts.commands.core.SQLCommand;
import net.aufdemrand.denizen.scripts.commands.server.BossBarCommand;
import net.aufdemrand.denizen.scripts.containers.core.AssignmentScriptContainer;
import net.aufdemrand.denizen.scripts.containers.core.CommandScriptHelper;
import net.aufdemrand.denizen.tags.BukkitTagContext;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizen.utilities.ScoreboardHelper;
Expand Down Expand Up @@ -175,6 +176,21 @@ public void serverTag(ReplaceableTagEvent event) {
return;
}

// <--[tag]
// @attribute <server.list_commands>
// @returns dList
// @description
// Returns a list of all registered command names in Bukkit.
// -->
if (attribute.startsWith("list_commands")) {
dList list = new dList();
for (String cmd : CommandScriptHelper.knownCommands.keySet()) {
list.add(cmd);
}
event.setReplaced(list.getAttribute(attribute.fulfill(1)));
return;
}

if (attribute.startsWith("scoreboard")) {
Scoreboard board;
String name = "main";
Expand Down

0 comments on commit a1ca71a

Please sign in to comment.