change join/leave messages behaviour

This commit is contained in:
Gabriele C 2016-02-11 20:53:25 +01:00
parent 131cc22248
commit 0afa5f0535
4 changed files with 26 additions and 7 deletions

View File

@ -421,7 +421,9 @@ settings:
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
broadcastWelcomeMessage: false
# Do we need to delay the join/leave message to be displayed only when the player is authenticated ?
delayJoinLeaveMessages: true
delayJoinMessage: false
removeJoinMessage: false
removeLeaveMessage: false
# Do we need to add potion effect Blinding before login/register ?
applyBlindEffect: false
ExternalBoardOptions:

View File

@ -191,7 +191,15 @@ public class AuthMePlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoinMessage(PlayerJoinEvent event) {
final Player player = event.getPlayer();
if (player == null || !Settings.delayJoinLeaveMessages) {
if (player == null) {
return;
}
if (Settings.removeJoinMessage) {
event.setJoinMessage((String)null);
return;
}
if (!Settings.delayJoinMessage) {
return;
}
@ -357,7 +365,7 @@ public class AuthMePlayerListener implements Listener {
return;
}
if (Settings.delayJoinLeaveMessages && !Utils.checkAuth(player)) {
if (Settings.removeLeaveMessage) {
event.setQuitMessage((String)null);
}

View File

@ -64,7 +64,7 @@ public final class Settings {
purgeLimitedCreative, purgeAntiXray, purgePermissions,
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
checkVeryGames, removeJoinMessage, removeLeaveMessage, delayJoinMessage, noTeleport, applyBlindEffect,
kickPlayersBeforeStopping, allowAllCommandsIfRegIsOptional,
customAttributes, generateImage, isRemoveSpeedEnabled, preventOtherCase;
public static String getNickRegex, getUnloggedinGroup, getMySQLHost,
@ -241,7 +241,9 @@ public final class Settings {
getMaxLoginPerIp = configFile.getInt("settings.restrictions.maxLoginPerIp", 0);
getMaxJoinPerIp = configFile.getInt("settings.restrictions.maxJoinPerIp", 0);
checkVeryGames = configFile.getBoolean("VeryGames.enableIpCheck", false);
delayJoinLeaveMessages = configFile.getBoolean("settings.delayJoinLeaveMessages", false);
removeJoinMessage = configFile.getBoolean("settings.removeJoineMessage", false);
removeLeaveMessage = configFile.getBoolean("settings.removeLeaveMessage", false);
delayJoinMessage = configFile.getBoolean("settings.delayJoineMessage", false);
noTeleport = configFile.getBoolean("settings.restrictions.noTeleport", false);
crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db");
getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters", "[\\x21-\\x7E]*");

View File

@ -81,8 +81,15 @@ public class RegistrationSettings implements SettingsClass {
newProperty("settings.broadcastWelcomeMessage", false);
@Comment("Do we need to delay the join/leave message to be displayed only when the player is authenticated?")
public static final Property<Boolean> DELAY_JOIN_LEAVE_MESSAGES =
newProperty("settings.delayJoinLeaveMessages", true);
public static final Property<Boolean> DELAY_JOIN_MESSAGE =
newProperty("settings.delayJoinMessage", false);
// TODO: comments!
public static final Property<Boolean> REMOVE_JOIN_MESSAGE =
newProperty("settings.removeJoinMessages", false);
public static final Property<Boolean> REMOVE_LEAVE_MESSAGE =
newProperty("settings.removeLeaveMessages", false);
@Comment("Do we need to add potion effect Blinding before login/reigster?")
public static final Property<Boolean> APPLY_BLIND_EFFECT =