From 38da5fe6d18dc7ee8eaf7bc90b4b217bda6d0384 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 1 Oct 2021 14:05:16 +0100 Subject: [PATCH] Fixed adventure audience bug --- build.gradle | 2 +- .../src/main/kotlin/com/willfp/eco/spigot/EcoHandler.kt | 6 +++++- .../main/kotlin/com/willfp/eco/spigot/EcoSpigotPlugin.kt | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 17667cd8..946cac1f 100644 --- a/build.gradle +++ b/build.gradle @@ -87,7 +87,7 @@ allprojects { shadowJar { relocate('org.bstats', 'com.willfp.eco.shaded.bstats') - relocate('net.kyori', 'com.willfp.eco.shaded.kyori') + relocate('net.kyori.adventure.text.minimessage', 'com.willfp.eco.shaded.minimessage') } jar { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoHandler.kt index 83126aea..3b47f64d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoHandler.kt @@ -43,7 +43,7 @@ import java.util.logging.Logger class EcoHandler : EcoSpigotPlugin(), Handler { private val cleaner = EcoCleaner() private val requirementFactory = EcoRequirementFactory() - private val adventure = BukkitAudiences.create(this); + private lateinit var adventure: BukkitAudiences override fun createScheduler(plugin: EcoPlugin): Scheduler { return EcoScheduler(plugin) @@ -132,4 +132,8 @@ class EcoHandler : EcoSpigotPlugin(), Handler { override fun getAdventure(): BukkitAudiences { return adventure } + + fun setAdventure(adventure: BukkitAudiences) { + this.adventure = adventure + } } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoSpigotPlugin.kt index f67e374c..42630359 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/EcoSpigotPlugin.kt @@ -32,6 +32,7 @@ import com.willfp.eco.spigot.integrations.shop.ShopShopGuiPlus import com.willfp.eco.spigot.recipes.ShapedRecipeListener import com.willfp.eco.util.BlockUtils import com.willfp.eco.util.SkullUtils +import net.kyori.adventure.platform.bukkit.BukkitAudiences import org.bukkit.Bukkit import org.bukkit.Material import org.bukkit.block.Block @@ -68,6 +69,7 @@ abstract class EcoSpigotPlugin : EcoPlugin( override fun handleEnable() { CollatedRunnable(this) + (Eco.getHandler() as EcoHandler).adventure = BukkitAudiences.create(this) this.logger.info("Ignore messages about deprecated events!")