Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Feb 27, 2023
2 parents fd78402 + 5f65e3f commit 29ce0de
Showing 1 changed file with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,17 @@ 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
}

if (event.isCancelled) {
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

Expand All @@ -83,4 +65,4 @@ class ShopEconomyShopGUI : ShopIntegration {
override fun getPluginName(): String {
return "EconomyShopGUI"
}
}
}

0 comments on commit 29ce0de

Please sign in to comment.