Compare commits

...

22 Commits
b6 ... b17

Author SHA1 Message Date
DGun Otto 912e607144 Update README.md 2023-07-10 12:53:32 +08:00
DGun Otto af71f9f5fe Update README.md 2023-07-10 12:53:02 +08:00
DGun Otto 53d4206271 Merge branch 'Stabrinai:master' into master 2023-07-02 10:59:19 +08:00
Sattera 110fc7266d [功能] 向 authme.admin.whitelistmessage
权限节点添加没有注册资格的玩家尝试入服的提醒
2023-06-24 18:47:26 +08:00
Sattera b1bee0967c [功能] 添加白名单(玩家是否注册)
玩家添加authme.whitelist权限来忽略白名单
2023-06-24 13:09:17 +08:00
DGun Otto e9481db633 Update README.md 2023-06-11 14:21:41 +08:00
DGun Otto 82f29af1ae Merge branch 'Stabrinai:master' into master 2023-06-05 00:25:02 +08:00
Sattera 7e5d9ed1e8 [功能] 添加隐藏自动登录时发送登录成功消息 2023-06-02 20:06:49 +08:00
Cai Xukun 55152a62c4 Update README.md 2023-05-18 21:56:26 +08:00
Cai Xukun 1b12d1b7d5 Update README.md 2023-05-18 18:34:18 +08:00
Cai Xukun 527f7f21c7 Add files via upload 2023-05-14 21:16:17 +08:00
Cai Xukun 0205f585df Add files via upload 2023-05-14 15:22:30 +08:00
Cai Xukun d44792baa5 Add files via upload 2023-05-13 21:49:36 +08:00
Cai Xukun 68ac58686d Add files via upload 2023-05-13 16:31:45 +08:00
Cai Xukun 25caa602fd Add files via upload 2023-05-13 12:22:38 +08:00
Cai Xukun b36590c827 Add b11 hash 2023-05-06 20:32:21 +08:00
Cai Xukun af22c47017 Add files via upload 2023-04-24 22:00:52 +08:00
Cai Xukun bf5928e841 Add files via upload 2023-04-24 02:48:15 +08:00
Cai Xukun ebf8d55d60 Add b9 hash 2023-04-24 02:33:13 +08:00
Cai Xukun 9bb99ed355 Update maven.yml 2023-04-23 21:54:56 +08:00
Cai Xukun eaa30cc5eb upload b8 sha 2023-04-23 19:48:19 +08:00
Cai Xukun 4046105e87 upload b7 hash 2023-04-23 00:47:29 +08:00
60 changed files with 242 additions and 190 deletions
+13 -136
View File
@@ -1,144 +1,21 @@
# AuthMeReReloaded # AuthMeReReloaded
**"A Fork of Authme that contains many bug fixes!"** **"A Fork of Authme that contains many bug fixes!"**
**请前往Releases下载最新版本** **请前往Releases下载最新版本**(**Download the latest version from Releases**)
<img src="wallpaper.png?raw=true" alt="AuthMeLogo"/>
| Type | Badges |
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **General:** | ![](https://tokei.rs/b1/github/AuthMe/AuthMeReloaded?category=code) ![](https://tokei.rs/b1/github/AuthMe/AuthMeReloaded?category=files) |
| **代码质量:** | [![Code Climate](https://codeclimate.com/github/AuthMe/AuthMeReloaded/badges/gpa.svg)](https://codeclimate.com/github/AuthMe/AuthMeReloaded) [![Coverage status](https://coveralls.io/repos/AuthMe-Team/AuthMeReloaded/badge.svg?branch=master&service=github)](https://coveralls.io/github/AuthMe-Team/AuthMeReloaded?branch=master) |
| **Jenkins CI:** | [![Jenkins Status](https://img.shields.io/website-up-down-green-red/http/shields.io.svg?label=ci.codemc.org)](https://ci.codemc.org/) [![Build Status](https://ci.codemc.org/buildStatus/icon?job=AuthMe/AuthMeReloaded)](https://ci.codemc.org/job/AuthMe/job/AuthMeReloaded) ![Build Tests](https://img.shields.io/jenkins/t/https/ci.codemc.org/job/AuthMe/job/AuthMeReloaded.svg) |
| **Other CIs:** | [![Build Status](https://www.travis-ci.com/AuthMe/AuthMeReloaded.svg?branch=master)](https://www.travis-ci.com/AuthMe/AuthMeReloaded) |
## Description
Prevent username stealing on your server!<br>
Use it to secure your Offline mode server or to increase your Online mode server's protection!
AuthMeReloaded disallows players who aren't authenticated to do actions like placing blocks, moving,<br>
typing commands or using the inventory. It can also kick players with uncommonly long or short player names or kick players from banned countries.
With the Session Login feature you don't have to execute the authentication command every time you connect to the server!
Each command and every feature can be enabled or disabled from our well structured configuration file.
You can also create your own translation file and, if you want, you can share it with us! :)
#### Features:
<ul>
<li><strong>E-Mail Recovery System!</strong></li>
<li>Username spoofing protection.</li>
<li>Countries Whitelist/Blacklist! <a href="https://dev.maxmind.com/geoip/legacy/codes/iso3166/">(country codes)</a></li>
<li><strong>Built-in AntiBot System!</strong></li>
<li><strong>ForceLogin Feature: Admins can login with all account via console command!</strong></li>
<li><strong>Avoid the "Logged in from another location" message!</strong></li>
<li>Two-factor (2FA) support!</li>
<li>Session Login!</li>
<li>Editable translations and messages!</li>
<li><strong>MySQL and SQLite Backend support!</strong></li>
<li>Supported password encryption algorithms: SHA256, ARGON2, BCRYPT, PBKDF2, <a href="https://github.com/CypherX/xAuth/wiki/Password-Hashing">xAuth</a></li>
<li>Supported alternative registration methods:<br>
<ul>
<li>PHPBB, VBulletin: PHPBB - MD5VB</li>
<li>Xenforo: XFBCRYPT</li>
<li>MyBB: MYBB</li>
<li>IPB3: IPB3</li>
<li>IPB4: IPB4</li>
<li>PhpFusion: PHPFUSION</li>
<li>Joomla: JOOMLA</li>
<li>WBB3: WBB3*</li>
<li>SHA512: SALTEDSHA512</li>
<li>DoubleSaltedMD5: SALTED2MD5</li>
<li>WordPress: WORDPRESS</li>
<li><a href="https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/hash_algorithms.md">List of all supported hashes</a></li>
</ul></li>
<li>Custom MySQL tables/columns names (useful with forum databases)</li>
<li><strong>Cached database queries!</strong></li>
<li><strong>Fully compatible with Citizens2, CombatTag, CombatTagPlus!</strong></li>
<li>Compatible with Minecraft mods like <strong>BuildCraft or RedstoneCraft</strong></li>
<li>Restricted users (associate a username with an IP)</li>
<li>Protect player's inventory until correct authentication (requires ProtocolLib)</li>
<li>Saves the quit location of the player</li>
<li>Automatic database backup</li>
<li>Available languages: <a href="https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md">translations</a></li>
<li>Built-in Deprecated FlatFile (auths.db) to SQL (authme.sql) converter!</li>
<li><strong>Import your old database from other plugins like Rakamak, xAuth, CrazyLogin, RoyalAuth and vAuth!</strong></li>
</ul>
#### Configuration
[How to configure AuthMe](https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/config.md)
#### Commands
[Command list and usage](https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/commands.md)
#### Permissions
- authme.player.* - for all user commands
- authme.admin.* - for all admin commands
- [List of all permission nodes](http://github.com/AuthMe/AuthMeReloaded/blob/master/docs/permission_nodes.md)
#### How To
- [How to use the converter](https://github.com/AuthMe/AuthMeReloaded/wiki/Converters)
- [How to import database from xAuth](https://dev.bukkit.org/projects/authme-reloaded/pages/how-to-import-database-from-xauth)
- [Website integration](https://github.com/AuthMe/AuthMeReloaded/tree/master/samples/website_integration)
- [How to convert from Rakamak](https://dev.bukkit.org/projects/authme-reloaded/pages/how-to-import-database-from-rakamak)
- Convert between database types (e.g. SQLite to MySQL): /authme converter
## Links and Contacts
- **Support:**
- [GitHub issue tracker](https://github.com/AuthMe/AuthMeReloaded/issues)
- [Discord](https://discord.gg/Vn9eCyE)
- [BukkitDev page](https://dev.bukkit.org/projects/authme-reloaded)
- [Spigot page](https://www.spigotmc.org/resources/authmereloaded.6269/)
- **Dev resources:** Changes to the original AuthMe(相较于原版AuthMe的变化):
- <a href="https://ci.codemc.org/job/AuthMe/job/AuthMeReloaded/javadoc/">JavaDocs</a> 1.Memory improvement
- <a href="http://repo.codemc.org/repository/maven-public/">Maven Repository</a> 2.Fixed GeoIP database
```xml 3.Hook floodgate
<repositories> 4.Choose the best performance method by server brand
<repository> 5.Anti ghost player
<id>codemc-repo</id> 6.GUI captcha for unregistered players
<url>https://repo.codemc.org/repository/maven-public/</url> 7.Block unsafe passwords by querying API
</repository> 8.Self hash check to prevent jar virus infection(abandoned)
</repositories> 9.Updater
<dependencies>
<dependency>
<groupId>fr.xephi</groupId>
<artifactId>authme</artifactId>
<version>5.6.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
```
- **Statistics:** **Known Folia issue**
![Graph](https://bstats.org/signatures/bukkit/AuthMe.svg) 1.If the teleport distance too far away,the player may be frozen
## Requirements
##### Compiling requirements:
>- JDK 11 (JDK 17 is recommended)
>- Maven
>- Git/Github (Optional)
##### How to compile the project:
>- Clone the project with Git/GitHub
>- Execute command "mvn clean package"
##### Running requirements:
>- Java 8 (Java 17 is recommended)
>- Paper or Spigot (1.8.X and up)<br>
(In case you use Thermos, Cauldron or similar, you have to update the SpecialSource library to support Java 8 plugins.
HowTo: https://github.com/games647/FastLogin/issues/111#issuecomment-272331347)
>- ProtocolLib (optional, required by some features)
## Credits
##### Contributors:
Team members: <a href="https://github.com/AuthMe/AuthMeReloaded/wiki/Development-team">developers</a>, <a href="https://github.com/AuthMe/AuthMeReloaded/wiki/Translators">translators</a>
Credits for the old version of the plugin: d4rkwarriors, fabe1337, Whoami2 and pomo4ka
Thanks also to: AS1LV3RN1NJA, Hoeze and eprimex
##### GeoIP License:
This product uses data from the GeoLite API created by MaxMind, available at https://www.maxmind.com
+1
View File
@@ -0,0 +1 @@
d91307767d8526ac84a3055ac0e773e91f88d452b4b0031f7ecfed721ac6b641
+1
View File
@@ -0,0 +1 @@
d0aab9856defbd8ef31a9cd7257c5b5761e61a7e39807708c81decf82f599323
+1
View File
@@ -0,0 +1 @@
176a6c6ea03ad8cc37d1d11c3e3608d8b59c09f9f923eae287e8192731642ec8
+1
View File
@@ -0,0 +1 @@
61b1a691490d78af1028a442143f649d432618b92c5a9a7031eb4f94817d768b
+1
View File
@@ -0,0 +1 @@
222eb5ecb4c58f279b8e2f75d38a45495ceb875f249ae3217e3f2a36e50b7d39
+1
View File
@@ -0,0 +1 @@
da53060e21d7135e479a6a6a6fd090b8f41e1423742b94e4dbb1a9230b5621fd
+1
View File
@@ -0,0 +1 @@
410df26b12703b82987b9d739c19211346418f1c954d214827805c13b5f82c98
+1
View File
@@ -0,0 +1 @@
20569ebc44a9847da0946de5a3bf2cd2b7855dffb03abc9d29204afcaa64b8bb
+1
View File
@@ -0,0 +1 @@
51a067778ad9b0938d57fd4e2975e0f8dce4914ee060efd0fd6755a8810da4f3
@@ -29,6 +29,7 @@ import fr.xephi.authme.command.executable.authme.TotpViewStatusCommand;
import fr.xephi.authme.command.executable.authme.UnregisterAdminCommand; import fr.xephi.authme.command.executable.authme.UnregisterAdminCommand;
import fr.xephi.authme.command.executable.authme.UpdateHelpMessagesCommand; import fr.xephi.authme.command.executable.authme.UpdateHelpMessagesCommand;
import fr.xephi.authme.command.executable.authme.VersionCommand; import fr.xephi.authme.command.executable.authme.VersionCommand;
import fr.xephi.authme.command.executable.authme.WhitelistCommand;
import fr.xephi.authme.command.executable.authme.debug.DebugCommand; import fr.xephi.authme.command.executable.authme.debug.DebugCommand;
import fr.xephi.authme.command.executable.captcha.CaptchaCommand; import fr.xephi.authme.command.executable.captcha.CaptchaCommand;
import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand;
@@ -420,6 +421,16 @@ public class CommandInitializer {
.executableCommand(SwitchAntiBotCommand.class) .executableCommand(SwitchAntiBotCommand.class)
.register(); .register();
CommandDescription.builder()
.parent(authmeBase)
.labels("whitelist")
.description("Switch whitelist mode")
.detailedDescription("Switch or toggle the whitelist mode to the specified state.")
.withArgument("mode", "ON / OFF", OPTIONAL)
.permission(AdminPermission.SWITCH_ANTIBOT)
.executableCommand(WhitelistCommand.class)
.register();
// Register the reload command // Register the reload command
CommandDescription.builder() CommandDescription.builder()
.parent(authmeBase) .parent(authmeBase)
@@ -0,0 +1,40 @@
package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.service.WhiteListService;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import javax.inject.Inject;
import java.util.List;
/**
* Display or change the status of the antibot mod.
*/
public class WhitelistCommand implements ExecutableCommand {
@Inject
private WhiteListService whiteListService;
@Override
public void executeCommand(final CommandSender sender, List<String> arguments) {
if (arguments.isEmpty()) {
sender.sendMessage("[AuthMe] WhiteList: " + whiteListService.getWhiteListStatus().name());
return;
}
String newState = arguments.get(0);
// Enable or disable the mod
if ("ON".equalsIgnoreCase(newState)) {
whiteListService.overrideWhiteListStatus(true);
sender.sendMessage("[AuthMe] WhiteList enabled!");
} else if ("OFF".equalsIgnoreCase(newState)) {
sender.sendMessage("[AuthMe] WhiteList disabled!");
whiteListService.overrideWhiteListStatus(false);
} else {
sender.sendMessage(ChatColor.GOLD + "Detailed help: " + ChatColor.WHITE + "/authme help whitelist");
}
}
}
@@ -70,7 +70,7 @@ public class TotpCodeCommand extends PlayerCommand {
boolean isCodeValid = totpAuthenticator.checkCode(auth, inputCode); boolean isCodeValid = totpAuthenticator.checkCode(auth, inputCode);
if (isCodeValid) { if (isCodeValid) {
logger.debug("Successfully checked TOTP code for `{0}`", player.getName()); logger.debug("Successfully checked TOTP code for `{0}`", player.getName());
asynchronousLogin.performLogin(player, auth); asynchronousLogin.performLogin(player, auth,false);
} else { } else {
logger.debug("Input TOTP code was invalid for player `{0}`", player.getName()); logger.debug("Input TOTP code was invalid for player `{0}`", player.getName());
messages.send(player, MessageKey.TWO_FACTOR_INVALID_CODE); messages.send(player, MessageKey.TWO_FACTOR_INVALID_CODE);
@@ -7,11 +7,13 @@ import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.message.MessageKey; import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages; import fr.xephi.authme.message.Messages;
import fr.xephi.authme.output.ConsoleLoggerFactory; import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.service.AntiBotService; import fr.xephi.authme.service.AntiBotService;
import fr.xephi.authme.service.BukkitService; import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.ValidationService; import fr.xephi.authme.service.ValidationService;
import fr.xephi.authme.service.WhiteListService;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.ProtectionSettings; import fr.xephi.authme.settings.properties.ProtectionSettings;
import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RegistrationSettings;
@@ -46,6 +48,8 @@ public class OnJoinVerifier implements Reloadable {
@Inject @Inject
private AntiBotService antiBotService; private AntiBotService antiBotService;
@Inject @Inject
private WhiteListService whiteListService;
@Inject
private ValidationService validationService; private ValidationService validationService;
@Inject @Inject
private BukkitService bukkitService; private BukkitService bukkitService;
@@ -81,6 +85,18 @@ public class OnJoinVerifier implements Reloadable {
throw new FailedVerificationException(MessageKey.KICK_ANTIBOT); throw new FailedVerificationException(MessageKey.KICK_ANTIBOT);
} }
} }
public void checkWhitelist(String name, boolean isAuthAvailable) throws FailedVerificationException {
if (isAuthAvailable || permissionsManager.hasPermissionOffline(name, PlayerStatePermission.WHITELIST)) {
return;
} else {
bukkitService.getOnlinePlayers().stream()
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
.forEach(player -> messages.send(player, MessageKey.WHITELIST_KICK, name));
}
if (whiteListService.shouldKick()) {
throw new FailedVerificationException(MessageKey.KICK_WHITELIST);
}
}
/** /**
* Checks whether non-registered players should be kicked, and if so, whether the player should be kicked. * Checks whether non-registered players should be kicked, and if so, whether the player should be kicked.
@@ -148,6 +148,7 @@ public class PlayerListener implements Listener {
final PlayerAuth auth = dataSource.getAuth(name); final PlayerAuth auth = dataSource.getAuth(name);
final boolean isAuthAvailable = auth != null; final boolean isAuthAvailable = auth != null;
onJoinVerifier.checkKickNonRegistered(isAuthAvailable); onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
onJoinVerifier.checkWhitelist(name, isAuthAvailable);
onJoinVerifier.checkAntibot(name, isAuthAvailable); onJoinVerifier.checkAntibot(name, isAuthAvailable);
onJoinVerifier.checkNameCasing(name, auth); onJoinVerifier.checkNameCasing(name, auth);
final String ip = event.getAddress().getHostAddress(); final String ip = event.getAddress().getHostAddress();
@@ -16,6 +16,9 @@ public enum MessageKey {
/** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */ /** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */
KICK_ANTIBOT("antibot.kick_antibot"), KICK_ANTIBOT("antibot.kick_antibot"),
KICK_WHITELIST("on_join_validation.kick_whitelist"),
WHITELIST_ENABLED_MESSAGE("misc.whitelist_enabled"),
WHITELIST_DISABLED_MESSAGE("misc.whitelist_disabled"),
/** This user isn't registered! */ /** This user isn't registered! */
UNKNOWN_USER("error.unregistered_user"), UNKNOWN_USER("error.unregistered_user"),
@@ -35,9 +38,6 @@ public enum MessageKey {
/** In-game registration is disabled! */ /** In-game registration is disabled! */
REGISTRATION_DISABLED("registration.disabled"), REGISTRATION_DISABLED("registration.disabled"),
/** Logged-in due to Session Reconnection. */
SESSION_RECONNECTION("session.valid_session"),
/** Successful login! */ /** Successful login! */
LOGIN_SUCCESS("login.success"), LOGIN_SUCCESS("login.success"),
@@ -199,6 +199,7 @@ public enum MessageKey {
/** [AntiBotService] AntiBot disabled after %m minutes! */ /** [AntiBotService] AntiBot disabled after %m minutes! */
ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"), ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"),
WHITELIST_KICK("misc.whitelist_kick", "%p"),
/** The email address is already being used */ /** The email address is already being used */
EMAIL_ALREADY_USED_ERROR("email.already_used"), EMAIL_ALREADY_USED_ERROR("email.already_used"),
@@ -30,7 +30,6 @@ final class OldMessageKeysMigrater {
.put(MessageKey.WRONG_PASSWORD, "wrong_pwd") .put(MessageKey.WRONG_PASSWORD, "wrong_pwd")
.put(MessageKey.UNREGISTERED_SUCCESS, "unregistered") .put(MessageKey.UNREGISTERED_SUCCESS, "unregistered")
.put(MessageKey.REGISTRATION_DISABLED, "reg_disabled") .put(MessageKey.REGISTRATION_DISABLED, "reg_disabled")
.put(MessageKey.SESSION_RECONNECTION, "valid_session")
.put(MessageKey.ACCOUNT_NOT_ACTIVATED, "vb_nonActiv") .put(MessageKey.ACCOUNT_NOT_ACTIVATED, "vb_nonActiv")
.put(MessageKey.NAME_ALREADY_REGISTERED, "user_regged") .put(MessageKey.NAME_ALREADY_REGISTERED, "user_regged")
.put(MessageKey.NO_PERMISSION, "no_perm") .put(MessageKey.NO_PERMISSION, "no_perm")
@@ -124,6 +124,7 @@ public enum AdminPermission implements PermissionNode {
* Permission to see Antibot messages. * Permission to see Antibot messages.
*/ */
ANTIBOT_MESSAGES("authme.admin.antibotmessages"), ANTIBOT_MESSAGES("authme.admin.antibotmessages"),
WHITELIST_MESSAGE("authme.admin.whitelistmessage"),
/** /**
* Permission to use the update messages command. * Permission to use the update messages command.
@@ -10,6 +10,7 @@ public enum PlayerStatePermission implements PermissionNode {
* Permission node to bypass AntiBot protection. * Permission node to bypass AntiBot protection.
*/ */
BYPASS_ANTIBOT("authme.bypassantibot", DefaultPermission.OP_ONLY), BYPASS_ANTIBOT("authme.bypassantibot", DefaultPermission.OP_ONLY),
WHITELIST("authme.whitelist", DefaultPermission.OP_ONLY),
/** /**
* Permission node to bypass BungeeCord server teleportation. * Permission node to bypass BungeeCord server teleportation.
@@ -54,7 +54,7 @@ public class Management {
} }
public void forceLogin(Player player) { public void forceLogin(Player player) {
runTask(() -> asynchronousLogin.forceLogin(player)); runTask(() -> asynchronousLogin.forceLogin(player,0));
} }
public void forceLogin(Player player, boolean quiet) { public void forceLogin(Player player, boolean quiet) {
@@ -19,6 +19,7 @@ import fr.xephi.authme.service.bungeecord.BungeeSender;
import fr.xephi.authme.service.bungeecord.MessageType; import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.commandconfig.CommandManager; import fr.xephi.authme.settings.commandconfig.CommandManager;
import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.util.InternetProtocolUtils; import fr.xephi.authme.util.InternetProtocolUtils;
@@ -128,18 +129,16 @@ public class AsynchronousJoin implements AsynchronousProcess {
// Session logic // Session logic
if (sessionService.canResumeSession(player)) { if (sessionService.canResumeSession(player)) {
service.send(player, MessageKey.SESSION_RECONNECTION);
// Run commands // Run commands
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask( bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
() -> commandManager.runCommandsOnSessionLogin(player)); () -> commandManager.runCommandsOnSessionLogin(player));
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player)); bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
return; return;
} else if (proxySessionManager.shouldResumeSession(name)) { } else if (proxySessionManager.shouldResumeSession(name)) {
service.send(player, MessageKey.SESSION_RECONNECTION);
// Run commands // Run commands
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask( bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
() -> commandManager.runCommandsOnSessionLogin(player)); () -> commandManager.runCommandsOnSessionLogin(player));
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player)); bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
logger.info("The user " + player.getName() + " has been automatically logged in, " logger.info("The user " + player.getName() + " has been automatically logged in, "
+ "as present in autologin queue."); + "as present in autologin queue.");
return; return;
@@ -102,7 +102,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
limboService.getLimboPlayer(player.getName()).setState(LimboPlayerState.TOTP_REQUIRED); limboService.getLimboPlayer(player.getName()).setState(LimboPlayerState.TOTP_REQUIRED);
// TODO #1141: Check if we should check limbo state before processing password // TODO #1141: Check if we should check limbo state before processing password
} else { } else {
performLogin(player, auth); performLogin(player, auth, false);
} }
} }
} }
@@ -112,10 +112,10 @@ public class AsynchronousLogin implements AsynchronousProcess {
* *
* @param player the player to log in * @param player the player to log in
*/ */
public void forceLogin(Player player) { public void forceLogin(Player player,int quiet) {
PlayerAuth auth = getPlayerAuth(player); PlayerAuth auth = getPlayerAuth(player);
if (auth != null) { if (auth != null) {
performLogin(player, auth); performLogin(player, auth, quiet == 1);
} }
} }
@@ -128,7 +128,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
public void forceLogin(Player player, boolean quiet) { public void forceLogin(Player player, boolean quiet) {
PlayerAuth auth = getPlayerAuth(player, quiet); PlayerAuth auth = getPlayerAuth(player, quiet);
if (auth != null) { if (auth != null) {
performLogin(player, auth); performLogin(player, auth, false);
} }
} }
@@ -265,7 +265,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
* @param player the player to log in * @param player the player to log in
* @param auth the associated PlayerAuth object * @param auth the associated PlayerAuth object
*/ */
public void performLogin(Player player, PlayerAuth auth) { public void performLogin(Player player, PlayerAuth auth, boolean quiet) {
if (player.isOnline()) { if (player.isOnline()) {
boolean isFirstLogin = (auth.getLastLogin() == null); boolean isFirstLogin = (auth.getLastLogin() == null);
@@ -284,7 +284,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
tempbanManager.resetCount(ip, name); tempbanManager.resetCount(ip, name);
player.setNoDamageTicks(0); player.setNoDamageTicks(0);
service.send(player, MessageKey.LOGIN_SUCCESS); if (!quiet) {service.send(player, MessageKey.LOGIN_SUCCESS);}
// Other auths // Other auths
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp()); List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
@@ -89,9 +89,9 @@ abstract class AbstractPasswordRegisterExecutor<P extends AbstractPasswordRegist
final Player player = params.getPlayer(); final Player player = params.getPlayer();
if (performLoginAfterRegister(params)) { if (performLoginAfterRegister(params)) {
if (commonService.getProperty(PluginSettings.USE_ASYNC_TASKS)) { if (commonService.getProperty(PluginSettings.USE_ASYNC_TASKS)) {
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player)); bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player,0));
} else { } else {
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player), SYNC_LOGIN_DELAY); bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player,0), SYNC_LOGIN_DELAY);
} }
} }
syncProcessManager.processSyncPasswordRegister(player); syncProcessManager.processSyncPasswordRegister(player);
@@ -0,0 +1,82 @@
package fr.xephi.authme.service;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.ProtectionSettings;
import org.bukkit.scheduler.BukkitTask;
import javax.inject.Inject;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* The AntiBot Service Management class.
*/
public class WhiteListService implements SettingsDependent {
private final PermissionsManager permissionsManager;
private final Messages messages;
private final BukkitService bukkitService;
private WhiteListStatus whiteListStatus;
@Inject
WhiteListService(Settings settings, Messages messages, PermissionsManager permissionsManager,
BukkitService bukkitService) {
// Instances
this.messages = messages;
this.permissionsManager = permissionsManager;
this.bukkitService = bukkitService;
// Initial status
whiteListStatus = WhiteListStatus.DISABLED;
// Load settings and start if required
reload(settings);
}
@Override
public void reload(Settings settings) {
}
private void startProtection() {
if (whiteListStatus == WhiteListStatus.ACTIVE) {
return;
}
whiteListStatus = WhiteListStatus.ACTIVE;
bukkitService.getOnlinePlayers().stream()
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
.forEach(player -> messages.send(player, MessageKey.WHITELIST_ENABLED_MESSAGE));
}
private void stopProtection() {
if (whiteListStatus == WhiteListStatus.DISABLED) {
return;
}
whiteListStatus = WhiteListStatus.DISABLED;
bukkitService.getOnlinePlayers().stream()
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
.forEach(player -> messages.send(player, MessageKey.WHITELIST_DISABLED_MESSAGE));
}
public WhiteListStatus getWhiteListStatus() {
return whiteListStatus;
}
public void overrideWhiteListStatus(boolean started) {
if (started) {
startProtection();
} else {
stopProtection();
}
}
public boolean shouldKick() {
return whiteListStatus != WhiteListStatus.DISABLED;
}
public enum WhiteListStatus {
DISABLED,
ACTIVE
}
}
@@ -20,6 +20,12 @@ public final class PluginSettings implements SettingsHolder {
public static final Property<Boolean> SESSIONS_ENABLED = public static final Property<Boolean> SESSIONS_ENABLED =
newProperty("settings.sessions.enabled", true); newProperty("settings.sessions.enabled", true);
@Comment({
"Do you want to hide login success message to player?"
})
public static final Property<Boolean> HIDE_SESSIONS_LOGIN =
newProperty("settings.sessions.hidelogin", true);
@Comment({ @Comment({
"After how many minutes should a session expire?", "After how many minutes should a session expire?",
"A player's session ends after the timeout or if his IP has changed" "A player's session ends after the timeout or if his IP has changed"
@@ -19,7 +19,9 @@ public final class ProtectionSettings implements SettingsHolder {
@Comment("Apply the protection also to registered usernames") @Comment("Apply the protection also to registered usernames")
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED = public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
newProperty("Protection.enableProtectionRegistered", true); newProperty("Protection.enableProtectionRegistered", true);
@Comment("Only allow registed usernames join server")
public static final Property<Boolean> ENABLE_WHITELIST =
newProperty("Protection.enableWhiteList", true);
@Comment({ @Comment({
"Countries allowed to join the server and register. For country codes, see", "Countries allowed to join the server and register. For country codes, see",
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/", "https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Сесията е продължена.'
invalid_session: '&cТвоят IP се е променил и сесията беше прекратена.' invalid_session: '&cТвоят IP се е променил и сесията беше прекратена.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -69,7 +69,7 @@ misc:
# Mensagens de sessão # Mensagens de sessão
session: session:
valid_session: '&2Você deslogou recentemente, então sua sessão foi retomada!'
invalid_session: '&fO seu IP foi alterado e sua sessão expirou!' invalid_session: '&fO seu IP foi alterado e sua sessão expirou!'
# Mensagens de erro ao entrar # Mensagens de erro ao entrar
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cAutomatické znovupřihlášení.'
invalid_session: '&cChyba: Počkej než vyprší tvoje relace.' invalid_session: '&cChyba: Počkej než vyprší tvoje relace.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Erfolgreich eingeloggt!'
invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist.' invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
invalid_session: '&cYour IP has been changed and your session data has expired!' invalid_session: '&cYour IP has been changed and your session data has expired!'
valid_session: '&2Logged-in due to Session Reconnection.'
# Error messages when joining # Error messages when joining
on_join_validation: on_join_validation:
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Ensalutantojn pro Sesio Rekonektas.'
invalid_session: '&cVia IP estis ŝanĝita kaj via seanco datumoj finiĝis!' invalid_session: '&cVia IP estis ŝanĝita kaj via seanco datumoj finiĝis!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -67,7 +67,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cInicio de sesión'
invalid_session: '&fLos datos de sesión no corresponden. Por favor espera a terminar la sesión.' invalid_session: '&fLos datos de sesión no corresponden. Por favor espera a terminar la sesión.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
invalid_session: '&cSinu IP-aadress muutus, seega sinu sessioon aegus!' invalid_session: '&cSinu IP-aadress muutus, seega sinu sessioon aegus!'
valid_session: '&2Sisse logitud sessiooni jätkumise tõttu.'
# Error messages when joining # Error messages when joining
on_join_validation: on_join_validation:
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cSesioa mantendu eta beraz ez daukazu saioa hasi beharrik.'
invalid_session: '&cZure IP helbidea aldatu da, eta horregatik zure sesioa iraungi da!' invalid_session: '&cZure IP helbidea aldatu da, eta horregatik zure sesioa iraungi da!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cIstunto jatkettu!'
invalid_session: '&fIstunto ei täsmää! Ole hyvä ja odota istunnon loppuun' invalid_session: '&fIstunto ei täsmää! Ole hyvä ja odota istunnon loppuun'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -69,7 +69,7 @@ misc:
# Session # Session
session: session:
valid_session: '&aVous avez été automatiquement connecté !'
invalid_session: 'Session expirée suite à un changement d''IP.' invalid_session: 'Session expirée suite à un changement d''IP.'
# Erreurs lors d'une tentative connexion # Erreurs lors d'une tentative connexion
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cIdentificado mediante a sesión'
invalid_session: '&fOs datos de sesión non corresponden, por favor, espere a que remate a sesión' invalid_session: '&fOs datos de sesión non corresponden, por favor, espere a que remate a sesión'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2A megadott időkereten belül csatlakoztál vissza, így a rendszer automatikusan beléptetett.'
invalid_session: '&cAz IP címed megváltozott, ezért a visszacsatlakozási időkereted lejárt.' invalid_session: '&cAz IP címed megváltozott, ezért a visszacsatlakozási időkereted lejárt.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Otomatis login, karena sesi masih terhubung.'
invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!' invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -67,7 +67,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Autenticato automaticamente attraverso la precedente sessione!'
invalid_session: '&cIl tuo indirizzo IP è cambiato e la tua sessione è stata terminata!' invalid_session: '&cIl tuo indirizzo IP è cambiato e la tua sessione è stata terminata!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -68,7 +68,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2세션 재 연결로 인해 로그인 되었습니다.'
invalid_session: '&cIP가 변경되어 세션이 만료되었습니다!' invalid_session: '&cIP가 변경되어 세션이 만료되었습니다!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&aSesijos prisijungimas'
invalid_session: '&cSesijos laikai nesutampa, prasome palaukti kol secija baigsis.' invalid_session: '&cSesijos laikai nesutampa, prasome palaukti kol secija baigsis.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Ingelogd wegens sessie-herverbinding.'
invalid_session: '&cJouw IP-adres is veranderd en je sessie is verlopen!' invalid_session: '&cJouw IP-adres is veranderd en je sessie is verlopen!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&aZalogowano automatycznie z powodu sesji logowania.'
invalid_session: '&fSesja logowania zakończona!' invalid_session: '&fSesja logowania zakończona!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cSessão válida'
invalid_session: '&fDados de sessão não correspondem. Por favor aguarde o fim da sessão' invalid_session: '&fDados de sessão não correspondem. Por favor aguarde o fim da sessão'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
invalid_session: '&cIP-ul tau a fost schimbat si sesiunea ta a expirat!' invalid_session: '&cIP-ul tau a fost schimbat si sesiunea ta a expirat!'
valid_session: '&2Conectat datorita reconectarii sesiunii.'
# Error messages when joining # Error messages when joining
on_join_validation: on_join_validation:
+1 -1
View File
@@ -61,7 +61,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Вы автоматически авторизовались!'
invalid_session: '&cСессия некорректна. Дождитесь, пока она закончится.' invalid_session: '&cСессия некорректна. Дождитесь, пока она закончится.'
# Error messages when joining # Error messages when joining
+1 -2
View File
@@ -65,7 +65,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Uspešna povezava.'
invalid_session: '&cVas IP je bil spremenjen in vasa seja je potekla!' invalid_session: '&cVas IP je bil spremenjen in vasa seja je potekla!'
# Error messages when joining # Error messages when joining
@@ -154,4 +154,3 @@ time:
hours: 'ure' hours: 'ure'
day: 'dan' day: 'dan'
days: 'dni' days: 'dni'
+1 -1
View File
@@ -72,7 +72,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&cAutomatické prihlásenie z dôvodu pokračovania relácie.'
invalid_session: '&fTvoja IP sa zmenila a tvoje prihlásenie(relácia) vypršalo(/a).' invalid_session: '&fTvoja IP sa zmenila a tvoje prihlásenie(relácia) vypršalo(/a).'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Ulogovani ste zbog ponovnog povezivanja sesije.'
invalid_session: '&cVaš IP je promenjen i vaši podaci o sesiji su istekli!' invalid_session: '&cVaš IP je promenjen i vaši podaci o sesiji su istekli!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Oturuma girisiniz otomatikmen yapilmistir.'
invalid_session: '&cIP adresin degistirildi ve oturum suren doldu!' invalid_session: '&cIP adresin degistirildi ve oturum suren doldu!'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Сесію відновлено.'
invalid_session: '&cСесію було розірвано внаслідок зміни IP.' invalid_session: '&cСесію було розірвано внаслідок зміни IP.'
# Error messages when joining # Error messages when joining
+1 -1
View File
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2Phiên đăng nhập đã được kết nối trở lại.'
invalid_session: '&cIP của bạn đã bị thay đổi và phiên đăng nhập của bạn đã hết hạn!' invalid_session: '&cIP của bạn đã bị thay đổi và phiên đăng nhập của bạn đã hết hạn!'
# Error messages when joining # Error messages when joining
@@ -65,10 +65,12 @@ misc:
usage_change_password: '&a正确用法:“/changepassword 旧密码 新密码”' usage_change_password: '&a正确用法:“/changepassword 旧密码 新密码”'
accounts_owned_self: '您拥有 %count 个账户:' accounts_owned_self: '您拥有 %count 个账户:'
accounts_owned_other: '玩家 %name 拥有 %count 个账户:' accounts_owned_other: '玩家 %name 拥有 %count 个账户:'
whitelist_enabled: '&c*** 服务器已暂停注册 ***'
whitelist_disabled: '&a*** 服务器已开放注册 ***'
whitelist_kick: '&7玩家 &c%p &7请求加入服务器,但是被拒绝了.'
# Session messages # Session messages
session: session:
valid_session: ''
invalid_session: '&c*** 请重新登录 ***' invalid_session: '&c*** 请重新登录 ***'
# Error messages when joining # Error messages when joining
@@ -88,7 +90,10 @@ on_join_validation:
&c如果您并不知情,请更换您的用户名重新加入该服务器. &c如果您并不知情,请更换您的用户名重新加入该服务器.
invalid_name_case: '&c您应该使用 %valid 登录服务器,当前名字: %invalid .' invalid_name_case: '&c您应该使用 %valid 登录服务器,当前名字: %invalid .'
quick_command: '&c您发送命令的速度太快了,请重新加入服务器等待一会后再使用命令' quick_command: '&c您发送命令的速度太快了,请重新加入服务器等待一会后再使用命令'
kick_whitelist: |-
&6[&b&lAccount Security System&6]
&c本服务器已经暂停注册,请用下面的联系方式了解详细情况.
&cQQ群聊号码: 550984860 &b| &c QQ: 2125368097 &b| &cTelegram: @Stabrinai
# Email # Email
email: email:
add_email_request: '' add_email_request: ''
@@ -69,7 +69,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&8[&6用戶系統&8] &b嗨 歡迎回來喔~'
invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞,請等待登入階段結束。' invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞,請等待登入階段結束。'
# Error messages when joining # Error messages when joining
@@ -66,7 +66,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&2由於會話重新連接而登錄.'
invalid_session: '&c您的IP已更改,並且您的會話數據已過期!' invalid_session: '&c您的IP已更改,並且您的會話數據已過期!'
# Error messages when joining # Error messages when joining
@@ -68,7 +68,7 @@ misc:
# Session messages # Session messages
session: session:
valid_session: '&b【AuthMe】&6您已經成功登入!'
invalid_session: '&b【AuthMe】&6Session驗證不相符!' invalid_session: '&b【AuthMe】&6Session驗證不相符!'
# Error messages when joining # Error messages when joining
+3
View File
@@ -184,6 +184,9 @@ permissions:
authme.bypassantibot: authme.bypassantibot:
description: Permission node to bypass AntiBot protection. description: Permission node to bypass AntiBot protection.
default: op default: op
authme.whitelist:
description: Permission node to whitelist.
default: op
authme.bypasscountrycheck: authme.bypasscountrycheck:
description: Permission to bypass the GeoIp country code check. description: Permission to bypass the GeoIp country code check.
default: false default: false