Add option "customJoinMessage" #1044

This commit is contained in:
Gabriele C
2017-01-05 01:39:24 +01:00
parent 979d8b98c4
commit dcf046dfc5
3 changed files with 22 additions and 2 deletions
@@ -170,6 +170,11 @@ public class PlayerListener implements Listener {
return;
}
String customJoinMessage = settings.getProperty(RegistrationSettings.CUSTOM_JOIN_MESSAGE);
if (customJoinMessage.isEmpty() && ! customJoinMessage.equalsIgnoreCase("none")) {
event.setJoinMessage(customJoinMessage.replace("{PLAYERNAME}", player.getName())
.replace("{DISPLAYNAME]", player.getDisplayName()));
}
if (settings.getProperty(RegistrationSettings.REMOVE_JOIN_MESSAGE)) {
event.setJoinMessage(null);
return;
@@ -73,6 +73,15 @@ public class RegistrationSettings implements SettingsHolder {
public static final Property<Boolean> DELAY_JOIN_MESSAGE =
newProperty("settings.delayJoinMessage", false);
@Comment({
"The custom join message that will be sent after a successful login,",
"use 'none' to use the original one.",
"Available variables:,",
"{PLAYERNAME}: the player name (no colors)",
"{DISPLAYNAME}: the player name (with colors)"})
public static final Property<String> CUSTOM_JOIN_MESSAGE =
newProperty("settings.customJoinMessage", "none");
@Comment("Should we remove the leave messages of unlogged users?")
public static final Property<Boolean> REMOVE_UNLOGGED_LEAVE_MESSAGE =
newProperty("settings.removeUnloggedLeaveMessage", false);