Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29ce0deb1b | ||
|
|
fd78402bf5 | ||
|
|
5f65e3f520 | ||
|
|
ceaf4d34a5 | ||
|
|
2d2e5f8150 | ||
|
|
323a4aefef |
@@ -2,6 +2,27 @@
|
||||
|
||||
package com.willfp.eco.core.map
|
||||
|
||||
/**
|
||||
* Required to avoid type ambiguity.
|
||||
*
|
||||
* @see ListMap
|
||||
*/
|
||||
@Suppress("RedundantOverride")
|
||||
class MutableListMap<K : Any, V : Any> : ListMap<K, V>() {
|
||||
/**
|
||||
* Override with enforced MutableList type.
|
||||
*/
|
||||
override fun get(key: K?): MutableList<V> =
|
||||
super.get(key)
|
||||
|
||||
/**
|
||||
* Override with enforced MutableList type.
|
||||
*/
|
||||
override fun getOrDefault(key: K, defaultValue: MutableList<V>?): MutableList<V> {
|
||||
return super.getOrDefault(key, defaultValue)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DefaultMap
|
||||
*/
|
||||
@@ -12,7 +33,7 @@ fun <K : Any, V : Any> defaultMap(defaultValue: V) =
|
||||
* @see ListMap
|
||||
*/
|
||||
fun <K : Any, V : Any> listMap() =
|
||||
ListMap<K, V>()
|
||||
MutableListMap<K, V>()
|
||||
|
||||
/**
|
||||
* @see DefaultMap.createNestedMap
|
||||
@@ -24,4 +45,4 @@ fun <K : Any, K1 : Any, V : Any> nestedMap() =
|
||||
* @see DefaultMap.createNestedListMap
|
||||
*/
|
||||
fun <K : Any, K1 : Any, V : Any> nestedListMap() =
|
||||
DefaultMap.createNestedListMap<K, K1, V>()
|
||||
DefaultMap<K, MutableListMap<K1, V>>(MutableListMap())
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.52.0
|
||||
version = 6.52.2
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
Reference in New Issue
Block a user