Skip to content

Configuration option for showing sleep messages#6864

Closed
lynxplay wants to merge 1 commit into
PaperMC:masterfrom
lynxplay:feature/removable-sleep-announcements
Closed

Configuration option for showing sleep messages#6864
lynxplay wants to merge 1 commit into
PaperMC:masterfrom
lynxplay:feature/removable-sleep-announcements

Conversation

@lynxplay
Copy link
Copy Markdown
Contributor

@lynxplay lynxplay commented Nov 3, 2021

Configuration option for showing sleep messages

The minecraft server now announces sleep progress, e.g. players already
sleeping or the night being skipped, to all players on the server
through a hotbar messages.
While this vanilla behaviour works well in vanilla itself it is not
always appreciated, especially when hiding players.

This commit introduces a new sleep configuration node in the player
world configuration that allows server administrators to prevent the
server from sending either one of the messages to the clients connected.

Resolves: #6863


A PR to the PaperDocs will follow once this PR has been approved/finalized to the point of approval.

Additionally a few questions I ran into while making this:

  • Should events exist to properly remove individual players from the player count ?
  • Right now a parent node sleep was added as well as its only child node messages. This could be reduced to sleep-messages.

The minecraft server now announces sleep progress, e.g. players already
sleeping or the night being skipped, to all players on the server
through a hotbar messages.
While this vanilla behaviour works well in vanilla itself it is not
always appreciated, especially when hiding players.

This commit introduces a new sleep configuration node in the player
world configuration that allows server administrators to prevent the
server from sending either one of the messages to the clients connected.
@lynxplay lynxplay requested review from a team as code owners November 3, 2021 18:02
@Doc94
Copy link
Copy Markdown
Member

Doc94 commented Nov 3, 2021

About Should events exist to properly remove individual players from the player count ? maybe can be useful a parameter in Player like ignoreInCountForSleep (best name in the world) and modify sleepStatus when generate the count.

now im thinking.. in API not exists a method for get players need for sleep?

@MiniDigger
Copy link
Copy Markdown
Member

really not a fan of disabling a vanilla feature like this for a bandaid fix. much rather would have an event for the announcing, which exposes the counts and and maybe even the message. then the vanish plugin can hook into that.

@lynxplay
Copy link
Copy Markdown
Contributor Author

lynxplay commented Nov 4, 2021

really not a fan of disabling a vanilla feature like this for a bandaid fix. much rather would have an event for the announcing, which exposes the counts and and maybe even the message. then the vanish plugin can hook into that.

Yeah I figured as much, thanks for the feedback I'll update the PR shortly.

@Prof-Bloodstone
Copy link
Copy Markdown
Contributor

I think people who use sleep datapacks/plugins could still find such option useful.
Though proper fix would be to expose API for canceling the message and update your sleep plugin to support it.

@lynxplay
Copy link
Copy Markdown
Contributor Author

lynxplay commented Nov 4, 2021

I think people who use sleep datapacks/plugins could still find such option useful.
Though proper fix would be to expose API for canceling the message and update your sleep plugin to support it.

My main reason to at least attempt a config option was the fact that events will just generate a bunch of different plugins to disable the feature in the end anyway, spreading out something that could be standardized in the server software.

But I guess it is a way cleaner fix for us to leave this functionality to the community to implement as we can solve both issues (disable completely and modify) with events.

@MiniDigger
Copy link
Copy Markdown
Member

well, maybe we should have both then. but I for sure want the event so vanish plugins can handle this properly.
its also a nice "dont wanna expose vanished players when sleeping? use paper to this plugin can hide them from there"

@Prof-Bloodstone
Copy link
Copy Markdown
Contributor

Fair. We could have the config option cause the event to fire in already canceled state - then we can solve both of these use cases at once.

@lynxplay
Copy link
Copy Markdown
Contributor Author

lynxplay commented Nov 4, 2021

I absolutely agree 👍 I'll close the PR for now as I believe the event layout needs a bit of thinking (e.g. single event ? multiple events ? how will the status state be represented ?) that I do not have the time for to finish before sunday, so if others want to give it a try, go for it 👍

I'll be opening a respective PR with the above suggestions next week if no alternative solution has been proposed.

@lynxplay lynxplay closed this Nov 4, 2021
@lynxplay lynxplay deleted the feature/removable-sleep-announcements branch May 6, 2022 12:28
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.

Add option to disable "x/y players sleeping" message.

4 participants