Skip to content

Conversation

EvanHsieh0415
Copy link
Contributor

@EvanHsieh0415 EvanHsieh0415 commented Sep 1, 2025

Description

Add null safety to SendDataFromClient/ServerPayload constructors to fix a codec error.

img

Example Script

server side:

ItemEvents.rightClicked((event) => {
  event.player.sendData("kubejs:hello_world", { message: "Hello, World!" });
  event.player.sendData("kubejs:hello_world"); // It should no longer cause the error
});

client side:

NetworkEvents.dataReceived('kubejs:hello_world', (event) => {
  if (event.data.message) {
    event.player.tell(event.data.message);
  } else {
    event.player.tell('!!!Hello, World!!!');
  }
});
img

Other details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant