Fix NPE caused by client-side CUI packets

This commit is contained in:
Octavia Togami 2024-02-26 23:05:16 -08:00
parent b2f55cfe8f
commit 495e5924c7
No known key found for this signature in database
GPG Key ID: CC364524D1983C99

View File

@ -46,6 +46,10 @@ public static void init() {
}
public static void onPacketData(CustomPayloadEvent event) {
if (event.getSource().isClientSide()) {
// Ignore client-side packets
return;
}
ServerPlayer player = event.getSource().getSender();
LocalSession session = ForgeWorldEdit.inst.getSession(player);
String text = event.getPayload().toString(StandardCharsets.UTF_8);