Added scyther integration and BigDecimal economy support

This commit is contained in:
Auxilor
2022-09-14 13:45:32 +01:00
parent b1158ceb3d
commit c2d2303c91
7 changed files with 99 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ dependencies {
compileOnly 'com.wolfyscript.wolfyutilities:wolfyutilities:3.16.0.0'
compileOnly 'com.github.decentsoftware-eu:decentholograms:2.1.2'
compileOnly 'com.github.Gypopo:EconomyShopGUI-API:1.1.0'
compileOnly 'com.github.N0RSKA:ScytherAPI:55a'
// MythicMobs
compileOnly 'io.lumine:Mythic:5.0.1'

View File

@@ -101,6 +101,7 @@ import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsHeadDa
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemsAdder
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsMythicMobs
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsOraxen
import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsScyther
import com.willfp.eco.internal.spigot.integrations.customrecipes.CustomRecipeCustomCrafting
import com.willfp.eco.internal.spigot.integrations.economy.EconomyVault
import com.willfp.eco.internal.spigot.integrations.hologram.HologramCMI
@@ -313,6 +314,7 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
CraftingRecipeListener.registerValidator(CustomRecipeCustomCrafting())
},
IntegrationLoader("MythicMobs") { CustomItemsManager.register(CustomItemsMythicMobs(this)) },
IntegrationLoader("Scyther") { CustomItemsManager.register(CustomItemsScyther()) },
// Shop
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },

View File

@@ -0,0 +1,48 @@
package com.willfp.eco.internal.spigot.integrations.customitems
import com.willfp.eco.core.integrations.customitems.CustomItemsIntegration
import com.willfp.eco.core.items.CustomItem
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.TestableItem
import com.willfp.eco.core.items.provider.ItemProvider
import com.willfp.eco.util.NamespacedKeyUtils
import dev.norska.scyther.Scyther
import dev.norska.scyther.api.ScytherAPI
import org.bukkit.Material
class CustomItemsScyther : CustomItemsIntegration {
override fun registerProvider() {
Items.registerItemProvider(ScytherProvider())
}
override fun getPluginName(): String {
return "Scyther"
}
private class ScytherProvider : ItemProvider("scyther") {
override fun provideForKey(key: String): TestableItem? {
val material = Material.matchMaterial(key.uppercase()) ?: Material.WOODEN_HOE
val hoe = ScytherAPI.createHarvesterHoe(
Scyther.getInstance(),
material,
0,
null,
1,
Int.MAX_VALUE,
null,
null
)
val namespacedKey = NamespacedKeyUtils.create("scyther", key)
return CustomItem(
namespacedKey,
{
ScytherAPI.isHarvesterItem(it) && it.type == material
},
hoe
)
}
}
}

View File

@@ -46,4 +46,5 @@ softdepend:
- RPGHorses
- EconomyShopGUI
- zShop
- DeluxeSellwands
- DeluxeSellwands
- Scyther