Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
710cec4bc1 | ||
|
|
fa0ec7d6b0 | ||
|
|
5093799775 | ||
|
|
8535f23ede | ||
|
|
8e09ae7f4c | ||
|
|
bbc2513b40 | ||
|
|
c7f8063a3a | ||
|
|
14b0f1be0c |
@@ -112,6 +112,7 @@ import com.willfp.eco.internal.spigot.integrations.mcmmo.McmmoIntegrationImpl
|
||||
import com.willfp.eco.internal.spigot.integrations.multiverseinventories.MultiverseInventoriesIntegration
|
||||
import com.willfp.eco.internal.spigot.integrations.placeholder.PlaceholderIntegrationPAPI
|
||||
import com.willfp.eco.internal.spigot.integrations.price.PriceFactoryPlayerPoints
|
||||
import com.willfp.eco.internal.spigot.integrations.price.PriceFactoryRoyaleEconomy
|
||||
import com.willfp.eco.internal.spigot.integrations.price.PriceFactoryUltraEconomy
|
||||
import com.willfp.eco.internal.spigot.integrations.shop.ShopDeluxeSellwands
|
||||
import com.willfp.eco.internal.spigot.integrations.shop.ShopEconomyShopGUI
|
||||
@@ -127,6 +128,7 @@ import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapedCraftingRecipe
|
||||
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapelessCraftingRecipeStackHandler
|
||||
import com.willfp.eco.util.ClassUtils
|
||||
import me.TechsCode.UltraEconomy.UltraEconomy
|
||||
import me.qKing12.RoyaleEconomy.MultiCurrency.MultiCurrencyHandler
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences
|
||||
import net.milkbowl.vault.economy.Economy
|
||||
import org.bukkit.Bukkit
|
||||
@@ -358,6 +360,11 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
}
|
||||
},
|
||||
IntegrationLoader("PlayerPoints") { Prices.registerPriceFactory(PriceFactoryPlayerPoints()) },
|
||||
IntegrationLoader("RoyaleEconomy") {
|
||||
for (currency in MultiCurrencyHandler.getCurrencies()) {
|
||||
Prices.registerPriceFactory(PriceFactoryRoyaleEconomy(currency))
|
||||
}
|
||||
},
|
||||
|
||||
// Placeholder
|
||||
IntegrationLoader("PlaceholderAPI") { PlaceholderManager.addIntegration(PlaceholderIntegrationPAPI()) },
|
||||
|
||||
@@ -27,7 +27,8 @@ class AntigriefPvPManager: AntigriefIntegration {
|
||||
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
|
||||
return when(victim) {
|
||||
is Player -> {
|
||||
(PvPlayer.get(victim).isInCombat)}
|
||||
val defender = PvPlayer.get(victim)
|
||||
(defender.hasPvPEnabled() && !defender.isNewbie || defender.isInCombat)}
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.willfp.eco.internal.spigot.integrations.price
|
||||
|
||||
import com.willfp.eco.core.placeholder.context.PlaceholderContext
|
||||
import com.willfp.eco.core.placeholder.context.PlaceholderContextSupplier
|
||||
import com.willfp.eco.core.price.Price
|
||||
import com.willfp.eco.core.price.PriceFactory
|
||||
import com.willfp.eco.util.toSingletonList
|
||||
import me.qKing12.RoyaleEconomy.MultiCurrency.Currency
|
||||
import org.bukkit.entity.Player
|
||||
import java.util.*
|
||||
|
||||
class PriceFactoryRoyaleEconomy(private val currency: Currency) : PriceFactory {
|
||||
|
||||
override fun getNames(): List<String> {
|
||||
return currency.currencyId.lowercase().toSingletonList()
|
||||
}
|
||||
|
||||
override fun create(baseContext: PlaceholderContext, function: PlaceholderContextSupplier<Double>): Price {
|
||||
return PriceRoyaleEconomy(currency, baseContext) { function.get(it) }
|
||||
}
|
||||
|
||||
private class PriceRoyaleEconomy(
|
||||
private val currency: Currency,
|
||||
private val baseContext: PlaceholderContext,
|
||||
private val function: (PlaceholderContext) -> Double
|
||||
) : Price {
|
||||
private val multipliers = mutableMapOf<UUID, Double>()
|
||||
|
||||
override fun canAfford(player: Player, multiplier: Double): Boolean {
|
||||
return currency.getAmount(player.uniqueId.toString()) >= getValue(player, multiplier)
|
||||
}
|
||||
|
||||
override fun pay(player: Player, multiplier: Double) {
|
||||
currency.removeAmount(player.uniqueId.toString(), getValue(player, multiplier))
|
||||
}
|
||||
|
||||
override fun giveTo(player: Player, multiplier: Double) {
|
||||
currency.addAmount(player.uniqueId.toString(), getValue(player, multiplier))
|
||||
}
|
||||
|
||||
override fun getValue(player: Player, multiplier: Double): Double {
|
||||
return function(baseContext.copyWithPlayer(player)) * getMultiplier(player) * multiplier
|
||||
}
|
||||
|
||||
override fun getMultiplier(player: Player): Double {
|
||||
return multipliers[player.uniqueId] ?: 1.0
|
||||
}
|
||||
|
||||
override fun setMultiplier(player: Player, multiplier: Double) {
|
||||
multipliers[player.uniqueId] = multiplier
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -194,5 +194,9 @@ dependencies:
|
||||
bootstrap: false
|
||||
|
||||
- name: Denizen
|
||||
required: false
|
||||
bootstrap: false
|
||||
|
||||
- name: RoyaleEconomy
|
||||
required: false
|
||||
bootstrap: false
|
||||
@@ -54,3 +54,4 @@ softdepend:
|
||||
- UltraEconomy
|
||||
- PlayerPoints
|
||||
- Denizen
|
||||
- RoyaleEconomy
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.60.3
|
||||
version = 6.60.4
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
BIN
lib/RoyaleEconomyAPI.jar
Normal file
BIN
lib/RoyaleEconomyAPI.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user