PocketMine-MP
PocketMine-MP copied to clipboard
Added notifications manager
Introduction
Some warning messages can be dismissed after the user has read the messages. This pull request adds a manager for dismissed messages, and implements this for the "auth enabled" message.
Relevant issues
Changes
API changes
Added Server->getNotificationManager()
Behavioural changes
- Added a /notif command.
- The "auth enabled/disabled" notice/warning message is no longer displayed if the user runs
notif readfrom console anytime.
Backwards compatibility
No backward compatibility problems
Follow-up
Requires translations:
| Name | Value in eng.ini |
|---|---|
pocketmine.command.notif.description |
View and manage notifications |
pocketmine.command.notif.usage |
/notif [list|read] |
pocketmine.notification.markedRead |
Marked {%0} notifications as read. |
pocketmine.notification.header |
There are {%0} unread notifications |
pocketmine.notification.footer |
Run "/notif read" to not show these notifications again. |
Tests
Prints unread messages upon startup
Start the default server setup. The startup screen should end with this:
[19:29:25] [Server thread/NOTICE]: pocketmine.notification.header
[19:29:25] [Server thread/NOTICE]: Online mode is enabled. The server will verify that players are authenticated to Xbox Live.
[19:29:25] [Server thread/NOTICE]: To disable authentication, set "xbox-auth" to "false" in server.properties.
[19:29:25] [Server thread/NOTICE]: pocketmine.notification.footer
[19:29:25] [Server thread/INFO]: Done (0.884s)! For help, type "help" or "?"
Prints unread messages upon command
Start the default server setup. Run notif or notif list. The following output is expected:
[19:29:28] [Server thread/NOTICE]: pocketmine.notification.header
[19:29:28] [Server thread/NOTICE]: Online mode is enabled. The server will verify that players are authenticated to Xbox Live.
[19:29:28] [Server thread/NOTICE]: To disable authentication, set "xbox-auth" to "false" in server.properties.
[19:29:28] [Server thread/NOTICE]: pocketmine.notification.footer
Mark notifications as read
Start the default server. Run notif read. The following output is expected:
[19:29:29] [Server thread/INFO]: %pocketmine.notification.markedRead
In addition, the file read-notifications.txt should be immediately created with the contents:
pocketmine.server.auth.enabled
pocketmine.server.authProperty.enabled
Then restart the server. The "online mode" notice should no longer be displayed. Nor should pocketmine.notification.[header|footer] be displayed.
Wow, looks cool! How about show count of unreaded notifications in screen title? (Like status bar in Android)
Why
Some messages are important warnings, but they become annoying after the user reads them the first time. They are particularly distracting if they are in aqua/yellow, which is reasonable because they are important warnings.
I can translate in french
tbh I think this feature is pretty pointless since nobody wants to manage the startup logs after all. If anyone intends to fix this, we should look into a better frontend instead, e.g. #3046 I'm closing this PR for now and keeping the branch, but in case anyone wants to pick this up, feel free to reopen.