From f0c0eedde7c65403f3274dc3e0d51830de27c155 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 5 Jul 2019 17:08:18 -0400 Subject: [PATCH] Fix handling CUI on Forge server. Probably. --- .../forge/net/handler/WECUIPacketHandler.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java index 2fd40fa23..8b26e9e33 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java @@ -22,13 +22,8 @@ package com.sk89q.worldedit.forge.net.handler; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.forge.ForgePlayer; import com.sk89q.worldedit.forge.ForgeWorldEdit; -import net.minecraft.client.Minecraft; import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.network.ThreadQuickExitException; -import net.minecraft.network.play.server.SCustomPayloadPlayPacket; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.network.NetworkEvent.ClientCustomPayloadEvent; -import net.minecraftforge.fml.network.NetworkEvent.ServerCustomPayloadEvent; import net.minecraftforge.fml.network.event.EventNetworkChannel; import java.nio.charset.Charset; @@ -47,10 +42,9 @@ public final class WECUIPacketHandler { public static void init() { HANDLER.addListener(WECUIPacketHandler::onPacketData); - HANDLER.addListener(WECUIPacketHandler::callProcessPacket); } - public static void onPacketData(ServerCustomPayloadEvent event) { + public static void onPacketData(ClientCustomPayloadEvent event) { ServerPlayerEntity player = event.getSource().get().getSender(); LocalSession session = ForgeWorldEdit.inst.getSession(player); @@ -63,15 +57,5 @@ public final class WECUIPacketHandler { session.handleCUIInitializationMessage(text, actor); session.describeCUI(actor); } - - public static void callProcessPacket(ClientCustomPayloadEvent event) { - try { - new SCustomPayloadPlayPacket( - new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL), - event.getPayload() - ).processPacket(Minecraft.getInstance().player.connection); - } catch (ThreadQuickExitException ignored) { - } - } } \ No newline at end of file