diff --git a/pom.xml b/pom.xml index caba771..199a8a9 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,11 @@ placeholderapi http://repo.extendedclip.com/content/repositories/placeholderapi/ + + + jitpack.io + https://jitpack.io + @@ -77,6 +82,13 @@ + + + com.github.GiansCode + ActionUtil + a1266cbbc7 + compile + org.projectlombok diff --git a/src/main/java/io/alerium/itemshops/ItemShopsPlugin.java b/src/main/java/io/alerium/itemshops/ItemShopsPlugin.java index 5c49eb0..40bef50 100644 --- a/src/main/java/io/alerium/itemshops/ItemShopsPlugin.java +++ b/src/main/java/io/alerium/itemshops/ItemShopsPlugin.java @@ -9,6 +9,7 @@ import io.alerium.itemshops.shops.ShopManager; import io.alerium.itemshops.utils.commands.Command; import io.alerium.itemshops.utils.configuration.YAMLConfiguration; +import io.samdev.actionutil.ActionUtil; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -27,6 +28,8 @@ public class ItemShopsPlugin extends JavaPlugin { @Getter private CoinsManager coinsManager; @Getter private ShopManager shopManager; + @Getter private ActionUtil actionUtil; + @Override public void onEnable() { long time = System.currentTimeMillis(); @@ -59,6 +62,8 @@ private void registerInstances() { shopManager = new ShopManager(); shopManager.enable(); + + actionUtil = ActionUtil.init(this); } private void registerCommands() { diff --git a/src/main/java/io/alerium/itemshops/shops/objects/shops/ShopItem.java b/src/main/java/io/alerium/itemshops/shops/objects/shops/ShopItem.java index 5312d58..1d8d24f 100644 --- a/src/main/java/io/alerium/itemshops/shops/objects/shops/ShopItem.java +++ b/src/main/java/io/alerium/itemshops/shops/objects/shops/ShopItem.java @@ -35,12 +35,9 @@ public BiConsumer getOnClick() { } for (String command : buyCommands) { - String commandExec = command.substring(command.indexOf("]")).replaceAll("%player%", player.getName()).replaceAll("%cost%", Integer.toString(cost)); + String commandExec = command.replaceAll("%cost%", Integer.toString(cost)); - if (command.startsWith("[CONSOLE]")) - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), commandExec); - else if (command.startsWith("[PLAYER]")) - Bukkit.dispatchCommand(player, commandExec); + ItemShopsPlugin.getInstance().getActionUtil().executeActions(player, commandExec); } if (info instanceof ShopGUI && ((ShopGUI) info).isCloseOnBuy()) diff --git a/src/main/resources/shops/armor.yml b/src/main/resources/shops/armor.yml index aca745c..548fe0a 100644 --- a/src/main/resources/shops/armor.yml +++ b/src/main/resources/shops/armor.yml @@ -29,5 +29,5 @@ items: column: 1 cost: 10 buy-commands: - - '[CONSOLE] kit diamond_armor %player%' - - '[PLAYER] me bought the Diamond Armor set in the /itemshop for %cost% Gold' \ No newline at end of file + - '[CONSOLECOMMAND] kit diamond_armor %player_name%' + - '[PLAYERCOMMAND] me bought the Diamond Armor set in the /itemshop for %cost% Gold' \ No newline at end of file