Andrew Yunt
Andrew Yunt

Reputation: 39

Dispatching a list of commands

I am trying to create a configuration file with a list of commands that my program will run on a event. It is a string list and the method to get it is getConfig().getStringList(). I am trying to put this inside Bukkit.getServer().dispatchCommand(command_goes_here); How could I get the list of strings (commands) and execute them all?

Upvotes: 0

Views: 151

Answers (1)

August
August

Reputation: 12558

Try something along these lines.

@EventHandler
public void onEvent(SomeEvent e) {
    for(String command : thePlugin.getConfig().getStringList(configPath)) {
        Bukkit.dispatchCommand(someCommandSender, command)  
    }
}

I can't be very specific, as your question isn't either.

Upvotes: 1

Related Questions