mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-11-25 12:05:56 +01:00
Add zShop integration
This commit is contained in:
parent
e327644f4d
commit
54b54b989a
@ -132,6 +132,7 @@ allprojects {
|
||||
implementation("com.zaxxer:HikariCP:5.1.0")
|
||||
implementation("org.bstats:bstats-bukkit:3.0.2")
|
||||
compileOnly 'org.black_ixx:playerpoints:3.2.6'
|
||||
compileOnly 'com.github.Maxlego08:zShop-API:3.0.5'
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
|
@ -16,6 +16,7 @@ import com.artillexstudios.axminions.integrations.prices.CMIIntegration
|
||||
import com.artillexstudios.axminions.integrations.prices.EconomyShopGUIIntegration
|
||||
import com.artillexstudios.axminions.integrations.prices.EssentialsIntegration
|
||||
import com.artillexstudios.axminions.integrations.prices.ShopGUIPlusIntegration
|
||||
import com.artillexstudios.axminions.integrations.prices.ZShopIntegration
|
||||
import com.artillexstudios.axminions.integrations.protection.BentoBoxIntegration
|
||||
import com.artillexstudios.axminions.integrations.protection.GriefPreventionIntegration
|
||||
import com.artillexstudios.axminions.integrations.protection.IridiumSkyBlockIntegration
|
||||
@ -102,6 +103,12 @@ class Integrations : Integrations {
|
||||
Bukkit.getConsoleSender()
|
||||
.sendMessage(StringUtils.formatToString("<#33FF33>[AxMinions] Hooked into EconomyShopGUI!"))}
|
||||
}
|
||||
|
||||
"zshop" -> {
|
||||
if (isPluginLoaded("zShop")) {
|
||||
register(ZShopIntegration())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
when (Config.ECONOMY_HOOK().lowercase(Locale.ENGLISH)) {
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.artillexstudios.axminions.integrations.prices
|
||||
|
||||
import com.artillexstudios.axminions.api.integrations.types.PricesIntegration
|
||||
import fr.maxlego08.zshop.api.ShopManager
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
class ZShopIntegration : PricesIntegration {
|
||||
private var shopManager: ShopManager? = null
|
||||
|
||||
override fun getPrice(itemStack: ItemStack): Double {
|
||||
val button = shopManager?.getItemButton(itemStack.type)
|
||||
return button?.map { itemButton -> itemButton.getSellPrice(itemStack.amount) }?.orElse(0.0) ?: 0.0
|
||||
}
|
||||
|
||||
override fun register() {
|
||||
val rsp = Bukkit.getServer().servicesManager.getRegistration(
|
||||
ShopManager::class.java
|
||||
)
|
||||
shopManager = rsp!!.provider
|
||||
}
|
||||
}
|
@ -21,4 +21,5 @@ softdepend:
|
||||
- PlotSquared
|
||||
- KGenerators
|
||||
- Towny
|
||||
- ItemsAdder
|
||||
- ItemsAdder
|
||||
- zShop
|
Loading…
Reference in New Issue
Block a user