-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added API to check if the server is sleeping #11605
base: master
Are you sure you want to change the base?
Conversation
See https://github.com/PaperMC/Paper/tree/is-tick-sleeping-api The method names could change to align with the spigot apis, but the impl there is simpler |
So should I just implement them? Or what should I do? |
As it's not included anymore, I'll close the repo. |
I don't understand why this was closed, it should be ok if you copy my impl, it would just need adjusting again after your other pr is merged |
Alright, I'm going to do that once I get home. |
7d3e2e8
to
cf2709f
Compare
I have copied the implementation and rebased. |
6a1b6a8
to
523ef6d
Compare
patches/server/1065-API-to-check-if-the-server-is-sleeping.patch
Outdated
Show resolved
Hide resolved
I have changed the method name, but the API method will stay the same. |
Hi,
How are you doing?
I added the API to check if the server is sleeping/paused as requested in #11511.
This pr adds the API function
CraftServer#isPaused()
, which is easily accessible usingBukkit#getServer()
.Under the hood this adds a
paused
-variable (false
by default) toMinecraftServer
, whichisPaused()
now returns (instead of previously justfalse
).The
paused
-variable gets set totrue
when theServer empty for x seconds, pausing
-message gets logged, and set back tofalse
when the player count isn't 0 (I couldn't find a better way to detect when the server was paused).That's all, have a nice day!