Skip to content

Commit

Permalink
Merge pull request #35 from Misat11/fix/sbw-trap-compatibility
Browse files Browse the repository at this point in the history
fix: fix support for SBW Trap Special Item
  • Loading branch information
boiscljo authored Nov 11, 2023
2 parents da1c6ca + ebc7f6c commit b35af0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ public Map.Entry<Boolean, Boolean> 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);
Expand Down
31 changes: 11 additions & 20 deletions plugin/src/main/resources/shops/shop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b35af0f

Please sign in to comment.