Skip to content

Conversation

@gungun974
Copy link
Contributor

@gungun974 gungun974 commented Apr 26, 2025

Often since in Java we can't load classes that have been striped, I find myself needed to create some condition branch that execute a single method since it's the only way to prevent wrongly unavailable import.

After the releasing of my first version of BTA CC, I found myself I did a terrible job of respecting the Client/Server Environement striping which lead to write in every method of my NetworkMessage extra handle for preventing the server loading the Screen class even there was some guard to preventing this.

image

This is kind of repetitive to have to have those condition on every NetworkMessage plus the needed to have two method for handling a simple GUI open so I decided to add two new methods on the Halplibe NetworkMessage

In this PR you will now found handleClientEnv and handleServerEnv which will be execute after the classic handle with a check to be sure we are not in the wrong environment which could lead to a crash.
Also now handle have a default implementation (it's an empty body) and so we can cleanly for opening a Screen just use handleClientEnv

image

The usage in also explain in the NetworkMessage JavaDocs.

Also this PR should not introduce breaking changes since handle is still called like before

@MartinSVK12 MartinSVK12 merged commit 8dcc59d into Turnip-Labs:7.3 Jun 15, 2025
2 checks passed
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.

2 participants