Skip to content

Commit 84b3136

Browse files
committed
v1.1
Issues #4, 6, 7, 9
1 parent d8f5ab9 commit 84b3136

File tree

8 files changed

+393
-47
lines changed

8 files changed

+393
-47
lines changed

BuddyNotify-source/README.md

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#BuddyNotify v1.0
1+
#BuddyNotify v1.1
22

33
Plugin for PocketMine-MP that sends email notifications to players when server starts/stops and/or when their buddy's join/leave.
44

55
Copyright (C) 2015 Scott Handley
6+
https://github.com/mcprostar205/pocketmine-plugins/tree/master/BuddyNotify-source
67

78
This program is free software: you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -60,14 +61,25 @@ For more information on setting up and configuring BuddyNotify, please see the D
6061
* `/email ur|unreg : Unregister your email from receiving alerts`
6162
* `/email us|unsub <buddy> : Unsubscribe from a buddy's alerts`
6263
* `/email ?|help : Show sub-command help`
63-
* From Console: `/email <player> a|add <buddy> : Add buddy to player's alerts`
64-
* From Console: `/email <player> d|del <buddy> : Remove buddy from player's alerts`
65-
* From Console: `/email <player> ls|list : Show player's alerts email and assigned buddies`
66-
* From Console: `/email s|send <player>|all <message> : Send a player or everyone an email`
67-
* From Console: `/email <player> r|reg <email> : Register player's email to receive alerts`
68-
* From Console: `/email <player> ur|unreg : Unregister player's email from receiving alerts`
69-
* From Console: `/email <buddy> us|unsub <player> : Unsubscribe player another player's alerts`
70-
* From Console: `/email ?|help : Show sub-command help`
64+
* From Console: `email <player> a|add <buddy> : Add buddy to player's alerts`
65+
* From Console: `email <player> d|del <buddy> : Remove buddy from player's alerts`
66+
* From Console: `email <player> ls|list : Show player's alerts email and assigned buddies`
67+
* From Console: `email s|send <player>|all <message> : Send a player or everyone an email`
68+
* From Console: `email <player> r|reg <email> : Register player's email to receive alerts`
69+
* From Console: `email <player> ur|unreg : Unregister player's email from receiving alerts`
70+
* From Console: `email <buddy> us|unsub <player> : Unsubscribe player another player's alerts`
71+
* From Console: `email ?|help : Show sub-command help`
72+
* From Console: `stop noemail : Shutdown the server without sending an email notification. After the next start/stop, notification will resume.`
73+
74+
## Installation Instructions
75+
76+
* Install and enable an appropriate mail server for your operating system. Verify it is operating correctly on its own by sending a sample email.
77+
* Open the PocketMine PHP configuration (bin/php5/bin/php.ini) and edit (or add) the "sendmail_path" with the path to your email server software.
78+
* Download The BuddyNotify plugin and install it in the PocketMine plugins folder.
79+
* Restart your PocketMine Server to active the plugin for the first time.
80+
* Open _BuddyNotify/config.yml_, edit the "server-address" property with a valid system operator's email address, and save.
81+
* Restart your PocketMine Server to activate the new configuration with valid server-address.
82+
* Register players and send a sample notification.
7183

7284
## Configuration
7385

@@ -76,23 +88,60 @@ You can modify the _BuddyNotify/config.yml_ file on the _plugins_ directory once
7688
| Configuration | Type | Default | Description |
7789
| :---: | :---: | :---: | :--- |
7890
| buddynotifier | boolean | true | Master switch turning the notification system on or off. Good for maintenance activities to prevent spamming.
79-
| system-address | string | true | Server administration email address from which server notifications are sent.
91+
| system-address | string | <empty> | Server administration email address from which server notifications are sent.
92+
| l10n-file | string | l10n.html | Localized string file for in-game and email notifications.
8093
| notify-start | boolean | true | Enable server started notifications for registered players.
8194
| notify-stop | boolean | true | Enable server shutdown notifications for registered players.
8295
| notify-auth | boolean | true | Enable player joined notifications for subscribed players.
8396
| notify-quit | boolean | true | Enable player quit notifications for subscribed players.
97+
| notify-delay | integer | 5000 | Delay in milliseconds before sending a notification.
8498
| date-format | string | "D M j, Y, g:i a" | Configures date/time in localized format.
8599

86100
### Localization
87101

88-
Commands and email messages can be localized by translating the text in the l10n.yml configuration file.
102+
Commands and email messages can be localized by translating the text in the l10n.yml and
103+
l10n_html.yml configuration files.
89104

90105
### Email
91106

92107
Your server must have a mail server configured and operational for this plug-in to
93108
function. You need to update your 'php.ini' file with the correct command. You may
94109
need to update the line break specific to your operating system. This configuration
95-
'header-crlf' can be found in the 'l10n.yml' file
110+
'header-crlf' can be found in the 'l10n.yml' or 'l10n_html.yml' file.
111+
112+
By default, BuddyNotify delivers email notifications in plain text. However, BuddyNotify
113+
can send HTML formatted notifications providing a more interactive experience. To enable
114+
HTML notifications, change the 'l10n-file' to 'l10n_html.yml' in the 'config.yml'.
115+
116+
## Frequently Asked Questions
117+
118+
BuddyNotify requires the server hosting PocketMine-MP have an email server running to
119+
relay messages to recipients (such as sendmail on unix). Once you have verified your
120+
mail relay is working on its own, be sure to update the PocketMine-MP's php.ini for
121+
the mail command.
122+
123+
On Unix, _php.ini_ can be found in the PocketMine-MP location under _bin/php5/bin_.
124+
A common mail configuration would be:
125+
126+
`[mail function]`
127+
`sendmail_path="/usr/sbin/sendmail -t"​`
128+
129+
Below are some common questions and answers:
130+
`[BuddyNotify] System alerts disabled. System operator email address not set in 'config.xml'.`
131+
You have not updated the "system-address" property in _plugins/BuddyNotify/config.xml_
132+
with a valid system administrators email address.​
133+
134+
`[BuddyNotify] Unable to send. Check the master switch in the 'config.cfg'`
135+
You have set the "buddynotifier" property to "false" in _plugins/BuddyNotify/config.xml"_
136+
137+
`[BuddyNotify] Unable to send. There are no registered email addresses.`
138+
No player has registered their email address. Either inform players to register their email
139+
addresses or register player email addresses from the console.
140+
141+
`[BuddyNotify] Unable to send. Check the 'sendmail_path' property in 'php.ini' is correct.`
142+
There is a problem sending mail. Possible causes:
143+
- You haven't installed, configured, or activated your email server relay
144+
- You haven't configured the PocketMine PHP.ini with the path to your email server executable​
96145

97146
## Permissions
98147

@@ -109,4 +158,24 @@ All methods are available through the main plugin object
109158
* boolean isFeatureEnabled(String $feature)
110159
* boolean isPlayerRegistered(String $playername)
111160
* String [] getBuddyList(String $playername)
112-
* String sendEmail(String $from, String $to, $subject, $body, $bcc=null)
161+
* String sendEmail(String $from, String $to, $subject, $body, $bcc=null)
162+
163+
## Release Notes
164+
165+
### 1.1
166+
167+
* Improved player join/quit email notifications to reduce notification sent when a player drops from the game briefly and re-joins within a specified time interval.
168+
169+
A configuration entry `notify-delay` can be added to increase or decrease the time interval before issuing a quit notification. Default time is 5 minutes.
170+
171+
* Added configuration entry `l10n-file` to specify which localization file to use (e.g l10n_fr-fr.yml)
172+
173+
* Added capability to send email notification in HTML format for richer formatting and interactive experience using hypertext.
174+
175+
A default `l10n_html.yml` file has been included to demonstrate. It can be assigned to `l10n-file` config entry.
176+
177+
* Added capability to suppress email notifications temporarily on a server "restart" (stop followed by start).
178+
179+
Console command to suppress notification => `stop noemail`
180+
181+
* No longer sends email notifications when the "reload" command is issued.

BuddyNotify-source/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: BuddyNotify
22
main: BuddyNotify\BuddyNotify
3-
version: "1.0"
3+
version: "1.1"
44
api: [1.10.0]
55
load: STARTUP
66
author: Scott Handley
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
buddynotifier: true
33
system-address:
4+
l10n-file: l10n.yml
45
notify-start: true
56
notify-stop: true
67
notify-auth: true
78
notify-quit: true
9+
notify-delay: 5000
810
date-format: "D M j, Y, g:i a"
911
...

BuddyNotify-source/resources/l10n.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ email:
1414
event-quit: "%s left '%s'"
1515
body:
1616
greeting: "Hello %s,\n\n"
17-
signature: "\n\nFrom,\n%s\n\n--Sent from '%s'"
17+
signature: "\n\nFrom,\n%s\n\n----\nSent by BuddyNotify\nhttps://forums.pocketmine.net/plugins/buddynotify.1344/"
1818
players-hdr: "\n\nOnline Players:\n\n"
19-
players-row: " * %s -> %s\n"
19+
players-row: " * %s -> %s - %s\n"
20+
players-ftr: ""
2021
event-start: "Server started. Enjoy the game!\n\nDate: %s\n\nServer: %s\n\nVersion: %s"
2122
event-stop: "Server stopped. Game play will resume shortly.\nYou will receive a message when the server is available.\n\nDate: %s\n\nServer: %s\n\nVersion: %s"
2223
event-auth: "%s joined the game.\n\nDate: %s\n\nServer: %s\n\nWorld: %s"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
labels:
3+
players: "Players"
4+
sysadmin: "System Administrator"
5+
email:
6+
header-crlf: "\r\n"
7+
header-mime: "text/html; charset=iso-8859-1"
8+
subject:
9+
prefix: "PocketMine - "
10+
cmd-send: "'%s' has sent you a message"
11+
event-start: "Start - %s"
12+
event-stop: "Stop - %s"
13+
event-auth: "%s joined '%s'"
14+
event-quit: "%s left '%s'"
15+
body:
16+
html-head: ""
17+
greeting: "<p>Hello %s,</p>"
18+
signature: "<p>From,<br>%s</p><p>--Sent by <a href='https://forums.pocketmine.net/plugins/buddynotify.1344/'>BuddyNotify</a></p>"
19+
players-hdr: "<h3>Online Players</h3><table><tr bgcolor='e8e8e8'><td><strong>Player</strong></td><td><strong>World</strong></td><td><strong>Mode</strong></td></tr>"
20+
players-row: "<tr bgcolor='f8f8f8'><td>%s</td><td>%s</td><td>%s</td></tr>"
21+
players-ftr: "</table>"
22+
event-start: "<p>Server started. Enjoy the game!</p><table cellpadding='1'><tr><td bgcolor='e8e8e8'><strong>Date</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>Server</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>Version</strong></td><td bgcolor='f8f8f8'>%s</td></tr></table>"
23+
event-stop: "<p>Server stopped. Game play will resume shortly. You will receive a message when the server is available.</p><table cellpadding='1'><tr><td bgcolor='e8e8e8'><strong>Date</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>Server</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>Version</strong></td><td bgcolor='f8f8f8'>%s</td></tr></table>"
24+
event-auth: "<p><strong>%s</strong> joined the game.</p><table cellpadding='1'><tr><td bgcolor='e8e8e8'><strong>Date</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>Server</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>World</strong></td><td bgcolor='f8f8f8'>%s</td></tr></table>"
25+
event-quit: "<p><strong>%s</strong> left the game.</p><table cellpadding='1'><tr><td bgcolor='e8e8e8'><strong>Date</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>Server</strong></td><td bgcolor='f8f8f8'>%s</td></tr><tr><td bgcolor='e8e8e8'><strong>World</strong></td><td bgcolor='f8f8f8'>%s</td></tr></table>"
26+
cmd-send: "<p>%s</p>"
27+
commands:
28+
msg-add-success: "%s added to buddy list"
29+
msg-add-error: "%s is already a buddy"
30+
msg-del-success: "%s removed from buddy list"
31+
msg-del-error: "%s is not a buddy"
32+
msg-list-email-label: "Address: "
33+
msg-list-email-unset: "Empty - use '/email reg <email>' command"
34+
msg-list-buddy-label: "Buddies: "
35+
msg-list-buddy-unset: "Empty - use '/email add <player>' command"
36+
msg-reg-success: "Email address added"
37+
msg-reg-error: "Invalid email address"
38+
msg-unreg-success: "Email address removed"
39+
msg-send-success: "Your email was sent"
40+
msg-send-general-error: "Unable to send. Contact the Admin."
41+
msg-player-not-registered: "No email address for '%s'"
42+
console:
43+
msg-all-notifications-off: "Unable to send. Check the master switch in the 'config.cfg'"
44+
msg_player_no_buddies: "%s has no buddies"
45+
msg-player-not-registered: "Unable to send. The player, %s, has not registered an email address."
46+
msg-send-error: "Unable to send. Check the 'sendmail_path' property in 'php.ini' is correct."
47+
msg-send-success: "Your email was sent"
48+
msg-sysadmin-email-notset1: "System alerts disabled. System operator email address not set in 'config.xml'."
49+
msg-sysadmin-email-notset2: "Unable to send. System operator email address not set in 'config.xml'."
50+
msg-no-registered-emails: "Unable to send. There are no registered email addresses."
51+
usage:
52+
header: "---Showing email sub-command help page"
53+
player:
54+
cmd-add: "Add buddy to your alerts"
55+
cmd-del: "Remove buddy from your alerts"
56+
cmd-list: "Show your email and buddy configuration"
57+
cmd-send: "Send a player an email"
58+
cmd-reg: "Register your email to receive alerts"
59+
cmd-unreg: "Unregister your email from receiving alerts"
60+
cmd-unsub: "Unsubscribe from a buddy's alerts"
61+
console:
62+
cmd-add: "Add buddy to player's alerts"
63+
cmd-del: "Remove buddy from player's alerts"
64+
cmd-list: "Show player's email and buddy configuration"
65+
cmd-send: "Send a player or everyone an email"
66+
cmd-reg: "Register player's email to receive alerts"
67+
cmd-unreg: "Unregister player's email from receiving alerts"
68+
cmd-unsub: "Unsubscribe player from another player's alerts"
69+
...

0 commit comments

Comments
 (0)