From 912646c0412e42df2c71515d2ea31ef64212c048 Mon Sep 17 00:00:00 2001 From: Sabrita Date: Mon, 27 Feb 2023 19:57:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E8=A2=AB=E5=85=B3=E9=97=AD=E6=97=B6=E7=9A=84=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/xephi/authme/AuthMe.java | 10 ++++------ .../xephi/authme/service/ValidationService.java | 1 + .../settings/properties/EmailSettings.java | 5 ++++- .../settings/properties/PluginSettings.java | 6 +++--- .../settings/properties/ProtectionSettings.java | 6 +++--- .../properties/RegistrationSettings.java | 17 +++++------------ src/main/resources/commands.yml | 7 +++++-- 7 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 13f359e3..e59a6e6a 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -62,8 +62,8 @@ public class AuthMe extends JavaPlugin { private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE; // Version and build number values - private static String pluginVersion = "N/D"; - private static String pluginBuildNumber = "Unknown"; + private static String pluginVersion = "5.6.0"; + private static String pluginBuildNumber = "Custom"; // Private instances private CommandHandler commandHandler; @@ -78,8 +78,6 @@ public class AuthMe extends JavaPlugin { /** * Constructor. */ - public AuthMe() { - } /* * Constructor for unit testing. @@ -313,10 +311,10 @@ public class AuthMe extends JavaPlugin { onShutdownPlayerSaver.saveAllPlayers(); } - if (settings.getProperty(EmailSettings.SHOUTDOWN_MAIL)){ + if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss"); Date date = new Date(System.currentTimeMillis()); - emailService.sendShutDown("wujiaxin752@icloud.com",dateFormat.format(date)); + emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date)); } // Do backup on stop if enabled diff --git a/src/main/java/fr/xephi/authme/service/ValidationService.java b/src/main/java/fr/xephi/authme/service/ValidationService.java index 3925a111..f9509699 100644 --- a/src/main/java/fr/xephi/authme/service/ValidationService.java +++ b/src/main/java/fr/xephi/authme/service/ValidationService.java @@ -62,6 +62,7 @@ public class ValidationService implements Reloadable { restrictedNames = settings.getProperty(RestrictionSettings.ENABLE_RESTRICTED_USERS) ? loadNameRestrictions(settings.getProperty(RestrictionSettings.RESTRICTED_USERS)) : HashMultimap.create(); + emailRegex = Utils.safePatternCompile(settings.getProperty(RestrictionSettings.ALLOWED_EMAIL_REGEX)); } diff --git a/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java b/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java index fe41a011..f634ce0a 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java @@ -75,8 +75,11 @@ public final class EmailSettings implements SettingsHolder { public static final Property OAUTH2_TOKEN = newProperty("Email.emailOauth2Token", ""); @Comment("Email notifications when the server shuts down") - public static final Property SHOUTDOWN_MAIL = + public static final Property SHUTDOWN_MAIL = newProperty("Email.shutDownEmail", true); + @Comment("Email notification address when the server is shut down") + public static final Property SHUTDOWN_MAIL_ADDRESS = + newProperty("Email.shutDownEmailAddress", "your@mail.com"); private EmailSettings() { } diff --git a/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java b/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java index 99e31757..2b024940 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java @@ -18,21 +18,21 @@ public final class PluginSettings implements SettingsHolder { "expired, he will not need to authenticate." }) public static final Property SESSIONS_ENABLED = - newProperty("settings.sessions.enabled", false); + newProperty("settings.sessions.enabled", true); @Comment({ "After how many minutes should a session expire?", "A player's session ends after the timeout or if his IP has changed" }) public static final Property SESSIONS_TIMEOUT = - newProperty("settings.sessions.timeout", 10); + newProperty("settings.sessions.timeout", 43200); @Comment({ "Message language, available languages:", "https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md" }) public static final Property MESSAGES_LANGUAGE = - newProperty("settings.messagesLanguage", "en"); + newProperty("settings.messagesLanguage", "zhcn"); @Comment({ "Enables switching a player to defined permission groups before they log in.", diff --git a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java index f8b891d0..dbdebcf6 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java @@ -14,7 +14,7 @@ public final class ProtectionSettings implements SettingsHolder { @Comment("Enable some servers protection (country based login, antibot)") public static final Property ENABLE_PROTECTION = - newProperty("Protection.enableProtection", false); + newProperty("Protection.enableProtection", true); @Comment("Apply the protection also to registered usernames") public static final Property ENABLE_PROTECTION_REGISTERED = @@ -37,7 +37,7 @@ public final class ProtectionSettings implements SettingsHolder { "Use \"LOCALHOST\" for local addresses.", "PLEASE USE QUOTES!"}) public static final Property> COUNTRIES_WHITELIST = - newListProperty("Protection.countries", "US", "GB", "LOCALHOST"); + newListProperty("Protection.countries", "CN", "LOCALHOST"); @Comment({ "Countries not allowed to join the server and register", @@ -69,7 +69,7 @@ public final class ProtectionSettings implements SettingsHolder { @Comment("Kicks the player that issued a command before the defined time after the join process") public static final Property QUICK_COMMANDS_DENIED_BEFORE_MILLISECONDS = - newProperty("Protection.quickCommands.denyCommandsBeforeMilliseconds", 1000); + newProperty("Protection.quickCommands.denyCommandsBeforeMilliseconds", 3000); private ProtectionSettings() { } diff --git a/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java b/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java index 646a8d70..dc8d3873 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java @@ -18,7 +18,7 @@ public final class RegistrationSettings implements SettingsHolder { "Send every X seconds a message to a player to", "remind him that he has to login/register"}) public static final Property MESSAGE_INTERVAL = - newProperty("settings.registration.messageInterval", 5); + newProperty("settings.registration.messageInterval", 600); @Comment({ "Only registered and logged in players can play.", @@ -55,16 +55,9 @@ public final class RegistrationSettings implements SettingsHolder { @Comment("Does AuthMe need to enforce a /login after a successful registration?") public static final Property FORCE_LOGIN_AFTER_REGISTER = newProperty("settings.registration.forceLoginAfterRegister", false); - - @Comment({ - "Broadcast the welcome message to the server or only to the player?", - "set true for server or false for player"}) - public static final Property BROADCAST_WELCOME_MESSAGE = - newProperty("settings.broadcastWelcomeMessage", false); - @Comment("Should we delay the join message and display it once the player has logged in?") public static final Property DELAY_JOIN_MESSAGE = - newProperty("settings.delayJoinMessage", false); + newProperty("settings.delayJoinMessage", true); @Comment({ "The custom join message that will be sent after a successful login,", @@ -78,15 +71,15 @@ public final class RegistrationSettings implements SettingsHolder { @Comment("Should we remove the leave messages of unlogged users?") public static final Property REMOVE_UNLOGGED_LEAVE_MESSAGE = - newProperty("settings.removeUnloggedLeaveMessage", false); + newProperty("settings.removeUnloggedLeaveMessage", true); @Comment("Should we remove join messages altogether?") public static final Property REMOVE_JOIN_MESSAGE = - newProperty("settings.removeJoinMessage", false); + newProperty("settings.removeJoinMessage", true); @Comment("Should we remove leave messages altogether?") public static final Property REMOVE_LEAVE_MESSAGE = - newProperty("settings.removeLeaveMessage", false); + newProperty("settings.removeLeaveMessage", true); @Comment("Do we need to add potion effect Blinding before login/register?") public static final Property APPLY_BLIND_EFFECT = diff --git a/src/main/resources/commands.yml b/src/main/resources/commands.yml index 6afd5a60..c2f484fc 100644 --- a/src/main/resources/commands.yml +++ b/src/main/resources/commands.yml @@ -41,7 +41,10 @@ # executor: CONSOLE # ifNumberOfAccountsAtLeast: 5 # Commands to run for players logging in whose 'last login date' was empty -onFirstLogin: {} +onFirstLogin: + broadcast: + command: 'cmi broadcast &b欢迎 &r%p &7( %ip ) &b光临服务器,请大家多多关照!' + executor: CONSOLE onJoin: {} onLogin: {} # These commands are called whenever a logged in player uses /logout or quits. @@ -52,4 +55,4 @@ onLogout: {} onRegister: {} onSessionLogin: {} # Commands to run whenever a player is unregistered (by himself, or by an admin) -onUnregister: {} \ No newline at end of file +onUnregister: {}