Merge remote-tracking branch 'origin/master'
# Conflicts: # gradle.properties
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.willfp.eco.internal.data
|
||||
|
||||
import com.willfp.eco.core.data.ExternalDataStoreObjectAdapter
|
||||
import com.willfp.eco.core.version.Version
|
||||
|
||||
object VersionToStringAdapter: ExternalDataStoreObjectAdapter<Version, String>(
|
||||
Version::class.java,
|
||||
String::class.java
|
||||
) {
|
||||
override fun toAccessedObject(obj: String): Version = Version(obj)
|
||||
|
||||
override fun toStoredObject(obj: Version): String = obj.toString()
|
||||
}
|
||||
|
||||
class MavenVersionToStringAdapter(
|
||||
className: String
|
||||
): ExternalDataStoreObjectAdapter<Any, String>(
|
||||
Class.forName(className),
|
||||
String::class.java
|
||||
) {
|
||||
private val constructor = Class.forName(className)
|
||||
.getConstructor(String::class.java)
|
||||
|
||||
override fun toAccessedObject(obj: String): Any = constructor.newInstance(obj)
|
||||
|
||||
override fun toStoredObject(obj: Any): String = obj.toString()
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class SNBTConverter : SNBTConverterProxy {
|
||||
val nms = CraftItemStack.asNMSCopy(itemStack)
|
||||
val nmsTag = nms.save(CompoundTag())
|
||||
nmsTag.remove("Count")
|
||||
return tag.copy().merge(nmsTag) == nmsTag
|
||||
return tag.copy().merge(nmsTag) == nmsTag && itemStack.type == item.type
|
||||
}
|
||||
|
||||
override fun getItem(): ItemStack = item
|
||||
|
||||
@@ -45,7 +45,7 @@ class SNBTConverter : SNBTConverterProxy {
|
||||
val nms = CraftItemStack.asNMSCopy(itemStack)
|
||||
val nmsTag = nms.save(CompoundTag())
|
||||
nmsTag.remove("Count")
|
||||
return tag.copy().merge(nmsTag) == nmsTag
|
||||
return tag.copy().merge(nmsTag) == nmsTag && itemStack.type == item.type
|
||||
}
|
||||
|
||||
override fun getItem(): ItemStack = item
|
||||
|
||||
@@ -45,7 +45,7 @@ class SNBTConverter : SNBTConverterProxy {
|
||||
val nms = CraftItemStack.asNMSCopy(itemStack)
|
||||
val nmsTag = nms.save(CompoundTag())
|
||||
nmsTag.remove("Count")
|
||||
return tag.copy().merge(nmsTag) == nmsTag
|
||||
return tag.copy().merge(nmsTag) == nmsTag && itemStack.type == item.type
|
||||
}
|
||||
|
||||
override fun getItem(): ItemStack = item
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.willfp.eco.internal.spigot.proxy.v1_19_R1
|
||||
import com.willfp.eco.core.items.TestableItem
|
||||
import com.willfp.eco.core.recipe.parts.EmptyTestableItem
|
||||
import com.willfp.eco.internal.spigot.proxy.SNBTConverterProxy
|
||||
import com.willfp.eco.internal.spigot.proxy.common.toMaterial
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.nbt.SnbtPrinterTagVisitor
|
||||
import net.minecraft.nbt.TagParser
|
||||
@@ -44,7 +45,7 @@ class SNBTConverter : SNBTConverterProxy {
|
||||
val nms = CraftItemStack.asNMSCopy(itemStack)
|
||||
val nmsTag = nms.save(CompoundTag())
|
||||
nmsTag.remove("Count")
|
||||
return tag.copy().merge(nmsTag) == nmsTag
|
||||
return tag.copy().merge(nmsTag) == nmsTag && itemStack.type == item.type
|
||||
}
|
||||
|
||||
override fun getItem(): ItemStack = item
|
||||
|
||||
@@ -44,7 +44,7 @@ class SNBTConverter : SNBTConverterProxy {
|
||||
val nms = CraftItemStack.asNMSCopy(itemStack)
|
||||
val nmsTag = nms.save(CompoundTag())
|
||||
nmsTag.remove("Count")
|
||||
return tag.copy().merge(nmsTag) == nmsTag
|
||||
return tag.copy().merge(nmsTag) == nmsTag && itemStack.type == item.type
|
||||
}
|
||||
|
||||
override fun getItem(): ItemStack = item
|
||||
|
||||
@@ -44,7 +44,7 @@ class SNBTConverter : SNBTConverterProxy {
|
||||
val nms = CraftItemStack.asNMSCopy(itemStack)
|
||||
val nmsTag = nms.save(CompoundTag())
|
||||
nmsTag.remove("Count")
|
||||
return tag.copy().merge(nmsTag) == nmsTag
|
||||
return tag.copy().merge(nmsTag) == nmsTag && itemStack.type == item.type
|
||||
}
|
||||
|
||||
override fun getItem(): ItemStack = item
|
||||
|
||||
@@ -37,7 +37,7 @@ dependencies {
|
||||
compileOnly("com.github.jiangdashao:matrix-api-repo:317d4635fd")
|
||||
compileOnly("com.gmail.nossr50.mcMMO:mcMMO:2.1.202")
|
||||
compileOnly("me.clip:placeholderapi:2.10.10")
|
||||
compileOnly("com.github.oraxen:oraxen:bea381fb82")
|
||||
compileOnly("com.github.oraxen:oraxen:1.155.0")
|
||||
compileOnly("com.github.brcdev-minecraft:shopgui-api:3.0.0")
|
||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:2.4.7")
|
||||
compileOnly("com.arcaniax:HeadDatabase-API:1.3.0")
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.willfp.eco.internal.spigot
|
||||
import com.willfp.eco.core.Eco
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.Prerequisite
|
||||
import com.willfp.eco.core.data.ExternalDataStore
|
||||
import com.willfp.eco.core.entities.Entities
|
||||
import com.willfp.eco.core.integrations.IntegrationLoader
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
@@ -19,6 +20,8 @@ import com.willfp.eco.core.items.Items
|
||||
import com.willfp.eco.core.packet.PacketListener
|
||||
import com.willfp.eco.core.particle.Particles
|
||||
import com.willfp.eco.core.price.Prices
|
||||
import com.willfp.eco.internal.data.MavenVersionToStringAdapter
|
||||
import com.willfp.eco.internal.data.VersionToStringAdapter
|
||||
import com.willfp.eco.internal.entities.EntityArgParserAdult
|
||||
import com.willfp.eco.internal.entities.EntityArgParserAttackDamage
|
||||
import com.willfp.eco.internal.entities.EntityArgParserAttackSpeed
|
||||
@@ -120,6 +123,7 @@ import com.willfp.eco.internal.spigot.recipes.listeners.ComplexInComplex
|
||||
import com.willfp.eco.internal.spigot.recipes.listeners.ComplexInVanilla
|
||||
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapedCraftingRecipeStackHandler
|
||||
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapelessCraftingRecipeStackHandler
|
||||
import com.willfp.eco.util.ClassUtils
|
||||
import me.TechsCode.UltraEconomy.UltraEconomy
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences
|
||||
import net.milkbowl.vault.economy.Economy
|
||||
@@ -178,6 +182,20 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
SegmentParserUseIfPresent.register()
|
||||
|
||||
CustomItemsManager.registerProviders()
|
||||
|
||||
ExternalDataStore.registerAdapter(VersionToStringAdapter)
|
||||
// Handle with shadow.
|
||||
val className = listOf(
|
||||
"org",
|
||||
"apache",
|
||||
"maven",
|
||||
"artifact",
|
||||
"versioning",
|
||||
"DefaultArtifactVersion"
|
||||
).joinToString(".")
|
||||
if (ClassUtils.exists(className)) {
|
||||
ExternalDataStore.registerAdapter(MavenVersionToStringAdapter(className))
|
||||
}
|
||||
}
|
||||
|
||||
override fun handleEnable() {
|
||||
@@ -270,6 +288,7 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
IntegrationLoader("CombatLogX") {
|
||||
val pluginManager = Bukkit.getPluginManager()
|
||||
val combatLogXPlugin = pluginManager.getPlugin("CombatLogX") ?: return@IntegrationLoader
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
val pluginVersion = combatLogXPlugin.description.version
|
||||
if (pluginVersion.startsWith("10")) {
|
||||
@@ -294,7 +313,7 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||
IntegrationLoader("MythicMobs") { CustomEntitiesManager.register(CustomEntitiesMythicMobs()) },
|
||||
|
||||
// Custom Items
|
||||
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
||||
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen(this)) },
|
||||
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder()) },
|
||||
IntegrationLoader("HeadDatabase") { CustomItemsManager.register(CustomItemsHeadDatabase(this)) },
|
||||
IntegrationLoader("ExecutableItems") { CustomItemsManager.register(CustomItemsExecutableItems()) },
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.willfp.eco.internal.spigot.integrations.customitems
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.integrations.customitems.CustomItemsIntegration
|
||||
import com.willfp.eco.core.items.CustomItem
|
||||
import com.willfp.eco.core.items.Items
|
||||
@@ -7,16 +8,27 @@ import com.willfp.eco.core.items.TestableItem
|
||||
import com.willfp.eco.core.items.provider.ItemProvider
|
||||
import com.willfp.eco.util.NamespacedKeyUtils
|
||||
import io.th0rgal.oraxen.api.OraxenItems
|
||||
import io.th0rgal.oraxen.api.events.OraxenItemsLoadedEvent
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
|
||||
class CustomItemsOraxen : CustomItemsIntegration {
|
||||
class CustomItemsOraxen(
|
||||
private val plugin: EcoPlugin
|
||||
) : CustomItemsIntegration, Listener {
|
||||
override fun registerProvider() {
|
||||
Items.registerItemProvider(OraxenProvider())
|
||||
plugin.eventManager.registerListener(this)
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "Oraxen"
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun onItemRegister(event: OraxenItemsLoadedEvent) {
|
||||
Items.registerItemProvider(OraxenProvider())
|
||||
}
|
||||
|
||||
private class OraxenProvider : ItemProvider("oraxen") {
|
||||
override fun provideForKey(key: String): TestableItem? {
|
||||
val item = OraxenItems.getItemById(key) ?: return null
|
||||
|
||||
Reference in New Issue
Block a user