From ad01ee57488e98752a0004f483ea1a304f5c4920 Mon Sep 17 00:00:00 2001 From: Vankka Date: Tue, 30 May 2023 18:34:15 +0300 Subject: [PATCH] Get player outside async context in BukkitChatForwarder --- .../discordsrv/bukkit/listener/chat/BukkitChatForwarder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/com/discordsrv/bukkit/listener/chat/BukkitChatForwarder.java b/bukkit/src/main/java/com/discordsrv/bukkit/listener/chat/BukkitChatForwarder.java index 58cf50e4..685027a9 100644 --- a/bukkit/src/main/java/com/discordsrv/bukkit/listener/chat/BukkitChatForwarder.java +++ b/bukkit/src/main/java/com/discordsrv/bukkit/listener/chat/BukkitChatForwarder.java @@ -23,6 +23,7 @@ import com.discordsrv.api.event.events.message.receive.game.GameChatMessageRecei import com.discordsrv.bukkit.BukkitDiscordSRV; import com.discordsrv.bukkit.component.PaperComponentHandle; import com.discordsrv.common.channel.GlobalChannel; +import com.discordsrv.common.player.IPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.Listener; @@ -47,10 +48,11 @@ public class BukkitChatForwarder implements IBukkitChatForwarder { @Override public void publishEvent(Event event, Player player, MinecraftComponent component, boolean cancelled) { + IPlayer srvPlayer = discordSRV.playerProvider().player(player); discordSRV.scheduler().run(() -> discordSRV.eventBus().publish( new GameChatMessageReceiveEvent( event, - discordSRV.playerProvider().player(player), + srvPlayer, component, new GlobalChannel(discordSRV), cancelled