Fixes a problem with the %clicker% tag for use with sign commands

With the previous implementation it would only get replaced for commands
executed as the player, but executing as player is not wanted because
then the player should have permission for that (example: /tellraw). Now
it will properly get replaced for console and player commands attached
to a state of the sign.
This commit is contained in:
Thijs Wiefferink 2014-11-25 16:47:10 +01:00
parent 09af826f88
commit ed1f73fdd7

View File

@ -1922,12 +1922,18 @@ public abstract class GeneralRegion {
}
// Run player commands if specified
String playerPath = "signProfiles." + profile + "." + getState().getValue().toLowerCase() + "." + clickType.getValue() + "Player";
List<String> playerCommands = plugin.getConfig().getStringList(playerPath);
List<String> playerCommands = new ArrayList<String>();
for(String command : plugin.getConfig().getStringList(playerPath)) {
playerCommands.add(command.replace(AreaShop.tagClicker, clicker.getName()));
}
runCommands(clicker, playerCommands);
// Run console commands if specified
String consolePath = "signProfiles." + profile + "." + getState().getValue().toLowerCase() + "." + clickType.getValue() + "Console";
List<String> consoleCommands = plugin.getConfig().getStringList(consolePath);
List<String> consoleCommands = new ArrayList<String>();
for(String command : plugin.getConfig().getStringList(consolePath)) {
consoleCommands.add(command.replace(AreaShop.tagClicker, clicker.getName()));
}
runCommands(Bukkit.getConsoleSender(), consoleCommands);
return !playerCommands.isEmpty() || !consoleCommands.isEmpty();