From c9c101b803fcca568136801ba35492c0df5064e2 Mon Sep 17 00:00:00 2001 From: Vankka Date: Fri, 21 Jun 2024 15:14:32 +0300 Subject: [PATCH] Move EssentialsX global channel to EventPriority LAST --- .../bukkit/integration/EssentialsXIntegration.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/com/discordsrv/bukkit/integration/EssentialsXIntegration.java b/bukkit/src/main/java/com/discordsrv/bukkit/integration/EssentialsXIntegration.java index c657e47e..2cff2542 100644 --- a/bukkit/src/main/java/com/discordsrv/bukkit/integration/EssentialsXIntegration.java +++ b/bukkit/src/main/java/com/discordsrv/bukkit/integration/EssentialsXIntegration.java @@ -2,6 +2,7 @@ package com.discordsrv.bukkit.integration; import com.discordsrv.api.channel.GameChannel; import com.discordsrv.api.component.MinecraftComponent; +import com.discordsrv.api.event.bus.EventPriority; import com.discordsrv.api.event.bus.Subscribe; import com.discordsrv.api.event.events.channel.GameChannelLookupEvent; import com.discordsrv.api.event.events.message.receive.game.GameChatMessageReceiveEvent; @@ -19,6 +20,7 @@ import net.essentialsx.api.v2.events.chat.GlobalChatEvent; import net.kyori.adventure.platform.bukkit.BukkitComponentSerializer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,6 +55,16 @@ public class EssentialsXIntegration return super.isEnabled(); } + @Override + public void enable() { + discordSRV.server().getPluginManager().registerEvents(this, discordSRV.plugin()); + } + + @Override + public void disable() { + HandlerList.unregisterAll(this); + } + private Essentials get() { return (Essentials) discordSRV.server().getPluginManager().getPlugin("Essentials"); } @@ -113,7 +125,7 @@ public class EssentialsXIntegration )); } - @Subscribe + @Subscribe(priority = EventPriority.LAST) public void onGameChannelLookup(GameChannelLookupEvent event) { if (checkProcessor(event) || !discordSRV.server().getPluginManager().isPluginEnabled("EssentialsChat")) { return;