Overhauled ShopSellEvent API

This commit is contained in:
Auxilor
2022-11-24 23:19:03 +00:00
parent 18d882dac6
commit ffaee137d8
5 changed files with 62 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ package com.willfp.eco.internal.spigot.integrations.shop
import com.willfp.eco.core.integrations.shop.ShopIntegration
import com.willfp.eco.core.integrations.shop.ShopSellEvent
import com.willfp.eco.core.price.impl.PriceEconomy
import dev.norska.dsw.api.DeluxeSellwandSellEvent
import org.bukkit.Bukkit
import org.bukkit.event.EventHandler
@@ -19,9 +20,9 @@ class ShopDeluxeSellwands : ShopIntegration {
return
}
val ecoEvent = ShopSellEvent(event.player, event.money, null)
val ecoEvent = ShopSellEvent(event.player, PriceEconomy(event.money), null)
Bukkit.getPluginManager().callEvent(ecoEvent)
event.money = ecoEvent.price
event.money = ecoEvent.value.getValue(event.player)
}
}

View File

@@ -34,9 +34,9 @@ class ShopEconomyShopGUI : ShopIntegration {
return
}
val ecoEvent = ShopSellEvent(event.player, event.price, event.itemStack)
val ecoEvent = ShopSellEvent(event.player, PriceEconomy(event.price), event.itemStack)
Bukkit.getPluginManager().callEvent(ecoEvent)
event.price = ecoEvent.price
event.price = ecoEvent.value.getValue(event.player)
}
}

View File

@@ -63,9 +63,9 @@ class ShopShopGuiPlus : ShopIntegration {
return
}
val ecoEvent = ShopSellEvent(event.player, event.price, event.shopItem.item)
val ecoEvent = ShopSellEvent(event.player, PriceEconomy(event.price), event.shopItem.item)
Bukkit.getPluginManager().callEvent(ecoEvent)
event.price = ecoEvent.price
event.price = ecoEvent.value.getValue(event.player)
}
}

View File

@@ -2,6 +2,7 @@ package com.willfp.eco.internal.spigot.integrations.shop
import com.willfp.eco.core.integrations.shop.ShopIntegration
import com.willfp.eco.core.integrations.shop.ShopSellEvent
import com.willfp.eco.core.price.impl.PriceEconomy
import fr.maxlego08.shop.api.events.ZShopSellEvent
import org.bukkit.Bukkit
import org.bukkit.event.EventHandler
@@ -19,9 +20,9 @@ class ShopZShop : ShopIntegration {
return
}
val ecoEvent = ShopSellEvent(event.player, event.price, event.button.itemStack)
val ecoEvent = ShopSellEvent(event.player, PriceEconomy(event.price), event.button.itemStack)
Bukkit.getPluginManager().callEvent(ecoEvent)
event.price = ecoEvent.price
event.price = ecoEvent.value.getValue(event.player)
}
}