Skip to content

Sleep Message API + Config#7197

Closed
Owen1212055 wants to merge 1 commit into
PaperMC:masterfrom
Owen1212055:sleeping-message-customization
Closed

Sleep Message API + Config#7197
Owen1212055 wants to merge 1 commit into
PaperMC:masterfrom
Owen1212055:sleeping-message-customization

Conversation

@Owen1212055
Copy link
Copy Markdown
Member

Resolves: #6863

Called per-player, allows for modifying the message and getting what type it represents.
This also adds a configuration option, which will disable/enable these messages. If they are disabled the event will be called canceled by default.

@EventHandler
    public void event(PlayerSleepMessageEvent event) {
        Player player = event.getPlayer();
        
        player.sendMessage(event.getMessageType().toString());
        player.sendMessage(event.getMessage());
        event.setMessage(Component.text("haha night go skippy"));
    }

image
image

@kennytv
Copy link
Copy Markdown
Member

kennytv commented Dec 26, 2021

This seems like an xy situation. If people want their own handling of this, they can set the playersSleepingPercentage gamerule to a value higher than 100. Changing the message only without how many players are sleeping doesn't actually hide that there is vanished players, which otherwise needs https://papermc.io/javadocs/paper/1.17/org/bukkit/entity/Player.html#setSleepingIgnored(boolean) (already affecting that number)

@Owen1212055
Copy link
Copy Markdown
Member Author

Owen1212055 commented Dec 27, 2021

This seems like an xy situation. If people want their own handling of this, they can set the playersSleepingPercentage gamerule to a value higher than 100. Changing the message only without how many players are sleeping doesn't actually hide that there is vanished players, which otherwise needs https://papermc.io/javadocs/paper/1.17/org/bukkit/entity/Player.html#setSleepingIgnored(boolean) (already affecting that number)

The issue is that even if you change the number of players you can't change the message still. It seems that people wanted the ability to cancel the message itself, in which case an event + config was easiest as it solved both issues.
I at least referenced the conversation in #6864.

Should I keep the config? The event? Or should this entire suggestion be reconsidered perhaps? I'm open to feedback about this.

@pascalhanimann
Copy link
Copy Markdown

This also adds a configuration option, which will disable/enable these messages. If they are disabled the event will be called canceled by default.

Assuming you still want feedback: For our server this would be the best way to go. I would love to have an option to disable the message entirely.

@stale
Copy link
Copy Markdown

stale Bot commented Apr 4, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link
Copy Markdown

stale Bot commented Apr 11, 2022

This issue has been automatically closed because it has not had activity in a long time. If the issue still applies to the most recent supported version, please open a new issue referencing this original issue.

@stale stale Bot closed this Apr 11, 2022
@Badbird5907
Copy link
Copy Markdown
Contributor

Badbird5907 commented Aug 5, 2022

Any status on this? Since there is no current API to modify these messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants