From ceaf4d34a5f62df7588456fdca0927326f66033a Mon Sep 17 00:00:00 2001 From: 0ft3n Date: Mon, 27 Feb 2023 22:13:02 +0300 Subject: [PATCH] Yet another economyshopgui fix --- .../integrations/shop/ShopEconomyShopGUI.kt | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/shop/ShopEconomyShopGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/shop/ShopEconomyShopGUI.kt index a212c6fda..5b914b6e7 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/shop/ShopEconomyShopGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/shop/ShopEconomyShopGUI.kt @@ -35,23 +35,9 @@ class ShopEconomyShopGUI : ShopIntegration { } object EconomyShopGUISellEventListeners : Listener { - private val sellTypes = listOf( - "SELL_GUI_SCREEN", - "SELL_SCREEN", - "SELL_ALL_SCREEN", - "SELL_ALL_COMMAND", - "QUICK_SELL", - "AUTO_SELL_CHEST", - ) - - private val sellAllTypes = listOf( - "SELL_GUI_SCREEN", - "SELL_ALL_COMMAND", - ) - @EventHandler fun shopEventToEcoEvent(event: PreTransactionEvent) { - if (event.transactionType.name.uppercase() !in sellTypes) { + if (!event.transactionType.mode.equals(Transaction.Mode.SELL.name, true)) { return } @@ -59,11 +45,7 @@ class ShopEconomyShopGUI : ShopIntegration { return } - val prices = if (event.transactionType.name.uppercase() in sellAllTypes) { - event.items!! - } else { - mapOf(event.shopItem to event.amount) - } + val prices = event.items ?: mapOf(event.shopItem to event.amount) var total = 0.0 @@ -83,4 +65,4 @@ class ShopEconomyShopGUI : ShopIntegration { override fun getPluginName(): String { return "EconomyShopGUI" } -} \ No newline at end of file +}