diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 9ca1b04d..7c999b72 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -649,12 +649,13 @@ public class PlayerManager { return; for (JobCommands command : job.getCommands()) { if (newLevel >= command.getLevelFrom() && newLevel <= command.getLevelUntil()) { - String commandString = command.getCommand(); - commandString = commandString.replace("[player]", player.getName()); - commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel)); - commandString = commandString.replace("[newlevel]", String.valueOf(newLevel)); - commandString = commandString.replace("[jobname]", job.getName()); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), commandString); + for (String commandString : new ArrayList(command.getCommands())) { + commandString = commandString.replace("[player]", player.getName()); + commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel)); + commandString = commandString.replace("[newlevel]", String.valueOf(newLevel)); + commandString = commandString.replace("[jobname]", job.getName()); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), commandString); + } } } } diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 22f6046c..3a9c1c6b 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -618,10 +618,14 @@ public class ConfigManager { Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid command key" + commandKey + "!"); continue; } - String command = commandSection.getString("command"); + List commands = new ArrayList(); + if (commandSection.isString("command")) + commands.add(commandSection.getString("command")); + else if (commandSection.isList("command")) + commands.addAll(commandSection.getStringList("command")); int levelFrom = commandSection.getInt("levelFrom"); int levelUntil = commandSection.getInt("levelUntil"); - jobCommand.add(new JobCommands(node, command, levelFrom, levelUntil)); + jobCommand.add(new JobCommands(node, commands, levelFrom, levelUntil)); } } diff --git a/src/main/java/com/gamingmesh/jobs/container/JobCommands.java b/src/main/java/com/gamingmesh/jobs/container/JobCommands.java index de623e3f..db4cad0f 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobCommands.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobCommands.java @@ -18,31 +18,48 @@ package com.gamingmesh.jobs.container; +import java.util.ArrayList; +import java.util.List; + public class JobCommands { private String node; - private String command; + private List commands = new ArrayList(); private int levelFrom; private int levelUntil; + + @Deprecated public JobCommands(String node, String command, int levelFrom, int levelUntil) { - this.node = node; - this.command = command; - this.levelFrom = levelFrom; - this.levelUntil = levelUntil; + this.node = node; + this.commands.add(command); + this.levelFrom = levelFrom; + this.levelUntil = levelUntil; } - + + public JobCommands(String node, List commands, int levelFrom, int levelUntil) { + this.node = node; + this.commands.addAll(commands); + this.levelFrom = levelFrom; + this.levelUntil = levelUntil; + } + public String getNode() { - return node; + return node; } - + + @Deprecated public String getCommand() { - return command; + return commands.isEmpty() ? "" : commands.get(0); } - + + public List getCommands() { + return commands; + } + public int getLevelFrom() { - return levelFrom; + return levelFrom; } - + public int getLevelUntil() { - return levelUntil; + return levelUntil; } } diff --git a/src/main/java/jobConfig.yml b/src/main/java/jobConfig.yml index df2718fd..50cee149 100644 --- a/src/main/java/jobConfig.yml +++ b/src/main/java/jobConfig.yml @@ -454,6 +454,7 @@ Jobs: fly: # Command its self, this will be executed from console, so all commands should work # Possible variables are: [player] [jobname] [oldlevel] [newlevel] + # can be one or multiple lines command: manuaddp [player] essentials.fly # When to execute this command first time levelFrom: 100 @@ -461,7 +462,9 @@ Jobs: # This can be set to same level as levelFrom, so this command will be executed only once levelUntil: 100 kit: - command: manuaddp [player] essentials.kits.woodcutter + command: + - manuaddp [player] essentials.kits.woodcutter + - manuaddp [player] essentials.fly levelFrom: 150 levelUntil: 150 # Getting more money when equiped with specific weapon/tool ar wearing armor