PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Added notifications manager

Open SOF3 opened this issue 6 years ago • 4 comments

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 read from 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.

SOF3 avatar Jan 06 '19 11:01 SOF3

Wow, looks cool! How about show count of unreaded notifications in screen title? (Like status bar in Android)

Frago9876543210 avatar Jan 06 '19 19:01 Frago9876543210

Why

lukeeey avatar Mar 10 '19 13:03 lukeeey

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.

SOF3 avatar Mar 10 '19 16:03 SOF3

I can translate in french

omerien avatar Aug 20 '19 18:08 omerien

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.

SOF3 avatar Aug 29 '23 02:08 SOF3