From e287600c34d832f95d0d3e6c48f0dd2ab9b79e9e Mon Sep 17 00:00:00 2001 From: Daniil Date: Mon, 11 Jan 2021 08:10:07 +0300 Subject: [PATCH] Add option to disable custom server-full message (#3899) Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com> --- .../com/earth2me/essentials/EssentialsPlayerListener.java | 4 +++- .../src/main/java/com/earth2me/essentials/ISettings.java | 2 ++ .../src/main/java/com/earth2me/essentials/Settings.java | 5 +++++ Essentials/src/main/resources/config.yml | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java index 576f10a36..d0c1b8675 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java @@ -473,7 +473,9 @@ public class EssentialsPlayerListener implements Listener { event.allow(); return; } - event.disallow(Result.KICK_FULL, tl("serverFull")); + if (ess.getSettings().isCustomServerFullMessage()) { + event.disallow(Result.KICK_FULL, tl("serverFull")); + } } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java index 549dcce25..221e4a2d5 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java @@ -285,6 +285,8 @@ public interface ISettings extends IConf { String getCustomQuitMessage(); + boolean isCustomServerFullMessage(); + 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 0267ead15..9823af633 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/Settings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/Settings.java @@ -1276,6 +1276,11 @@ public class Settings implements net.ess3.api.ISettings { return isCustomQuitMessage; } + @Override + public boolean isCustomServerFullMessage() { + return config.getBoolean("use-custom-server-full-message", true); + } + @Override public int getJoinQuitMessagePlayerCount() { return config.getInt("hide-join-quit-messages-above", -1); diff --git a/Essentials/src/main/resources/config.yml b/Essentials/src/main/resources/config.yml index 8947f0890..505784708 100644 --- a/Essentials/src/main/resources/config.yml +++ b/Essentials/src/main/resources/config.yml @@ -500,6 +500,10 @@ allow-silent-join-quit: false custom-join-message: "none" custom-quit-message: "none" +# Should Essentials override the vanilla "Server Full" message with its own from the language file? +# Set to false to keep the vanilla message. +use-custom-server-full-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.