mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
fabric: Fix channel identifier not being set correctly, Close #366
This commit is contained in:
2 files changed
+14
-5
No files matched your search
@@ -138,7 +138,7 @@ public class FabricUser extends OnlineUser {
|
||||
public void sendPluginMessage(@NotNull String channel, byte[] message) {
|
||||
final PacketByteBuf buf = PacketByteBufs.create();
|
||||
buf.writeBytes(message);
|
||||
final CustomPayloadS2CPacket packet = new CustomPayloadS2CPacket(Identifier.tryParse(channel), buf);
|
||||
final CustomPayloadS2CPacket packet = new CustomPayloadS2CPacket(parseIdentifier(channel), buf);
|
||||
player.networkHandler.sendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -152,4 +152,13 @@ public class FabricUser extends OnlineUser {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Identifier parseIdentifier(@NotNull String channel) {
|
||||
if (channel.equals("BungeeCord")) {
|
||||
return new Identifier("bungeecord", "main");
|
||||
}
|
||||
return Optional.ofNullable(Identifier.tryParse(channel))
|
||||
.orElseThrow(() -> new IllegalArgumentException("Invalid channel name: " + channel));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user