Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
960f62cc8b | ||
|
|
28ceb83eb5 | ||
|
|
6f748b6b8a | ||
|
|
190ea5d49f |
@@ -3,16 +3,28 @@ package com.willfp.eco.internal.spigot.proxy.v1_17_R1
|
|||||||
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
||||||
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
||||||
import net.minecraft.nbt.Tag
|
import net.minecraft.nbt.Tag
|
||||||
|
import org.bukkit.Material
|
||||||
|
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer
|
import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataTypeRegistry
|
import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataTypeRegistry
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.persistence.PersistentDataContainer
|
import org.bukkit.persistence.PersistentDataContainer
|
||||||
import org.bukkit.persistence.PersistentDataType
|
import org.bukkit.persistence.PersistentDataType
|
||||||
|
|
||||||
class ExtendedPersistentDataContainerFactory: ExtendedPersistentDataContainerFactoryProxy {
|
class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFactoryProxy {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private val registry: CraftPersistentDataTypeRegistry =
|
private val registry: CraftPersistentDataTypeRegistry
|
||||||
CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
|
||||||
.apply { isAccessible = true }.get(null) as CraftPersistentDataTypeRegistry
|
init {
|
||||||
|
/*
|
||||||
|
Can't grab actual instance since it's in CraftMetaItem (which is package-private)
|
||||||
|
And getting it would mean more janky reflection
|
||||||
|
*/
|
||||||
|
val item = CraftItemStack.asCraftCopy(ItemStack(Material.STONE))
|
||||||
|
val pdc = item.itemMeta!!.persistentDataContainer
|
||||||
|
this.registry = CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
||||||
|
.apply { isAccessible = true }.get(pdc) as CraftPersistentDataTypeRegistry
|
||||||
|
}
|
||||||
|
|
||||||
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
||||||
return when (pdc) {
|
return when (pdc) {
|
||||||
@@ -34,7 +46,8 @@ class ExtendedPersistentDataContainerFactory: ExtendedPersistentDataContainerFac
|
|||||||
.apply { isAccessible = true }.get(handle) as MutableMap<String, Tag>
|
.apply { isAccessible = true }.get(handle) as MutableMap<String, Tag>
|
||||||
|
|
||||||
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
||||||
customDataTags[key] = registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
customDataTags[key] =
|
||||||
|
registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
||||||
|
|||||||
@@ -3,16 +3,28 @@ package com.willfp.eco.internal.spigot.proxy.v1_18_R1
|
|||||||
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
||||||
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
||||||
import net.minecraft.nbt.Tag
|
import net.minecraft.nbt.Tag
|
||||||
|
import org.bukkit.Material
|
||||||
|
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack
|
||||||
import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataContainer
|
import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataContainer
|
||||||
import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataTypeRegistry
|
import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataTypeRegistry
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.persistence.PersistentDataContainer
|
import org.bukkit.persistence.PersistentDataContainer
|
||||||
import org.bukkit.persistence.PersistentDataType
|
import org.bukkit.persistence.PersistentDataType
|
||||||
|
|
||||||
class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFactoryProxy {
|
class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFactoryProxy {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private val registry: CraftPersistentDataTypeRegistry =
|
private val registry: CraftPersistentDataTypeRegistry
|
||||||
CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
|
||||||
.apply { isAccessible = true }.get(null) as CraftPersistentDataTypeRegistry
|
init {
|
||||||
|
/*
|
||||||
|
Can't grab actual instance since it's in CraftMetaItem (which is package-private)
|
||||||
|
And getting it would mean more janky reflection
|
||||||
|
*/
|
||||||
|
val item = CraftItemStack.asCraftCopy(ItemStack(Material.STONE))
|
||||||
|
val pdc = item.itemMeta!!.persistentDataContainer
|
||||||
|
this.registry = CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
||||||
|
.apply { isAccessible = true }.get(pdc) as CraftPersistentDataTypeRegistry
|
||||||
|
}
|
||||||
|
|
||||||
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
||||||
return when (pdc) {
|
return when (pdc) {
|
||||||
|
|||||||
@@ -3,16 +3,28 @@ package com.willfp.eco.internal.spigot.proxy.v1_18_R2
|
|||||||
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
||||||
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
||||||
import net.minecraft.nbt.Tag
|
import net.minecraft.nbt.Tag
|
||||||
|
import org.bukkit.Material
|
||||||
|
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer
|
import org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataTypeRegistry
|
import org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataTypeRegistry
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.persistence.PersistentDataContainer
|
import org.bukkit.persistence.PersistentDataContainer
|
||||||
import org.bukkit.persistence.PersistentDataType
|
import org.bukkit.persistence.PersistentDataType
|
||||||
|
|
||||||
class ExtendedPersistentDataContainerFactory: ExtendedPersistentDataContainerFactoryProxy {
|
class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFactoryProxy {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private val registry: CraftPersistentDataTypeRegistry =
|
private val registry: CraftPersistentDataTypeRegistry
|
||||||
CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
|
||||||
.apply { isAccessible = true }.get(null) as CraftPersistentDataTypeRegistry
|
init {
|
||||||
|
/*
|
||||||
|
Can't grab actual instance since it's in CraftMetaItem (which is package-private)
|
||||||
|
And getting it would mean more janky reflection
|
||||||
|
*/
|
||||||
|
val item = CraftItemStack.asCraftCopy(ItemStack(Material.STONE))
|
||||||
|
val pdc = item.itemMeta!!.persistentDataContainer
|
||||||
|
this.registry = CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
||||||
|
.apply { isAccessible = true }.get(pdc) as CraftPersistentDataTypeRegistry
|
||||||
|
}
|
||||||
|
|
||||||
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
||||||
return when (pdc) {
|
return when (pdc) {
|
||||||
@@ -34,7 +46,8 @@ class ExtendedPersistentDataContainerFactory: ExtendedPersistentDataContainerFac
|
|||||||
.apply { isAccessible = true }.get(handle) as MutableMap<String, Tag>
|
.apply { isAccessible = true }.get(handle) as MutableMap<String, Tag>
|
||||||
|
|
||||||
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
||||||
customDataTags[key] = registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
customDataTags[key] =
|
||||||
|
registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
||||||
|
|||||||
@@ -3,21 +3,33 @@ package com.willfp.eco.internal.spigot.proxy.v1_19_R1
|
|||||||
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
import com.willfp.eco.core.data.ExtendedPersistentDataContainer
|
||||||
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
import com.willfp.eco.internal.spigot.proxy.ExtendedPersistentDataContainerFactoryProxy
|
||||||
import net.minecraft.nbt.Tag
|
import net.minecraft.nbt.Tag
|
||||||
|
import org.bukkit.Material
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataContainer
|
import org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataContainer
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataTypeRegistry
|
import org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataTypeRegistry
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.persistence.PersistentDataContainer
|
import org.bukkit.persistence.PersistentDataContainer
|
||||||
import org.bukkit.persistence.PersistentDataType
|
import org.bukkit.persistence.PersistentDataType
|
||||||
|
|
||||||
class ExtendedPersistentDataContainerFactory: ExtendedPersistentDataContainerFactoryProxy {
|
class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFactoryProxy {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private val registry: CraftPersistentDataTypeRegistry =
|
private val registry: CraftPersistentDataTypeRegistry
|
||||||
CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
|
||||||
.apply { isAccessible = true }.get(null) as CraftPersistentDataTypeRegistry
|
init {
|
||||||
|
/*
|
||||||
|
Can't grab actual instance since it's in CraftMetaItem (which is package-private)
|
||||||
|
And getting it would mean more janky reflection
|
||||||
|
*/
|
||||||
|
val item = CraftItemStack.asCraftCopy(ItemStack(Material.STONE))
|
||||||
|
val pdc = item.itemMeta!!.persistentDataContainer
|
||||||
|
this.registry = CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
||||||
|
.apply { isAccessible = true }.get(pdc) as CraftPersistentDataTypeRegistry
|
||||||
|
}
|
||||||
|
|
||||||
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
override fun adapt(pdc: PersistentDataContainer): ExtendedPersistentDataContainer {
|
||||||
return when (pdc) {
|
return when (pdc) {
|
||||||
is CraftPersistentDataContainer -> EcoPersistentDataContainer(pdc)
|
is CraftPersistentDataContainer -> EcoPersistentDataContainer(pdc)
|
||||||
else -> throw IllegalArgumentException("Custom PDC instance is not supported!")
|
else -> throw IllegalArgumentException("Custom PDC instance ims not supported!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +46,8 @@ class ExtendedPersistentDataContainerFactory: ExtendedPersistentDataContainerFac
|
|||||||
.apply { isAccessible = true }.get(handle) as MutableMap<String, Tag>
|
.apply { isAccessible = true }.get(handle) as MutableMap<String, Tag>
|
||||||
|
|
||||||
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
|
||||||
customDataTags[key] = registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
customDataTags[key] =
|
||||||
|
registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.willfp.eco.core.Eco
|
|||||||
import com.willfp.eco.core.EcoPlugin
|
import com.willfp.eco.core.EcoPlugin
|
||||||
import com.willfp.eco.core.PluginLike
|
import com.willfp.eco.core.PluginLike
|
||||||
import com.willfp.eco.core.PluginProps
|
import com.willfp.eco.core.PluginProps
|
||||||
import com.willfp.eco.core.Prerequisite
|
|
||||||
import com.willfp.eco.core.config.ConfigType
|
import com.willfp.eco.core.config.ConfigType
|
||||||
import com.willfp.eco.core.config.interfaces.Config
|
import com.willfp.eco.core.config.interfaces.Config
|
||||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||||
@@ -39,7 +38,7 @@ import com.willfp.eco.internal.logging.EcoLogger
|
|||||||
import com.willfp.eco.internal.proxy.EcoProxyFactory
|
import com.willfp.eco.internal.proxy.EcoProxyFactory
|
||||||
import com.willfp.eco.internal.scheduling.EcoScheduler
|
import com.willfp.eco.internal.scheduling.EcoScheduler
|
||||||
import com.willfp.eco.internal.spigot.data.DataYml
|
import com.willfp.eco.internal.spigot.data.DataYml
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
import com.willfp.eco.internal.spigot.data.KeyRegistry
|
import com.willfp.eco.internal.spigot.data.KeyRegistry
|
||||||
import com.willfp.eco.internal.spigot.data.storage.HandlerType
|
import com.willfp.eco.internal.spigot.data.storage.HandlerType
|
||||||
import com.willfp.eco.internal.spigot.integrations.bstats.MetricHandler
|
import com.willfp.eco.internal.spigot.integrations.bstats.MetricHandler
|
||||||
@@ -53,7 +52,6 @@ import com.willfp.eco.internal.spigot.proxy.MiniMessageTranslatorProxy
|
|||||||
import com.willfp.eco.internal.spigot.proxy.SNBTConverterProxy
|
import com.willfp.eco.internal.spigot.proxy.SNBTConverterProxy
|
||||||
import com.willfp.eco.internal.spigot.proxy.SkullProxy
|
import com.willfp.eco.internal.spigot.proxy.SkullProxy
|
||||||
import com.willfp.eco.internal.spigot.proxy.TPSProxy
|
import com.willfp.eco.internal.spigot.proxy.TPSProxy
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences
|
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.NamespacedKey
|
import org.bukkit.NamespacedKey
|
||||||
import org.bukkit.configuration.ConfigurationSection
|
import org.bukkit.configuration.ConfigurationSection
|
||||||
@@ -72,7 +70,7 @@ private val loadedEcoPlugins = mutableMapOf<String, EcoPlugin>()
|
|||||||
class EcoImpl : EcoSpigotPlugin(), Eco {
|
class EcoImpl : EcoSpigotPlugin(), Eco {
|
||||||
override val dataYml = DataYml(this)
|
override val dataYml = DataYml(this)
|
||||||
|
|
||||||
override val profileHandler = EcoProfileHandler(
|
override val profileHandler = ProfileHandler(
|
||||||
HandlerType.valueOf(this.configYml.getString("data-handler").uppercase()),
|
HandlerType.valueOf(this.configYml.getString("data-handler").uppercase()),
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
@@ -81,10 +79,6 @@ class EcoImpl : EcoSpigotPlugin(), Eco {
|
|||||||
getProxy(CommonsInitializerProxy::class.java).init()
|
getProxy(CommonsInitializerProxy::class.java).init()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var adventure: BukkitAudiences? = if (!Prerequisite.HAS_PAPER.isMet) {
|
|
||||||
BukkitAudiences.create(this)
|
|
||||||
} else null
|
|
||||||
|
|
||||||
@Suppress("RedundantNullableReturnType")
|
@Suppress("RedundantNullableReturnType")
|
||||||
private val keyFactory: InternalNamespacedKeyFactory? =
|
private val keyFactory: InternalNamespacedKeyFactory? =
|
||||||
if (this.configYml.getBool("use-safer-namespacedkey-creation"))
|
if (this.configYml.getBool("use-safer-namespacedkey-creation"))
|
||||||
@@ -236,7 +230,7 @@ class EcoImpl : EcoSpigotPlugin(), Eco {
|
|||||||
MetricHandler.createMetrics(plugin)
|
MetricHandler.createMetrics(plugin)
|
||||||
|
|
||||||
override fun getAdventure() =
|
override fun getAdventure() =
|
||||||
adventure
|
bukkitAudiences
|
||||||
|
|
||||||
override fun getServerProfile() =
|
override fun getServerProfile() =
|
||||||
profileHandler.loadServerProfile()
|
profileHandler.loadServerProfile()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import com.willfp.eco.internal.lookup.SegmentParserUseIfPresent
|
|||||||
import com.willfp.eco.internal.spigot.arrows.ArrowDataListener
|
import com.willfp.eco.internal.spigot.arrows.ArrowDataListener
|
||||||
import com.willfp.eco.internal.spigot.data.DataListener
|
import com.willfp.eco.internal.spigot.data.DataListener
|
||||||
import com.willfp.eco.internal.spigot.data.DataYml
|
import com.willfp.eco.internal.spigot.data.DataYml
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
import com.willfp.eco.internal.spigot.data.PlayerBlockListener
|
import com.willfp.eco.internal.spigot.data.PlayerBlockListener
|
||||||
import com.willfp.eco.internal.spigot.data.storage.ProfileSaver
|
import com.willfp.eco.internal.spigot.data.storage.ProfileSaver
|
||||||
import com.willfp.eco.internal.spigot.display.PacketAutoRecipe
|
import com.willfp.eco.internal.spigot.display.PacketAutoRecipe
|
||||||
@@ -120,6 +120,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.listeners.ComplexInVanilla
|
||||||
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapedCraftingRecipeStackHandler
|
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapedCraftingRecipeStackHandler
|
||||||
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapelessCraftingRecipeStackHandler
|
import com.willfp.eco.internal.spigot.recipes.stackhandlers.ShapelessCraftingRecipeStackHandler
|
||||||
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences
|
||||||
import net.milkbowl.vault.economy.Economy
|
import net.milkbowl.vault.economy.Economy
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.Material
|
import org.bukkit.Material
|
||||||
@@ -128,7 +129,8 @@ import org.bukkit.inventory.ItemStack
|
|||||||
|
|
||||||
abstract class EcoSpigotPlugin : EcoPlugin() {
|
abstract class EcoSpigotPlugin : EcoPlugin() {
|
||||||
abstract val dataYml: DataYml
|
abstract val dataYml: DataYml
|
||||||
protected abstract val profileHandler: EcoProfileHandler
|
protected abstract val profileHandler: ProfileHandler
|
||||||
|
protected var bukkitAudiences: BukkitAudiences? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
Items.registerArgParser(ArgParserEnchantment)
|
Items.registerArgParser(ArgParserEnchantment)
|
||||||
@@ -207,6 +209,11 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
|||||||
|
|
||||||
// Preload categorized persistent data keys
|
// Preload categorized persistent data keys
|
||||||
profileHandler.initialize()
|
profileHandler.initialize()
|
||||||
|
|
||||||
|
// Init adventure
|
||||||
|
if (!Prerequisite.HAS_PAPER.isMet) {
|
||||||
|
bukkitAudiences = BukkitAudiences.create(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleDisable() {
|
override fun handleDisable() {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.util.UUID
|
|||||||
|
|
||||||
val serverProfileUUID = UUID(0, 0)
|
val serverProfileUUID = UUID(0, 0)
|
||||||
|
|
||||||
class EcoProfileHandler(
|
class ProfileHandler(
|
||||||
private val type: HandlerType,
|
private val type: HandlerType,
|
||||||
private val plugin: EcoSpigotPlugin
|
private val plugin: EcoSpigotPlugin
|
||||||
) {
|
) {
|
||||||
@@ -7,7 +7,7 @@ import com.willfp.eco.core.EcoPlugin
|
|||||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
||||||
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
import com.willfp.eco.internal.spigot.data.serverProfileUUID
|
import com.willfp.eco.internal.spigot.data.serverProfileUUID
|
||||||
import com.zaxxer.hikari.HikariConfig
|
import com.zaxxer.hikari.HikariConfig
|
||||||
import com.zaxxer.hikari.HikariDataSource
|
import com.zaxxer.hikari.HikariDataSource
|
||||||
@@ -49,7 +49,7 @@ the worst bodge I've shipped in production.
|
|||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
class LegacyMySQLDataHandler(
|
class LegacyMySQLDataHandler(
|
||||||
plugin: EcoSpigotPlugin,
|
plugin: EcoSpigotPlugin,
|
||||||
handler: EcoProfileHandler
|
handler: ProfileHandler
|
||||||
) : DataHandler(HandlerType.LEGACY_MYSQL) {
|
) : DataHandler(HandlerType.LEGACY_MYSQL) {
|
||||||
private val playerHandler: ImplementedMySQLHandler
|
private val playerHandler: ImplementedMySQLHandler
|
||||||
private val serverHandler: ImplementedMySQLHandler
|
private val serverHandler: ImplementedMySQLHandler
|
||||||
@@ -114,7 +114,7 @@ class LegacyMySQLDataHandler(
|
|||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private class ImplementedMySQLHandler(
|
private class ImplementedMySQLHandler(
|
||||||
private val handler: EcoProfileHandler,
|
private val handler: ProfileHandler,
|
||||||
private val table: UUIDTable,
|
private val table: UUIDTable,
|
||||||
private val plugin: EcoPlugin
|
private val plugin: EcoPlugin
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.willfp.eco.internal.spigot.data.storage
|
|||||||
import com.willfp.eco.core.data.Profile
|
import com.willfp.eco.core.data.Profile
|
||||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||||
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -20,7 +20,7 @@ import java.util.UUID
|
|||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
class MongoDataHandler(
|
class MongoDataHandler(
|
||||||
plugin: EcoSpigotPlugin,
|
plugin: EcoSpigotPlugin,
|
||||||
private val handler: EcoProfileHandler
|
private val handler: ProfileHandler
|
||||||
) : DataHandler(HandlerType.MONGO) {
|
) : DataHandler(HandlerType.MONGO) {
|
||||||
private val client: CoroutineClient
|
private val client: CoroutineClient
|
||||||
private val collection: CoroutineCollection<UUIDProfile>
|
private val collection: CoroutineCollection<UUIDProfile>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.willfp.eco.core.config.interfaces.Config
|
|||||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
||||||
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
import com.zaxxer.hikari.HikariConfig
|
import com.zaxxer.hikari.HikariConfig
|
||||||
import com.zaxxer.hikari.HikariDataSource
|
import com.zaxxer.hikari.HikariDataSource
|
||||||
import org.jetbrains.exposed.dao.id.UUIDTable
|
import org.jetbrains.exposed.dao.id.UUIDTable
|
||||||
@@ -35,7 +35,7 @@ Whatever. At least it works.
|
|||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
class MySQLDataHandler(
|
class MySQLDataHandler(
|
||||||
private val plugin: EcoSpigotPlugin,
|
private val plugin: EcoSpigotPlugin,
|
||||||
private val handler: EcoProfileHandler
|
private val handler: ProfileHandler
|
||||||
) : DataHandler(HandlerType.MYSQL) {
|
) : DataHandler(HandlerType.MYSQL) {
|
||||||
private val table = UUIDTable("eco_data")
|
private val table = UUIDTable("eco_data")
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package com.willfp.eco.internal.spigot.data.storage
|
|||||||
|
|
||||||
import com.willfp.eco.core.EcoPlugin
|
import com.willfp.eco.core.EcoPlugin
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfile
|
import com.willfp.eco.internal.spigot.data.EcoProfile
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
|
|
||||||
class ProfileSaver(
|
class ProfileSaver(
|
||||||
plugin: EcoPlugin,
|
plugin: EcoPlugin,
|
||||||
handler: EcoProfileHandler
|
handler: ProfileHandler
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
plugin.scheduler.runTimer(1, 1) {
|
plugin.scheduler.runTimer(1, 1) {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package com.willfp.eco.internal.spigot.data.storage
|
|||||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
||||||
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
import com.willfp.eco.internal.spigot.EcoSpigotPlugin
|
||||||
import com.willfp.eco.internal.spigot.data.EcoProfileHandler
|
import com.willfp.eco.internal.spigot.data.ProfileHandler
|
||||||
import org.bukkit.NamespacedKey
|
import org.bukkit.NamespacedKey
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
class YamlDataHandler(
|
class YamlDataHandler(
|
||||||
plugin: EcoSpigotPlugin,
|
plugin: EcoSpigotPlugin,
|
||||||
private val handler: EcoProfileHandler
|
private val handler: ProfileHandler
|
||||||
) : DataHandler(HandlerType.YAML) {
|
) : DataHandler(HandlerType.YAML) {
|
||||||
private val dataYml = plugin.dataYml
|
private val dataYml = plugin.dataYml
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version = 6.43.5
|
version = 6.43.7
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
Reference in New Issue
Block a user