diff --git a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java index 8b6b2d51f16..013ef74d6aa 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java @@ -574,6 +574,17 @@ public void onPlayerLogin(final PlayerLoginEvent event) { event.disallow(Result.KICK_FULL, tlLiteral("serverFull")); } } + if (event.getResult() == Result.KICK_WHITELIST) { + final User kfuser = ess.getUser(event.getPlayer()); + kfuser.update(event.getPlayer()); + if (kfuser.isAuthorized("essentials.whitelist.bypass")) { + event.allow(); + return; + } + if (ess.getSettings().isCustomWhitelistMessage()) { + event.disallow(Result.KICK_WHITELIST, tlLiteral("whitelistKick")); + } + } } @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) diff --git a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java index 302d3a15783..1f82c27f270 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java @@ -318,6 +318,8 @@ public interface ISettings extends IConf { boolean isCustomServerFullMessage(); + boolean isCustomWhitelistMessage(); + boolean isNotifyNoNewMail(); boolean isDropItemsIfFull(); diff --git a/Essentials/src/main/java/com/earth2me/essentials/Settings.java b/Essentials/src/main/java/com/earth2me/essentials/Settings.java index 45d47db0b11..b9cb054e680 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/Settings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/Settings.java @@ -1634,6 +1634,11 @@ public boolean isCustomServerFullMessage() { return config.getBoolean("use-custom-server-full-message", true); } + @Override + public boolean isCustomWhitelistMessage() { + return config.getBoolean("use-custom-whitelist-message", true); + } + @Override public int getJoinQuitMessagePlayerCount() { return config.getInt("hide-join-quit-messages-above", -1); @@ -2139,7 +2144,7 @@ public boolean showZeroBaltop() { public String getNickRegex() { return config.getString("allowed-nicks-regex", "^[a-zA-Z_0-9ยง]+$"); } - + @Override public BigDecimal getMultiplier(final User user) { BigDecimal multiplier = defaultMultiplier; diff --git a/Essentials/src/main/resources/config.yml b/Essentials/src/main/resources/config.yml index 27eafcae5bd..479472dc675 100644 --- a/Essentials/src/main/resources/config.yml +++ b/Essentials/src/main/resources/config.yml @@ -597,6 +597,10 @@ custom-new-username-message: "none" # Set to false to keep the vanilla message. use-custom-server-full-message: true +# Should Essentials override the vanilla "You are not whitelisted on this server" message with its own from the language file? +# Set to false to keep the vanilla message. +use-custom-whitelist-message: true + # You can disable join and quit messages when the player count reaches a certain limit. # When the player count is below this number, join/quit messages will always be shown. # Set this to -1 to always show join and quit messages regardless of player count. diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 0274cd4acec..7385893f059 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -1131,6 +1131,7 @@ sellCommandUsage4=/ blocks [amount] sellCommandUsage4Description=Sells all (or the given amount, if specified) of blocks in your inventory sellHandPermission=You do not have permission to hand sell. serverFull=Server is full\! +whitelistKick=Whitelist enabled\! serverReloading=There's a good chance you're reloading your server right now. If that's the case, why do you hate yourself? Expect no support from the EssentialsX team when using /reload. serverTotal=Server Total\: {0} serverUnsupported=You are running an unsupported server version\! diff --git a/Essentials/src/main/resources/plugin.yml b/Essentials/src/main/resources/plugin.yml index ad605a788f9..5ae740a886d 100644 --- a/Essentials/src/main/resources/plugin.yml +++ b/Essentials/src/main/resources/plugin.yml @@ -968,6 +968,8 @@ permissions: description: Allows the user to keep their exp on death, instead of dropping it. essentials.joinfullserver: description: Allows the to join the server even if it is full + essentials.whitelist.bypass: + description: Allows a player to join the server even if they are not whitelisted. essentials.kick: description: Allows access to the /kick command essentials.kick.exempt: