Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 912e607144 | |||
| af71f9f5fe | |||
| 53d4206271 | |||
| 110fc7266d | |||
| b1bee0967c | |||
| e9481db633 | |||
| 82f29af1ae | |||
| 7e5d9ed1e8 | |||
| 55152a62c4 | |||
| 1b12d1b7d5 | |||
| 527f7f21c7 | |||
| 0205f585df | |||
| d44792baa5 | |||
| 68ac58686d | |||
| 25caa602fd | |||
| b36590c827 | |||
| af22c47017 | |||
| bf5928e841 | |||
| ebf8d55d60 | |||
| 9bb99ed355 | |||
| eaa30cc5eb | |||
| 4046105e87 | |||
| e782cccf72 | |||
| eaa0fba587 | |||
| cc248c3459 | |||
| ab24793861 | |||
| 25ebbf6f20 | |||
| d3e463165d | |||
| a459e6bad8 |
@@ -1,144 +1,21 @@
|
||||
# AuthMeReReloaded
|
||||
**"A Fork of Authme that contains many bug fixes!"**
|
||||
**请前往Releases下载最新版本**
|
||||
<img src="wallpaper.png?raw=true" alt="AuthMeLogo"/>
|
||||
|
||||
| Type | Badges |
|
||||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **General:** |   |
|
||||
| **代码质量:** | [](https://codeclimate.com/github/AuthMe/AuthMeReloaded) [](https://coveralls.io/github/AuthMe-Team/AuthMeReloaded?branch=master) |
|
||||
| **Jenkins CI:** | [](https://ci.codemc.org/) [](https://ci.codemc.org/job/AuthMe/job/AuthMeReloaded)  |
|
||||
| **Other CIs:** | [](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
|
||||
**请前往Releases下载最新版本**(**Download the latest version from Releases**)
|
||||
|
||||
|
||||
## 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:**
|
||||
- <a href="https://ci.codemc.org/job/AuthMe/job/AuthMeReloaded/javadoc/">JavaDocs</a>
|
||||
- <a href="http://repo.codemc.org/repository/maven-public/">Maven Repository</a>
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
Changes to the original AuthMe(相较于原版AuthMe的变化):
|
||||
1.Memory improvement
|
||||
2.Fixed GeoIP database
|
||||
3.Hook floodgate
|
||||
4.Choose the best performance method by server brand
|
||||
5.Anti ghost player
|
||||
6.GUI captcha for unregistered players
|
||||
7.Block unsafe passwords by querying API
|
||||
8.Self hash check to prevent jar virus infection(abandoned)
|
||||
9.Updater
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.xephi</groupId>
|
||||
<artifactId>authme</artifactId>
|
||||
<version>5.6.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
- **Statistics:**
|
||||

|
||||
|
||||
## 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
|
||||
**Known Folia issue**
|
||||
1.If the teleport distance too far away,the player may be frozen
|
||||
|
||||
@@ -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.UpdateHelpMessagesCommand;
|
||||
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.captcha.CaptchaCommand;
|
||||
import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand;
|
||||
@@ -420,6 +421,16 @@ public class CommandInitializer {
|
||||
.executableCommand(SwitchAntiBotCommand.class)
|
||||
.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
|
||||
CommandDescription.builder()
|
||||
.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);
|
||||
if (isCodeValid) {
|
||||
logger.debug("Successfully checked TOTP code for `{0}`", player.getName());
|
||||
asynchronousLogin.performLogin(player, auth);
|
||||
asynchronousLogin.performLogin(player, auth,false);
|
||||
} else {
|
||||
logger.debug("Input TOTP code was invalid for player `{0}`", player.getName());
|
||||
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.Messages;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.permission.AdminPermission;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
import fr.xephi.authme.service.AntiBotService;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.WhiteListService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
@@ -46,6 +48,8 @@ public class OnJoinVerifier implements Reloadable {
|
||||
@Inject
|
||||
private AntiBotService antiBotService;
|
||||
@Inject
|
||||
private WhiteListService whiteListService;
|
||||
@Inject
|
||||
private ValidationService validationService;
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
@@ -81,6 +85,18 @@ public class OnJoinVerifier implements Reloadable {
|
||||
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.
|
||||
|
||||
@@ -148,6 +148,7 @@ public class PlayerListener implements Listener {
|
||||
final PlayerAuth auth = dataSource.getAuth(name);
|
||||
final boolean isAuthAvailable = auth != null;
|
||||
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
||||
onJoinVerifier.checkWhitelist(name, isAuthAvailable);
|
||||
onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
||||
onJoinVerifier.checkNameCasing(name, auth);
|
||||
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. */
|
||||
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! */
|
||||
UNKNOWN_USER("error.unregistered_user"),
|
||||
@@ -35,9 +38,6 @@ public enum MessageKey {
|
||||
/** In-game registration is disabled! */
|
||||
REGISTRATION_DISABLED("registration.disabled"),
|
||||
|
||||
/** Logged-in due to Session Reconnection. */
|
||||
SESSION_RECONNECTION("session.valid_session"),
|
||||
|
||||
/** Successful login! */
|
||||
LOGIN_SUCCESS("login.success"),
|
||||
|
||||
@@ -199,6 +199,7 @@ public enum MessageKey {
|
||||
|
||||
/** [AntiBotService] AntiBot disabled after %m minutes! */
|
||||
ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"),
|
||||
WHITELIST_KICK("misc.whitelist_kick", "%p"),
|
||||
|
||||
/** The email address is already being used */
|
||||
EMAIL_ALREADY_USED_ERROR("email.already_used"),
|
||||
|
||||
@@ -30,7 +30,6 @@ final class OldMessageKeysMigrater {
|
||||
.put(MessageKey.WRONG_PASSWORD, "wrong_pwd")
|
||||
.put(MessageKey.UNREGISTERED_SUCCESS, "unregistered")
|
||||
.put(MessageKey.REGISTRATION_DISABLED, "reg_disabled")
|
||||
.put(MessageKey.SESSION_RECONNECTION, "valid_session")
|
||||
.put(MessageKey.ACCOUNT_NOT_ACTIVATED, "vb_nonActiv")
|
||||
.put(MessageKey.NAME_ALREADY_REGISTERED, "user_regged")
|
||||
.put(MessageKey.NO_PERMISSION, "no_perm")
|
||||
|
||||
@@ -124,6 +124,7 @@ public enum AdminPermission implements PermissionNode {
|
||||
* Permission to see Antibot messages.
|
||||
*/
|
||||
ANTIBOT_MESSAGES("authme.admin.antibotmessages"),
|
||||
WHITELIST_MESSAGE("authme.admin.whitelistmessage"),
|
||||
|
||||
/**
|
||||
* Permission to use the update messages command.
|
||||
|
||||
@@ -10,6 +10,7 @@ public enum PlayerStatePermission implements PermissionNode {
|
||||
* Permission node to bypass AntiBot protection.
|
||||
*/
|
||||
BYPASS_ANTIBOT("authme.bypassantibot", DefaultPermission.OP_ONLY),
|
||||
WHITELIST("authme.whitelist", DefaultPermission.OP_ONLY),
|
||||
|
||||
/**
|
||||
* Permission node to bypass BungeeCord server teleportation.
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Management {
|
||||
}
|
||||
|
||||
public void forceLogin(Player player) {
|
||||
runTask(() -> asynchronousLogin.forceLogin(player));
|
||||
runTask(() -> asynchronousLogin.forceLogin(player,0));
|
||||
}
|
||||
|
||||
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.settings.commandconfig.CommandManager;
|
||||
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.RestrictionSettings;
|
||||
import fr.xephi.authme.util.InternetProtocolUtils;
|
||||
@@ -128,18 +129,16 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
|
||||
// Session logic
|
||||
if (sessionService.canResumeSession(player)) {
|
||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
||||
// Run commands
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||
() -> commandManager.runCommandsOnSessionLogin(player));
|
||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player));
|
||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
|
||||
return;
|
||||
} else if (proxySessionManager.shouldResumeSession(name)) {
|
||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
||||
// Run commands
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||
() -> 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, "
|
||||
+ "as present in autologin queue.");
|
||||
return;
|
||||
|
||||
@@ -102,7 +102,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
limboService.getLimboPlayer(player.getName()).setState(LimboPlayerState.TOTP_REQUIRED);
|
||||
// TODO #1141: Check if we should check limbo state before processing password
|
||||
} else {
|
||||
performLogin(player, auth);
|
||||
performLogin(player, auth, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,10 +112,10 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
*
|
||||
* @param player the player to log in
|
||||
*/
|
||||
public void forceLogin(Player player) {
|
||||
public void forceLogin(Player player,int quiet) {
|
||||
PlayerAuth auth = getPlayerAuth(player);
|
||||
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) {
|
||||
PlayerAuth auth = getPlayerAuth(player, quiet);
|
||||
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 auth the associated PlayerAuth object
|
||||
*/
|
||||
public void performLogin(Player player, PlayerAuth auth) {
|
||||
public void performLogin(Player player, PlayerAuth auth, boolean quiet) {
|
||||
if (player.isOnline()) {
|
||||
boolean isFirstLogin = (auth.getLastLogin() == null);
|
||||
|
||||
@@ -284,7 +284,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
tempbanManager.resetCount(ip, name);
|
||||
player.setNoDamageTicks(0);
|
||||
|
||||
service.send(player, MessageKey.LOGIN_SUCCESS);
|
||||
if (!quiet) {service.send(player, MessageKey.LOGIN_SUCCESS);}
|
||||
|
||||
// Other auths
|
||||
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
|
||||
|
||||
+2
-2
@@ -89,9 +89,9 @@ abstract class AbstractPasswordRegisterExecutor<P extends AbstractPasswordRegist
|
||||
final Player player = params.getPlayer();
|
||||
if (performLoginAfterRegister(params)) {
|
||||
if (commonService.getProperty(PluginSettings.USE_ASYNC_TASKS)) {
|
||||
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player));
|
||||
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player,0));
|
||||
} else {
|
||||
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player), SYNC_LOGIN_DELAY);
|
||||
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player,0), SYNC_LOGIN_DELAY);
|
||||
}
|
||||
}
|
||||
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 =
|
||||
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({
|
||||
"After how many minutes should a session expire?",
|
||||
"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")
|
||||
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
|
||||
newProperty("Protection.enableProtectionRegistered", true);
|
||||
|
||||
@Comment("Only allow registed usernames join server")
|
||||
public static final Property<Boolean> ENABLE_WHITELIST =
|
||||
newProperty("Protection.enableWhiteList", true);
|
||||
@Comment({
|
||||
"Countries allowed to join the server and register. For country codes, see",
|
||||
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Сесията е продължена.'
|
||||
|
||||
invalid_session: '&cТвоят IP се е променил и сесията беше прекратена.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -69,7 +69,7 @@ misc:
|
||||
|
||||
# Mensagens de sessão
|
||||
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!'
|
||||
|
||||
# Mensagens de erro ao entrar
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&cAutomatické znovupřihlášení.'
|
||||
|
||||
invalid_session: '&cChyba: Počkej než vyprší tvoje relace.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Erfolgreich eingeloggt!'
|
||||
|
||||
invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
# Session messages
|
||||
session:
|
||||
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
|
||||
on_join_validation:
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Ensalutantojn pro Sesio Rekonektas.'
|
||||
|
||||
invalid_session: '&cVia IP estis ŝanĝita kaj via seanco datumoj finiĝis!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -67,7 +67,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&cInicio de sesión'
|
||||
|
||||
invalid_session: '&fLos datos de sesión no corresponden. Por favor espera a terminar la sesión.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
# Session messages
|
||||
session:
|
||||
invalid_session: '&cSinu IP-aadress muutus, seega sinu sessioon aegus!'
|
||||
valid_session: '&2Sisse logitud sessiooni jätkumise tõttu.'
|
||||
|
||||
|
||||
# Error messages when joining
|
||||
on_join_validation:
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
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!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&cIstunto jatkettu!'
|
||||
|
||||
invalid_session: '&fIstunto ei täsmää! Ole hyvä ja odota istunnon loppuun'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -69,7 +69,7 @@ misc:
|
||||
|
||||
# Session
|
||||
session:
|
||||
valid_session: '&aVous avez été automatiquement connecté !'
|
||||
|
||||
invalid_session: 'Session expirée suite à un changement d''IP.'
|
||||
|
||||
# Erreurs lors d'une tentative connexion
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
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'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
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.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Otomatis login, karena sesi masih terhubung.'
|
||||
|
||||
invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -67,7 +67,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Autenticato automaticamente attraverso la precedente sessione!'
|
||||
|
||||
invalid_session: '&cIl tuo indirizzo IP è cambiato e la tua sessione è stata terminata!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -68,7 +68,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2세션 재 연결로 인해 로그인 되었습니다.'
|
||||
|
||||
invalid_session: '&cIP가 변경되어 세션이 만료되었습니다!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&aSesijos prisijungimas'
|
||||
|
||||
invalid_session: '&cSesijos laikai nesutampa, prasome palaukti kol secija baigsis.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Ingelogd wegens sessie-herverbinding.'
|
||||
|
||||
invalid_session: '&cJouw IP-adres is veranderd en je sessie is verlopen!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&aZalogowano automatycznie z powodu sesji logowania.'
|
||||
|
||||
invalid_session: '&fSesja logowania zakończona!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&cSessão válida'
|
||||
|
||||
invalid_session: '&fDados de sessão não correspondem. Por favor aguarde o fim da sessão'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
# Session messages
|
||||
session:
|
||||
invalid_session: '&cIP-ul tau a fost schimbat si sesiunea ta a expirat!'
|
||||
valid_session: '&2Conectat datorita reconectarii sesiunii.'
|
||||
|
||||
|
||||
# Error messages when joining
|
||||
on_join_validation:
|
||||
|
||||
@@ -61,7 +61,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Вы автоматически авторизовались!'
|
||||
|
||||
invalid_session: '&cСессия некорректна. Дождитесь, пока она закончится.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -65,7 +65,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Uspešna povezava.'
|
||||
|
||||
invalid_session: '&cVas IP je bil spremenjen in vasa seja je potekla!'
|
||||
|
||||
# Error messages when joining
|
||||
@@ -154,4 +154,3 @@ time:
|
||||
hours: 'ure'
|
||||
day: 'dan'
|
||||
days: 'dni'
|
||||
|
||||
@@ -72,7 +72,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
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).'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Ulogovani ste zbog ponovnog povezivanja sesije.'
|
||||
|
||||
invalid_session: '&cVaš IP je promenjen i vaši podaci o sesiji su istekli!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Oturuma girisiniz otomatikmen yapilmistir.'
|
||||
|
||||
invalid_session: '&cIP adresin degistirildi ve oturum suren doldu!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2Сесію відновлено.'
|
||||
|
||||
invalid_session: '&cСесію було розірвано внаслідок зміни IP.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
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!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -65,10 +65,12 @@ misc:
|
||||
usage_change_password: '&a正确用法:“/changepassword 旧密码 新密码”'
|
||||
accounts_owned_self: '您拥有 %count 个账户:'
|
||||
accounts_owned_other: '玩家 %name 拥有 %count 个账户:'
|
||||
whitelist_enabled: '&c*** 服务器已暂停注册 ***'
|
||||
whitelist_disabled: '&a*** 服务器已开放注册 ***'
|
||||
whitelist_kick: '&7玩家 &c%p &7请求加入服务器,但是被拒绝了.'
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: ''
|
||||
invalid_session: '&c*** 请重新登录 ***'
|
||||
|
||||
# Error messages when joining
|
||||
@@ -88,7 +90,10 @@ on_join_validation:
|
||||
&c如果您并不知情,请更换您的用户名重新加入该服务器.
|
||||
invalid_name_case: '&c您应该使用 %valid 登录服务器,当前名字: %invalid .'
|
||||
quick_command: '&c您发送命令的速度太快了,请重新加入服务器等待一会后再使用命令'
|
||||
|
||||
kick_whitelist: |-
|
||||
&6[&b&lAccount Security System&6]
|
||||
&c本服务器已经暂停注册,请用下面的联系方式了解详细情况.
|
||||
&cQQ群聊号码: 550984860 &b| &c QQ: 2125368097 &b| &cTelegram: @Stabrinai
|
||||
# Email
|
||||
email:
|
||||
add_email_request: ''
|
||||
|
||||
@@ -69,7 +69,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&8[&6用戶系統&8] &b嗨 ! 歡迎回來喔~'
|
||||
|
||||
invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞,請等待登入階段結束。'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&2由於會話重新連接而登錄.'
|
||||
|
||||
invalid_session: '&c您的IP已更改,並且您的會話數據已過期!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -68,7 +68,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: '&b【AuthMe】&6您已經成功登入!'
|
||||
|
||||
invalid_session: '&b【AuthMe】&6Session驗證不相符!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -184,6 +184,9 @@ permissions:
|
||||
authme.bypassantibot:
|
||||
description: Permission node to bypass AntiBot protection.
|
||||
default: op
|
||||
authme.whitelist:
|
||||
description: Permission node to whitelist.
|
||||
default: op
|
||||
authme.bypasscountrycheck:
|
||||
description: Permission to bypass the GeoIp country code check.
|
||||
default: false
|
||||
|
||||
Reference in New Issue
Block a user