CloudNet
CloudNet copied to clipboard
Fix: Make sure Minestom services stop like Bukkit services
Motivation
Minestom is a very lightweight framework for implementing specialized Minecraft servers.
Especially when the full implementation or behavior of vanilla Minecraft is not needed, Minestom offers a way to run services with very little resources.
One issue that arised in conjunction with CloudNet is that services implemented using Minestom would not properly stop. Minestom would shut down and the service would get unregistered from CloudNet but the processes would be kept running.
Modification
This pull request mimics the behavior of vanilla implementations of the Minecraft Server which all call System.exit(0);
when their process is done. This change makes sure that the JVM shuts down properly, even if other threads might block an ordinary shutdown from happening (ie. Netty and other networking related tasks).
Result
Services using the Minestom framework now properly shut down and allow CloudNet to advance to the next lifecycle steps.
Other context
Fixes #1304
As of now, this solution also works on server implementations build on hollow-cube/minestom-ce.
Can we maybe implement this as discussed here (https://discord.com/channels/713041279277203457/777861579659411466/1182967379488161872)
Can we maybe implement this as discussed here (https://discord.com/channels/713041279277203457/777861579659411466/1182967379488161872)
I'm going to update my implementation to match what we discussed back then.
@0utplay I have updated the PR but can't initiate the build required.
Feel free to also add a review to the code, the changes are pretty minimal.
Thats because there are conflicts in the Wrapper class. I can resolve them later.