Skip to content
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

Merged
merged 8 commits into from
Nov 22, 2024

Conversation

Abelkrijgtalles
Copy link
Contributor

@Abelkrijgtalles Abelkrijgtalles commented Nov 10, 2024

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 using Bukkit#getServer().
Under the hood this adds a paused-variable (false by default) to MinecraftServer, which isPaused() now returns (instead of previously just false).
The paused-variable gets set to true when the Server empty for x seconds, pausing-message gets logged, and set back to false 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!

@Abelkrijgtalles Abelkrijgtalles requested a review from a team as a code owner November 10, 2024 16:02
@jpenilla
Copy link
Member

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

@Abelkrijgtalles
Copy link
Contributor Author

Abelkrijgtalles commented Nov 10, 2024

So should I just implement them? Or what should I do?

@Abelkrijgtalles
Copy link
Contributor Author

As it's not included anymore, I'll close the repo.

@jpenilla
Copy link
Member

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

@Abelkrijgtalles
Copy link
Contributor Author

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.

@Abelkrijgtalles
Copy link
Contributor Author

I have copied the implementation and rebased.

@Abelkrijgtalles
Copy link
Contributor Author

I have changed the method name, but the API method will stay the same.

@Abelkrijgtalles Abelkrijgtalles force-pushed the sleeping_api branch 4 times, most recently from 2cb2807 to ddcea73 Compare November 18, 2024 16:39
@kennytv kennytv merged commit 8dc42fa into PaperMC:master Nov 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants