From ebc7f6c643b4797afc4a75268904612388105b78 Mon Sep 17 00:00:00 2001 From: Misat11 <20199703+Misat11@users.noreply.github.com> Date: Sat, 11 Nov 2023 13:41:35 +0100 Subject: [PATCH] fix: fix support for SBW Trap Special Item --- .../sba/inventories/SBAStoreInventoryV2.java | 7 +++++ plugin/src/main/resources/shops/shop.yml | 31 +++++++------------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java b/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java index 8ae5349e..a8382041 100644 --- a/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java +++ b/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java @@ -197,6 +197,13 @@ public Map.Entry handlePurchase(Player player, AtomicReference // if (upgradeProperties.contains(propertyName)) { switch (propertyName) { case "trap": + if (!property.getPropertyData().hasChild("identifier") && property.getPropertyData().hasChild("data")) { // Fix support for SBW Trap special item + var applyEvent = new BedwarsApplyPropertyToItem(game, player, newItem.get(), propertyData); + SBA.getPluginInstance().getServer().getPluginManager().callEvent(applyEvent); + newItem.set(applyEvent.getStack()); + return Map.entry(true, true); + } + String trap_identifier = property.getPropertyData().childrenMap().get("identifier").getString(); if (gameStorage.areTrapEnabled(team, trap_identifier)) { messageOnFail.set(MessageKeys.WAIT_FOR_TRAP); diff --git a/plugin/src/main/resources/shops/shop.yml b/plugin/src/main/resources/shops/shop.yml index 59c8d016..ae2d3411 100644 --- a/plugin/src/main/resources/shops/shop.yml +++ b/plugin/src/main/resources/shops/shop.yml @@ -202,10 +202,7 @@ data: stack: type: POTION display-name: "§rPotion of Healing I" - meta: - ==: ItemMeta - meta-type: POTION - potion-type: healing + potion-type: healing price: 1 of emerald - row: 3 @@ -258,29 +255,26 @@ data: data: - sound: ENTITY_SHEEP_AMBIENT - effect: - ==: org.bukkit.potion.PotionEffect - effect: 15 + effect: blindness amplifier: 2 duration: 100 ambient: true - has-particles: true - has-icon: true + particles: true + icon: true - effect: - ==: org.bukkit.potion.PotionEffect - effect: 18 + effect: weakness amplifier: 2 duration: 100 ambient: true - has-particles: true - has-icon: true + particles: true + icon: true - effect: - ==: org.bukkit.potion.PotionEffect - effect: 2 + effect: slowness amplifier: 2 duration: 100 ambient: true - has-particles: true - has-icon: true + particles: true + icon: true stack: type: STRING display-name: "Trap" @@ -381,10 +375,7 @@ data: stack: type: POTION display-name: "§rPotion of Healing I" - meta: - ==: ItemMeta - meta-type: POTION - potion-type: healing + potion-type: healing - stack: TNT;1 price: 4 of gold