mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
fabric: Fix EOFException reading plugin messages, close #367
This commit is contained in:
2 files changed
+8
-3
No files matched your search
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.william278.huskhomes;
|
||||
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
@@ -435,8 +436,12 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
|
||||
public void receive(@NotNull MinecraftServer server, @NotNull ServerPlayerEntity player,
|
||||
@NotNull ServerPlayNetworkHandler handler, @NotNull PacketByteBuf buf,
|
||||
@NotNull PacketSender responseSender) {
|
||||
if (broker != null && broker instanceof PluginMessageBroker pluginMessenger && getSettings().getBrokerType() == Broker.Type.PLUGIN_MESSAGE) {
|
||||
pluginMessenger.onReceive(PluginMessageBroker.BUNGEE_CHANNEL_ID, FabricUser.adapt(this, player), buf.readByteArray());
|
||||
if (broker instanceof PluginMessageBroker messenger && getSettings().getBrokerType() == Broker.Type.PLUGIN_MESSAGE) {
|
||||
messenger.onReceive(
|
||||
PluginMessageBroker.BUNGEE_CHANNEL_ID,
|
||||
FabricUser.adapt(this, player),
|
||||
ByteBufUtil.getBytes(buf)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ public class SpongeHuskHomes implements HuskHomes, SpongeTaskRunner, SpongeSafet
|
||||
// Read the message and handle
|
||||
final SpongeUser user = (SpongeUser) playerConnection.get();
|
||||
final String channel = pluginMessage.readUTF();
|
||||
if (broker instanceof PluginMessageBroker messenger) {
|
||||
if (broker instanceof PluginMessageBroker messenger && getSettings().getBrokerType() == Broker.Type.PLUGIN_MESSAGE) {
|
||||
messenger.onReceive(channel, user, pluginMessage.readBytes(pluginMessage.available()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user