Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 010874586a | |||
| fcc34c28aa | |||
| ecbc11cf0b | |||
| bfd3a8f439 | |||
| f8dd410d96 | |||
| 2459aec4b6 | |||
| d623337a15 | |||
| 73c3cea778 | |||
| 11a4cff10a | |||
| 628d5adcb5 | |||
| 8681cd0733 | |||
| bb2fdbfb40 | |||
| 4dedc30d94 | |||
| fa995eea53 | |||
| e819be918b | |||
| 1e3e625c1a | |||
| b747a4bdff | |||
| 03443104be | |||
| 819e55e235 | |||
| 80b06f3bc7 | |||
| d90e87896c | |||
| 72073b80f0 | |||
| 19866bc4a4 | |||
| cf4037614a | |||
| 5c22601c52 | |||
| 1bb3bb1fa7 | |||
| 11959ca794 | |||
| 9ba9af6369 | |||
| 584f2074fd | |||
| 2971a0a202 | |||
| 3cc8128faa | |||
| 1ef7ed4b3f | |||
| 59eabe38c6 | |||
| 1c090a5a65 | |||
| 82fade61d5 | |||
| fc5009bf0d | |||
| 9fe91fe22c | |||
| 37d327bcb6 | |||
| 217b411095 | |||
| 9239f3a90d | |||
| ae9d9ea159 | |||
| 12cfd243f6 | |||
| 059c00c2ad | |||
| 3dab24c142 | |||
| 4de55f9cf6 | |||
| 07d9bbbf7c | |||
| c182510a46 | |||
| aec1277ab3 | |||
| 32b694cbb0 | |||
| 932368f2d6 | |||
| 7a33fc8928 | |||
| d048db44ba | |||
| 76b92bacd9 | |||
| dadae42992 | |||
| 1e9058a5cb | |||
| b307911896 | |||
| 11a1547242 | |||
| 17ee5dc97b | |||
| ac89630f5d | |||
| 94028484cf | |||
| 1b1fd77470 | |||
| 7a7b148a7d | |||
| e6cee92ef1 | |||
| 31123081c7 | |||
| b5b435d398 | |||
| 395f8f825f | |||
| c71bd9f3a8 | |||
| 3e971c3dfd | |||
| 3f372d9228 | |||
| d385093403 | |||
| f978b285ae | |||
| 1eeaa442db | |||
| 14cc0abdc5 | |||
| d5ce692933 | |||
| 56a7b90c99 | |||
| 9352e7f32e | |||
| 0fc2f61a42 | |||
| 25249125b1 | |||
| 9d6d325fa6 | |||
| 0d408ede47 |
+2
-1
@@ -21,9 +21,10 @@ hs_err_pid*
|
|||||||
|
|
||||||
# Ignore IDEA directory
|
# Ignore IDEA directory
|
||||||
.idea/*
|
.idea/*
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
|
||||||
# Include the project's code style settings file
|
# Include the project's code style settings file
|
||||||
!.idea/codeStyleSettings.xml
|
|
||||||
|
|
||||||
# File-based project format:
|
# File-based project format:
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
|
|||||||
3. Old bug fixes
|
3. Old bug fixes
|
||||||
4. Anti Ghost Player(Doubled login bug)
|
4. Anti Ghost Player(Doubled login bug)
|
||||||
5. Use the best performance method by server brand
|
5. Use the best performance method by server brand
|
||||||
6. Bedrock Compatibility(Floodgate needed)
|
6. Bedrock Compatibility(Floodgate needed)(based on UUID)
|
||||||
7. Update checker
|
7. Update checker
|
||||||
8. Integrated GUI Captcha feature(Bedrock compatibility & ProtocolLib needed)(70% Asynchronous)
|
8. Integrated GUI Captcha feature(Bedrock compatibility & ProtocolLib needed)(70% Asynchronous)
|
||||||
9. Improved listeners
|
9. Improved listeners
|
||||||
@@ -17,4 +17,5 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
|
|||||||
11. Automatically purge bot data
|
11. Automatically purge bot data
|
||||||
12. Folia compatibility [Here](https://github.com/HaHaWTH/AuthMeReReloaded/releases/download/b20/AuthMe-5.6.0-FORK-Folia.jar)
|
12. Folia compatibility [Here](https://github.com/HaHaWTH/AuthMeReReloaded/releases/download/b20/AuthMe-5.6.0-FORK-Folia.jar)
|
||||||
13. Offhand Menu compatibility(Thats amazing)
|
13. Offhand Menu compatibility(Thats amazing)
|
||||||
14. More......
|
14. Automatically fix portal stuck issue
|
||||||
|
15. More......
|
||||||
|
|||||||
@@ -67,11 +67,11 @@
|
|||||||
<maven.minimumVersion>3.6.3</maven.minimumVersion>
|
<maven.minimumVersion>3.6.3</maven.minimumVersion>
|
||||||
|
|
||||||
<!-- Dependencies versions -->
|
<!-- Dependencies versions -->
|
||||||
<spigot.version>1.20.1-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version>
|
||||||
|
|
||||||
<!-- Versioning properties -->
|
<!-- Versioning properties -->
|
||||||
<project.outputName>AuthMe</project.outputName>
|
<project.outputName>AuthMe</project.outputName>
|
||||||
<project.buildNumber>CUSTOM</project.buildNumber>
|
<project.buildNumber>28</project.buildNumber>
|
||||||
<project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode>
|
<project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode>
|
||||||
<project.finalNameBase>${project.outputName}-${project.version}</project.finalNameBase>
|
<project.finalNameBase>${project.outputName}-${project.version}</project.finalNameBase>
|
||||||
|
|
||||||
@@ -784,8 +784,6 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Bukkit Libraries -->
|
|
||||||
|
|
||||||
<!-- ConfigMe -->
|
<!-- ConfigMe -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.jalu</groupId>
|
<groupId>ch.jalu</groupId>
|
||||||
@@ -800,7 +798,7 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- bStats metrics -->
|
<!-- bStats metrics -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bstats</groupId>
|
<groupId>org.bstats</groupId>
|
||||||
<artifactId>bstats-bukkit</artifactId>
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
@@ -1070,7 +1068,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.checkerframework</groupId>
|
<groupId>org.checkerframework</groupId>
|
||||||
<artifactId>checker-qual</artifactId>
|
<artifactId>checker-qual</artifactId>
|
||||||
<version>3.32.0</version>
|
<version>3.40.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -1078,7 +1076,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.40.1.0</version>
|
<version>3.43.2.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -9,21 +9,18 @@ import fr.xephi.authme.initialization.DataFolder;
|
|||||||
import fr.xephi.authme.initialization.DataSourceProvider;
|
import fr.xephi.authme.initialization.DataSourceProvider;
|
||||||
import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
|
import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
|
||||||
import fr.xephi.authme.initialization.OnStartupTasks;
|
import fr.xephi.authme.initialization.OnStartupTasks;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
|
|
||||||
import fr.xephi.authme.initialization.SettingsProvider;
|
import fr.xephi.authme.initialization.SettingsProvider;
|
||||||
import fr.xephi.authme.initialization.TaskCloser;
|
import fr.xephi.authme.initialization.TaskCloser;
|
||||||
|
import fr.xephi.authme.listener.BedrockAutoLoginListener;
|
||||||
import fr.xephi.authme.listener.BlockListener;
|
import fr.xephi.authme.listener.BlockListener;
|
||||||
|
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
||||||
import fr.xephi.authme.listener.EntityListener;
|
import fr.xephi.authme.listener.EntityListener;
|
||||||
|
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
||||||
|
import fr.xephi.authme.listener.LoginLocationFixListener;
|
||||||
import fr.xephi.authme.listener.PlayerListener;
|
import fr.xephi.authme.listener.PlayerListener;
|
||||||
import fr.xephi.authme.listener.PlayerListener111;
|
import fr.xephi.authme.listener.PlayerListener111;
|
||||||
import fr.xephi.authme.listener.PlayerListener19;
|
import fr.xephi.authme.listener.PlayerListener19;
|
||||||
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
||||||
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
|
||||||
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
|
||||||
import fr.xephi.authme.listener.PlayerListenerHigherThan18;
|
import fr.xephi.authme.listener.PlayerListenerHigherThan18;
|
||||||
import fr.xephi.authme.listener.ServerListener;
|
import fr.xephi.authme.listener.ServerListener;
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
@@ -37,6 +34,7 @@ import fr.xephi.authme.service.yaml.YamlParseException;
|
|||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.SettingsWarner;
|
import fr.xephi.authme.settings.SettingsWarner;
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.task.CleanupTask;
|
import fr.xephi.authme.task.CleanupTask;
|
||||||
import fr.xephi.authme.task.purge.PurgeService;
|
import fr.xephi.authme.task.purge.PurgeService;
|
||||||
@@ -45,6 +43,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@@ -52,6 +51,9 @@ import org.bukkit.scheduler.BukkitScheduler;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -75,7 +77,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// Version and build number values
|
// Version and build number values
|
||||||
private static String pluginVersion = "5.6.0-Fork";
|
private static String pluginVersion = "5.6.0-Fork";
|
||||||
private static final String pluginBuild = "b";
|
private static final String pluginBuild = "b";
|
||||||
private static String pluginBuildNumber = "25";
|
private static String pluginBuildNumber = "31";
|
||||||
protected final Boolean SHAEnabled = false;
|
protected final Boolean SHAEnabled = false;
|
||||||
// Private instances
|
// Private instances
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
@@ -122,6 +124,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method called when the server enables the plugin.
|
* Method called when the server enables the plugin.
|
||||||
*/
|
*/
|
||||||
@@ -207,27 +210,38 @@ public class AuthMe extends JavaPlugin {
|
|||||||
purgeService.runAutoPurge();
|
purgeService.runAutoPurge();
|
||||||
// 注册玩家加入事件监听
|
// 注册玩家加入事件监听
|
||||||
// if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS) || settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)/* || settings.getProperty(SecuritySettings.GUI_CAPTCHA)*/) {
|
// if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS) || settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)/* || settings.getProperty(SecuritySettings.GUI_CAPTCHA)*/) {
|
||||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
register3rdPartyListeners();
|
||||||
getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this);
|
|
||||||
}
|
|
||||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
|
||||||
getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
|
||||||
logger.info("(Alpha4)GUICaptcha Feature is enabled successfully!");
|
|
||||||
logger.info("These features are still in development, if you encountered any problem, please report.");
|
|
||||||
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && !getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
|
||||||
logger.warning("ProtocolLib is not loaded, we can't enable GUI Captcha.");
|
|
||||||
}
|
|
||||||
logger.info("GitHub: https://github.com/HaHaWTH/AuthMeReReloaded/");
|
logger.info("GitHub: https://github.com/HaHaWTH/AuthMeReReloaded/");
|
||||||
|
|
||||||
if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) {
|
if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) {
|
||||||
checkForUpdates();
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SHAEnabled){
|
if (SHAEnabled) {
|
||||||
//shaChecker();
|
//shaChecker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public File pluginfile = getFile();
|
public File pluginfile = getFile();
|
||||||
|
|
||||||
|
private void register3rdPartyListeners() {
|
||||||
|
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
||||||
|
getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this);
|
||||||
|
}
|
||||||
|
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
|
||||||
|
getServer().getPluginManager().registerEvents(new LoginLocationFixListener((Plugin) this), this);
|
||||||
|
}
|
||||||
|
// if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
|
||||||
|
// getServer().getPluginManager().registerEvents(new BedrockAutoLoginListener((Plugin) this), this);
|
||||||
|
// }
|
||||||
|
// if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||||
|
// getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
||||||
|
// logger.info("(Beta)GUICaptcha is enabled successfully!");
|
||||||
|
// logger.info("These features are still in early development, if you encountered any problem, please report.");
|
||||||
|
// } else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
|
||||||
|
// logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
|
||||||
|
// }
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Load the version and build number of the plugin from the description file.
|
* Load the version and build number of the plugin from the description file.
|
||||||
*
|
*
|
||||||
@@ -322,8 +336,21 @@ public class AuthMe extends JavaPlugin {
|
|||||||
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
|
||||||
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
|
||||||
|
|
||||||
|
//Register 3rd party listeners
|
||||||
|
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||||
|
pluginManager.registerEvents(injector.getSingleton(GuiCaptchaHandler.class), this);
|
||||||
|
logger.info("(Beta)GUICaptcha is enabled successfully!");
|
||||||
|
logger.info("These features are still in early development, if you encountered any problem, please report.");
|
||||||
|
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
|
||||||
|
logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
|
||||||
|
}
|
||||||
|
if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
|
||||||
|
pluginManager.registerEvents(injector.getSingleton(BedrockAutoLoginListener.class), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Try to register 1.8+ player listeners
|
// Try to register 1.8+ player listeners
|
||||||
if (isClassLoaded("org.bukkit.event.entity.EntityPickupItemEvent") && isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")){
|
if (isClassLoaded("org.bukkit.event.entity.EntityPickupItemEvent") && isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PlayerListenerHigherThan18.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PlayerListenerHigherThan18.class), this);
|
||||||
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||||
@@ -383,18 +410,20 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
// Disabled correctly
|
// Disabled correctly
|
||||||
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
|
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
|
||||||
ConsoleLogger.closeFileWriter();
|
ConsoleLogger.closeFileWriter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String owner = "HaHaWTH";
|
private static final String owner = "HaHaWTH";
|
||||||
private static final String owner_gitee = "Shixuehan114514";
|
private static final String owner_gitee = "Shixuehan114514";
|
||||||
private static final String repo = "AuthMeReReloaded";
|
private static final String repo = "AuthMeReReloaded";
|
||||||
|
|
||||||
private void checkForUpdates() {
|
private void checkForUpdates() {
|
||||||
logger.info("Checking for updates...");
|
logger.info("Checking for updates...");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
|
||||||
try {
|
try {
|
||||||
// 从南通集线器获取最新版本号
|
// 从南通集线器获取最新版本号
|
||||||
|
|
||||||
URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest");
|
URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest");
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
conn.setConnectTimeout(10000); // 设置连接超时为10秒
|
conn.setConnectTimeout(10000); // 设置连接超时为10秒
|
||||||
@@ -406,20 +435,38 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// 处理JSON响应
|
// 处理JSON响应
|
||||||
String latestVersion = response.substring(response.indexOf("tag_name") + 11);
|
String latestVersion = response.substring(response.indexOf("tag_name") + 11);
|
||||||
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
|
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
|
||||||
if ((pluginBuild + pluginBuildNumber).equals(latestVersion)) {
|
if (isUpdateAvailable(latestVersion)) {
|
||||||
getLogger().log(Level.INFO,"You are running the latest version.");
|
|
||||||
}
|
|
||||||
if (!(pluginBuild + pluginBuildNumber).equals(latestVersion)) {
|
|
||||||
// Display update message
|
|
||||||
String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber;
|
String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber;
|
||||||
getLogger().log(Level.INFO, message);
|
getLogger().log(Level.INFO, message);
|
||||||
getLogger().log(Level.INFO,"Download from here:github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
|
getLogger().log(Level.INFO, "Download from here: github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
|
||||||
}
|
} else {
|
||||||
}catch (IOException e) {
|
getLogger().log(Level.INFO, "You are running the latest version.");
|
||||||
getLogger().log(Level.WARNING,"Error occurred while checking updates from GitHub. Reason: " + e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
String formattedException = ExceptionUtils.formatException(e);
|
||||||
|
getLogger().log(Level.WARNING, "Error occurred while checking updates from GitHub. Reason: " + formattedException);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
private boolean isUpdateAvailable(String latestVersion) {
|
||||||
|
// Extract the first character and the remaining digits from the version string
|
||||||
|
char latestChar = latestVersion.charAt(0);
|
||||||
|
int latestNumber = Integer.parseInt(latestVersion.substring(1));
|
||||||
|
|
||||||
|
char currentChar = pluginBuild.charAt(0);
|
||||||
|
int currentNumber = Integer.parseInt(pluginBuildNumber);
|
||||||
|
|
||||||
|
// Compare the characters first
|
||||||
|
if (latestChar > currentChar) {
|
||||||
|
return true;
|
||||||
|
} else if (latestChar < currentChar) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// If the characters are the same, compare the numbers
|
||||||
|
return latestNumber > currentNumber;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkServerType() {
|
private void checkServerType() {
|
||||||
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ public abstract class PlayerCommand implements ExecutableCommand {
|
|||||||
} else {
|
} else {
|
||||||
String alternative = getAlternativeCommand();
|
String alternative = getAlternativeCommand();
|
||||||
if (alternative != null) {
|
if (alternative != null) {
|
||||||
sender.sendMessage("此命令仅限玩家使用!请使用 " + alternative + " .");
|
sender.sendMessage("Player only! Please use " + alternative + " instead.");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("此命令只能被玩家执行.");
|
sender.sendMessage("This command is only for players.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
/* Inspired by DongShaoNB/BedrockPlayerSupport **/
|
||||||
|
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
|
import fr.xephi.authme.service.BukkitService;
|
||||||
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class BedrockAutoLoginListener implements Listener {
|
||||||
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
|
@Inject
|
||||||
|
private BukkitService bukkitService;
|
||||||
|
@Inject
|
||||||
|
private AuthMe plugin;
|
||||||
|
|
||||||
|
|
||||||
|
public BedrockAutoLoginListener() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isBedrockPlayer(UUID uuid) {
|
||||||
|
return AuthMe.settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && AuthMe.settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
String name = event.getPlayer().getName();
|
||||||
|
UUID uuid = event.getPlayer().getUniqueId();
|
||||||
|
if (isBedrockPlayer(uuid) && !authmeApi.isAuthenticated(player) && authmeApi.isRegistered(name)) {
|
||||||
|
authmeApi.forceLogin(player);
|
||||||
|
player.sendMessage("§a基岩版自动登录完成!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prevent sending duplicate messages */
|
||||||
|
// @EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
// public void onPlayerRestoreSession(RestoreSessionEvent event) {
|
||||||
|
// Player player = event.getPlayer();
|
||||||
|
// String name = event.getPlayer().getName();
|
||||||
|
// UUID uuid = event.getPlayer().getUniqueId();
|
||||||
|
// if (isBedrockPlayer(uuid) && !authmeApi.isAuthenticated(player) && authmeApi.isRegistered(name)) {
|
||||||
|
// event.setCancelled(true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
package fr.xephi.authme.listener;
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.earth2me.essentials.libs.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.service.BukkitService;
|
||||||
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
@@ -22,27 +26,38 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import static fr.xephi.authme.util.PlayerUtils.isNpc;
|
||||||
import static org.bukkit.Bukkit.getLogger;
|
import static org.bukkit.Bukkit.getLogger;
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class GuiCaptchaHandler implements Listener {
|
public class GuiCaptchaHandler implements Listener {
|
||||||
//define AuthMeApi
|
//define AuthMeApi
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
private final Plugin plugin;
|
@Inject
|
||||||
|
private BukkitService bukkitService;
|
||||||
|
@Inject
|
||||||
|
private AuthMe plugin;
|
||||||
|
@Inject
|
||||||
|
private Messages messages;
|
||||||
|
@Inject
|
||||||
|
private CommonService service;
|
||||||
|
|
||||||
|
private PacketAdapter chatPacketListener;
|
||||||
|
private PacketAdapter windowPacketListener;
|
||||||
//define timesLeft
|
//define timesLeft
|
||||||
public int timesLeft = 3;
|
private int timesLeft = 3;
|
||||||
//Use ConcurrentHashMap to store player and their close reason
|
//Use ConcurrentHashMap to store player and their close reason
|
||||||
/* We used many async tasks so there is concurrent**/
|
/* We used many async tasks so there is concurrent**/
|
||||||
protected static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
|
||||||
//define randomStringSet
|
//define randomStringSet
|
||||||
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
||||||
String randomString = "";
|
String randomString = "";
|
||||||
@@ -52,10 +67,17 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
|
|
||||||
int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
||||||
|
|
||||||
public GuiCaptchaHandler(Plugin plugin) {
|
public GuiCaptchaHandler() {
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isBedrockPlayer(UUID uuid) {
|
||||||
|
return AuthMe.settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removePacketListeners() {
|
||||||
|
ProtocolLibrary.getProtocolManager().removePacketListener(windowPacketListener);
|
||||||
|
ProtocolLibrary.getProtocolManager().removePacketListener(chatPacketListener);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
@@ -63,40 +85,31 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
ItemStack currentItem = event.getCurrentItem();
|
ItemStack currentItem = event.getCurrentItem();
|
||||||
if (!authmeApi.isRegistered(player.getName()) && !closeReasonMap.containsKey(player)) {
|
if (!authmeApi.isRegistered(player.getName()) && !closeReasonMap.containsKey(player)) {
|
||||||
if (AuthMe.settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getWhoClicked().getUniqueId()) && (getServer().getPluginManager().isPluginEnabled("floodgate") || getServer().getPluginManager().getPlugin("floodgate") != null)) {
|
if (isBedrockPlayer(player.getUniqueId())) {
|
||||||
if (!closeReasonMap.containsKey(player)) {
|
|
||||||
closeReasonMap.put(player,"verified");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentItem!=null && currentItem.getType().equals(Material.REDSTONE_BLOCK)){
|
if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
closeReasonMap.put(player, "verified");
|
closeReasonMap.put(player, "verified");
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.sendMessage("§a验证完成");
|
messages.send(player, MessageKey.GUI_CAPTCHA_VERIFIED);
|
||||||
} else {
|
|
||||||
player.sendMessage("§c验证失败,你还有" + timesLeft + "§c次机会");
|
|
||||||
timesLeft--;
|
|
||||||
}
|
}
|
||||||
//force to string
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
randomString = "";
|
randomString = "";
|
||||||
Player playerunreg = event.getPlayer();
|
Player playerunreg = event.getPlayer();
|
||||||
String name = playerunreg.getName();
|
String name = playerunreg.getName();
|
||||||
if (!authmeApi.isRegistered(name)) {
|
if (!authmeApi.isRegistered(name) && !isNpc(playerunreg)) {
|
||||||
if (AuthMe.settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getPlayer().getUniqueId()) && (getServer().getPluginManager().isPluginEnabled("floodgate") || getServer().getPluginManager().getPlugin("floodgate") != null)) {
|
if (isBedrockPlayer(playerunreg.getUniqueId())) {
|
||||||
closeReasonMap.put(playerunreg, "verified");
|
closeReasonMap.put(playerunreg, "verified");
|
||||||
playerunreg.sendMessage("§a基岩版自动验证完成");
|
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
bukkitService.runTaskAsynchronously(() -> {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
||||||
for (int i = 0; i < howLongIsRandomString; i++) {
|
for (int i = 0; i < howLongIsRandomString; i++) {
|
||||||
@@ -110,91 +123,87 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
sb.append(randomChar);
|
sb.append(randomChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
bukkitService.runTask(() -> {
|
||||||
randomString = sb.toString();
|
randomString = sb.toString();
|
||||||
Random random_blockpos = new Random();
|
Random random_blockpos = new Random();
|
||||||
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26));
|
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26));
|
||||||
Inventory menu = Bukkit.createInventory(null, 27, randomString + "请验证你是真人");
|
Inventory menu = Bukkit.createInventory(playerunreg, 27, messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_WINDOW_NAME, randomString));
|
||||||
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
|
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
try {
|
try {
|
||||||
if (meta != null) {
|
if (meta != null) {
|
||||||
meta.setDisplayName("§a我是真人");
|
meta.setDisplayName(messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_CLICKABLE_NAME, randomString));
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
getLogger().log(Level.WARNING, "Unexpected error occurred while setting item meta.");
|
getLogger().log(Level.WARNING, "Unexpected error occurred while setting item meta.");
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
|
||||||
menu.setItem(random_num.get(), item);
|
|
||||||
});
|
|
||||||
menu.setItem(random_num.get(), item);
|
menu.setItem(random_num.get(), item);
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
playerunreg.openInventory(menu);
|
||||||
playerunreg.openInventory(menu);
|
|
||||||
});
|
|
||||||
if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > 0) {
|
if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > 0) {
|
||||||
long timeOut = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT);
|
long timeOut = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT);
|
||||||
if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT)) {
|
if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT)) {
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
bukkitService.runTask(() -> {
|
||||||
Bukkit.getLogger().warning("AuthMe detected that your GUI captcha timeout seconds(" + AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) + ") is bigger than the Login timeout seconds(" +
|
getLogger().warning("AuthMe detected that your GUI captcha timeout seconds(" + AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) + ") is bigger than the Login timeout seconds(" +
|
||||||
AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT) + "). To prevent issues, we will let the GUI captcha follow the Login timeout seconds, please check and modify your config.");
|
AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT) + "). To prevent issues, we will let the GUI captcha follow the Login timeout seconds, please check and modify your config.");
|
||||||
});
|
});
|
||||||
timeOut = AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT);
|
timeOut = AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT);
|
||||||
}
|
}
|
||||||
long finalTimeOut = timeOut;
|
long finalTimeOut = timeOut;
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
bukkitService.runTask(() -> {
|
||||||
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
|
bukkitService.runTaskLater(() -> {
|
||||||
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||||
playerunreg.kickPlayer("§c验证超时");
|
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT));
|
||||||
timesLeft = 3; // Reset the attempt counter
|
timesLeft = 3; // Reset the attempt counter
|
||||||
}
|
}
|
||||||
}, finalTimeOut * 20L);
|
}, finalTimeOut * 20L);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
bukkitService.runTask(() -> {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
|
windowPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||||
if (timesLeft <= 0) {
|
if (timesLeft <= 0) {
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
bukkitService.runTask(() -> {
|
||||||
playerunreg.kickPlayer("§c请先完成人机验证!");
|
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_FAILED));
|
||||||
});
|
});
|
||||||
timesLeft = 3;
|
timesLeft = 3;
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
timesLeft--;
|
--timesLeft;
|
||||||
playerunreg.sendMessage("§c请先完成验证!,你还有" + timesLeft + "次机会");
|
if (timesLeft <= 0) {
|
||||||
|
bukkitService.runTask(() -> {
|
||||||
}
|
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_FAILED));
|
||||||
event.setCancelled(true);
|
});
|
||||||
random_num.set(random_blockpos.nextInt(26));
|
timesLeft = 3;
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
return;
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
}
|
||||||
|
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_RETRY_MESSAGE, String.valueOf(timesLeft));
|
||||||
|
event.setCancelled(true);
|
||||||
|
random_num.set(random_blockpos.nextInt(26));
|
||||||
|
bukkitService.runTask(() -> {
|
||||||
menu.clear();
|
menu.clear();
|
||||||
menu.setItem(random_num.get(), item);
|
menu.setItem(random_num.get(), item);
|
||||||
});
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
|
||||||
playerunreg.openInventory(menu);
|
playerunreg.openInventory(menu);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
|
||||||
});
|
});
|
||||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
bukkitService.runTask(() -> {
|
||||||
|
chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||||
playerunreg.sendMessage("§c请先完成验证!");
|
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_DENIED_MESSAGE);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -206,10 +215,10 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
File serverFolder = Bukkit.getServer().getWorldContainer();
|
File serverFolder = Bukkit.getServer().getWorldContainer();
|
||||||
String worldFolderName = AuthMe.settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
String worldFolderName = AuthMe.settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
||||||
// 构建playerdata文件夹路径
|
// 构建playerdata文件夹路径
|
||||||
File playerDataFolder = new File(serverFolder, File.separator+worldFolderName+File.separator+"playerdata");
|
File playerDataFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "playerdata");
|
||||||
|
|
||||||
// 构建玩家数据文件路径
|
// 构建玩家数据文件路径
|
||||||
File playerDataFile = new File(playerDataFolder, File.separator+playerUUID + ".dat");
|
File playerDataFile = new File(playerDataFolder, File.separator + playerUUID + ".dat");
|
||||||
|
|
||||||
// 删除玩家数据文件
|
// 删除玩家数据文件
|
||||||
if (playerDataFile.exists()) {
|
if (playerDataFile.exists()) {
|
||||||
@@ -221,11 +230,10 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
File serverFolder = Bukkit.getServer().getWorldContainer();
|
File serverFolder = Bukkit.getServer().getWorldContainer();
|
||||||
String worldFolderName = AuthMe.settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
String worldFolderName = AuthMe.settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
||||||
// 构建stats文件夹路径
|
// 构建stats文件夹路径
|
||||||
File statsFolder = new File(serverFolder, File.separator+worldFolderName+File.separator+"stats");
|
File statsFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "stats");
|
||||||
// 构建玩家统计数据文件路径
|
// 构建玩家统计数据文件路径
|
||||||
File statsFile = new File(statsFolder, File.separator+playerUUID + ".json");
|
File statsFile = new File(statsFolder, File.separator + playerUUID + ".json");
|
||||||
// 删除玩家统计数据文件
|
// 删除玩家统计数据文件
|
||||||
|
|
||||||
if (statsFile.exists()) {
|
if (statsFile.exists()) {
|
||||||
statsFile.delete();
|
statsFile.delete();
|
||||||
}
|
}
|
||||||
@@ -237,15 +245,18 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
UUID playerUUID = event.getPlayer().getUniqueId();
|
UUID playerUUID = event.getPlayer().getUniqueId();
|
||||||
if (!authmeApi.isRegistered(name)) {
|
if (!authmeApi.isRegistered(name)) {
|
||||||
if(AuthMe.settings.getProperty(SecuritySettings.DELETE_UNVERIFIED_PLAYER_DATA) && !closeReasonMap.containsKey(player)){
|
if (AuthMe.settings.getProperty(SecuritySettings.DELETE_UNVERIFIED_PLAYER_DATA) && !closeReasonMap.containsKey(player)) {
|
||||||
Bukkit.getScheduler().runTaskLater(this.plugin,() -> {
|
closeReasonMap.remove(player);
|
||||||
if(!player.isOnline()) {
|
bukkitService.runTaskLater(() -> {
|
||||||
|
if (!player.isOnline()) {
|
||||||
deletePlayerData(playerUUID);
|
deletePlayerData(playerUUID);
|
||||||
deletePlayerStats(playerUUID);
|
deletePlayerStats(playerUUID);
|
||||||
}
|
}
|
||||||
},100L);
|
}, 100L);
|
||||||
|
removePacketListeners();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
removePacketListeners();
|
||||||
closeReasonMap.remove(player);
|
closeReasonMap.remove(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
|
import fr.xephi.authme.util.TeleportUtils;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
|
public class LoginLocationFixListener implements Listener {
|
||||||
|
private final Plugin plugin;
|
||||||
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
|
|
||||||
|
public LoginLocationFixListener(Plugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Material materialPortal = Material.matchMaterial("PORTAL");
|
||||||
|
private final boolean isSmartAsyncTeleport = AuthMe.settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT);
|
||||||
|
private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL);
|
||||||
|
private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND);
|
||||||
|
BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (materialPortal == null) {
|
||||||
|
materialPortal = Material.matchMaterial("PORTAL_BLOCK");
|
||||||
|
if (materialPortal == null) {
|
||||||
|
materialPortal = Material.matchMaterial("NETHER_PORTAL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
|
||||||
|
if (isFixPortalStuck) {
|
||||||
|
if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Block JoinBlock = JoinLocation.getBlock();
|
||||||
|
boolean solved = false;
|
||||||
|
for (BlockFace face : faces) {
|
||||||
|
if (JoinBlock.getRelative(face).getType().equals(Material.AIR) && JoinBlock.getRelative(face).getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||||
|
if (isSmartAsyncTeleport) {
|
||||||
|
TeleportUtils.teleport(player, JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
} else {
|
||||||
|
player.teleport(JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
}
|
||||||
|
solved = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!solved) {
|
||||||
|
JoinBlock.getRelative(BlockFace.UP).breakNaturally();
|
||||||
|
JoinBlock.breakNaturally();
|
||||||
|
}
|
||||||
|
player.sendMessage("§a你在登录时卡在了地狱门, 现已修正");
|
||||||
|
} else if (isFixGroundStuck) {
|
||||||
|
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
|
||||||
|
World world = player.getWorld();
|
||||||
|
int MaxHeight = world.getMaxHeight();
|
||||||
|
int MinHeight = world.getMinHeight();
|
||||||
|
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = MinHeight; i <= MaxHeight; i++) {
|
||||||
|
JoinLocation.setY(i);
|
||||||
|
Block JoinBlock = JoinLocation.getBlock();
|
||||||
|
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
|
||||||
|
&& JoinBlock.getType().equals(Material.AIR)
|
||||||
|
&& JoinBlock.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||||
|
if (JoinBlock.getRelative(BlockFace.DOWN).getType().equals(Material.LAVA)) {
|
||||||
|
JoinBlock.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||||
|
}
|
||||||
|
if (isSmartAsyncTeleport) {
|
||||||
|
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
} else {
|
||||||
|
player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
}
|
||||||
|
player.sendMessage("§a你被埋住了, 坐标已修正, 下次下线之前请小心!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == MaxHeight) {
|
||||||
|
if (isSmartAsyncTeleport) {
|
||||||
|
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 1.1, 0.5));
|
||||||
|
} else {
|
||||||
|
player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5));
|
||||||
|
}
|
||||||
|
player.sendMessage("§a你被埋住了, 坐标无法修正, 只好送你去了最高点, 自求多福吧少年~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,13 +4,59 @@ package fr.xephi.authme.message;
|
|||||||
* Keys for translatable messages managed by {@link Messages}.
|
* Keys for translatable messages managed by {@link Messages}.
|
||||||
*/
|
*/
|
||||||
public enum MessageKey {
|
public enum MessageKey {
|
||||||
/** In order to use this command you must be authenticated! */
|
/**
|
||||||
|
* %random Verification
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_WINDOW_NAME("gui_captcha.captcha_window_name", "%random"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* %random I am human
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_CLICKABLE_NAME("gui_captcha.captcha_clickable_name", "%random"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verification failed, you have %times retries left
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_RETRY_MESSAGE("gui_captcha.message_on_retry", "%times"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bedrock verification success!
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK("gui_captcha.bedrock_auto_verify_success"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Please be verified before chatting!
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_DENIED_MESSAGE("gui_captcha.denied_message_sending"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verification timed out!
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_KICK_TIMEOUT("gui_captcha.kick_on_timeout"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Please complete the verification!
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_KICK_FAILED("gui_captcha.kick_on_failed"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verification success!
|
||||||
|
*/
|
||||||
|
GUI_CAPTCHA_VERIFIED("gui_captcha.success"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In order to use this command you must be authenticated!
|
||||||
|
*/
|
||||||
DENIED_COMMAND("error.denied_command"),
|
DENIED_COMMAND("error.denied_command"),
|
||||||
|
|
||||||
/** A player with the same IP is already in game! */
|
/**
|
||||||
|
* A player with the same IP is already in game!
|
||||||
|
*/
|
||||||
SAME_IP_ONLINE("on_join_validation.same_ip_online"),
|
SAME_IP_ONLINE("on_join_validation.same_ip_online"),
|
||||||
|
|
||||||
/** In order to chat you must be authenticated! */
|
/**
|
||||||
|
* In order to chat you must be authenticated!
|
||||||
|
*/
|
||||||
DENIED_CHAT("error.denied_chat"),
|
DENIED_CHAT("error.denied_chat"),
|
||||||
|
|
||||||
/** 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. */
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ public class MessageUpdater {
|
|||||||
.put("verification", "Verification code")
|
.put("verification", "Verification code")
|
||||||
.put("time", "Time units")
|
.put("time", "Time units")
|
||||||
.put("two_factor", "Two-factor authentication")
|
.put("two_factor", "Two-factor authentication")
|
||||||
|
.put("gui_captcha", "3rd party features: GUI Captcha")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Set<String> addedKeys = new HashSet<>();
|
Set<String> addedKeys = new HashSet<>();
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package fr.xephi.authme.settings.properties;
|
|||||||
|
|
||||||
import ch.jalu.configme.Comment;
|
import ch.jalu.configme.Comment;
|
||||||
import ch.jalu.configme.SettingsHolder;
|
import ch.jalu.configme.SettingsHolder;
|
||||||
|
|
||||||
import ch.jalu.configme.properties.Property;
|
import ch.jalu.configme.properties.Property;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
import fr.xephi.authme.security.HashAlgorithm;
|
||||||
import fr.xephi.authme.settings.EnumSetProperty;
|
import fr.xephi.authme.settings.EnumSetProperty;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
||||||
@@ -19,15 +19,19 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
||||||
newProperty("Security.SQLProblem.stopServer", false);
|
newProperty("Security.SQLProblem.stopServer", false);
|
||||||
|
|
||||||
|
@Comment({"Should we let Bedrock players login automatically?",
|
||||||
|
"(Requires hookFloodgate to be true & floodgate loaded)"})
|
||||||
|
public static final Property<Boolean> FORCE_LOGIN_BEDROCK = newProperty("3rdPartyFeature.features.bedrockAutoLogin", false);
|
||||||
|
|
||||||
@Comment("Enable the new feature to prevent ghost players?")
|
@Comment("Enable the new feature to prevent ghost players?")
|
||||||
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
||||||
|
|
||||||
@Comment({"Choose the best teleport method by server brand?",
|
@Comment({"Choose the best teleport method by server brand?",
|
||||||
"(Enable this if you are using Paper)"})
|
"(Enable this if you are using Paper)"})
|
||||||
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport",false);
|
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport", false);
|
||||||
|
|
||||||
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
|
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
|
||||||
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.captcha.guiCaptcha",false);
|
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.captcha.guiCaptcha", false);
|
||||||
|
|
||||||
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
|
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
|
||||||
"(less than or equals 0 is disabled)"})
|
"(less than or equals 0 is disabled)"})
|
||||||
@@ -43,6 +47,12 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
@Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)")
|
@Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)")
|
||||||
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.captcha.purgeWorldFolderName","world");
|
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.captcha.purgeWorldFolderName","world");
|
||||||
|
|
||||||
|
@Comment("Should we fix the location when players logged in the portal?")
|
||||||
|
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
||||||
|
|
||||||
|
@Comment("Should we fix the location when players logged underground?")
|
||||||
|
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_UNDERGROUND = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixGroundStuck", false);
|
||||||
|
|
||||||
// @Comment({"Should we kick the players when they failed captcha too many times?",
|
// @Comment({"Should we kick the players when they failed captcha too many times?",
|
||||||
// "(Minimum value is 1)(Default: 3)"})
|
// "(Minimum value is 1)(Default: 3)"})
|
||||||
// public static final Property<Integer> GUI_CAPTCHA_MAX_TRY = newProperty("3rdPartyFeature.captcha.maxTryTimes",3);
|
// public static final Property<Integer> GUI_CAPTCHA_MAX_TRY = newProperty("3rdPartyFeature.captcha.maxTryTimes",3);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class TeleportUtils {
|
|||||||
try {//Detect Paper class
|
try {//Detect Paper class
|
||||||
Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig");
|
Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig");
|
||||||
teleportAsyncMethod = Player.class.getMethod("teleportAsync", Location.class);
|
teleportAsyncMethod = Player.class.getMethod("teleportAsync", Location.class);
|
||||||
|
teleportAsyncMethod.setAccessible(true);
|
||||||
// if detected,use teleportAsync()
|
// if detected,use teleportAsync()
|
||||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||||
teleportAsyncMethod = null;
|
teleportAsyncMethod = null;
|
||||||
@@ -38,7 +39,6 @@ public class TeleportUtils {
|
|||||||
public static void teleport(Player player, Location location) {
|
public static void teleport(Player player, Location location) {
|
||||||
if (teleportAsyncMethod != null) {
|
if (teleportAsyncMethod != null) {
|
||||||
try {
|
try {
|
||||||
teleportAsyncMethod.setAccessible(true);
|
|
||||||
teleportAsyncMethod.invoke(player, location);
|
teleportAsyncMethod.invoke(player, location);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
player.teleport(location);
|
player.teleport(location);
|
||||||
|
|||||||
@@ -155,3 +155,14 @@ time:
|
|||||||
hours: 'hours'
|
hours: 'hours'
|
||||||
day: 'day'
|
day: 'day'
|
||||||
days: 'days'
|
days: 'days'
|
||||||
|
|
||||||
|
# 3rd party features: GUI Captcha
|
||||||
|
gui_captcha:
|
||||||
|
success: '&aVerification success!'
|
||||||
|
bedrock_auto_verify_success: '&aBedrock verification success!'
|
||||||
|
captcha_window_name: '%random Verification'
|
||||||
|
captcha_clickable_name: '%random I am human'
|
||||||
|
message_on_retry: '&cVerification failed, you have %times retries left'
|
||||||
|
denied_message_sending: '&cPlease be verified before chatting!'
|
||||||
|
kick_on_failed: '&cPlease complete the verification!'
|
||||||
|
kick_on_timeout: '&cVerification timed out!'
|
||||||
|
|||||||
@@ -154,13 +154,24 @@ time:
|
|||||||
|
|
||||||
# Two-factor authentication
|
# Two-factor authentication
|
||||||
two_factor:
|
two_factor:
|
||||||
code_created: '&7您正在激活双重验证, 请打开 &a%url &7扫描二维码'
|
code_created: '&7您正在激活双重验证, 请打开 &a%url &7扫描二维码'
|
||||||
confirmation_required: '&7请输入“/totp confirm <验证码>”来确认激活双重验证'
|
confirmation_required: '&7请输入“/totp confirm <验证码>”来确认激活双重验证'
|
||||||
code_required: '&c请输入“/totp code <验证码>”来提交验证码'
|
code_required: '&c请输入“/totp code <验证码>”来提交验证码'
|
||||||
already_enabled: '&a双重验证已启用'
|
already_enabled: '&a双重验证已启用'
|
||||||
enable_error_no_code: '&c验证码丢失'
|
enable_error_no_code: '&c验证码丢失'
|
||||||
enable_success: '&a已成功启用双重验证'
|
enable_success: '&a已成功启用双重验证'
|
||||||
enable_error_wrong_code: '&c验证码错误或者已经过期,请重新执行“/totp add”'
|
enable_error_wrong_code: '&c验证码错误或者已经过期,请重新执行“/totp add”'
|
||||||
not_enabled_error: '&c双重验证未在您的账号上启用,请使用“/totp add”来启用'
|
not_enabled_error: '&c双重验证未在您的账号上启用,请使用“/totp add”来启用'
|
||||||
removed_success: '&c双重验证已从您的账号上禁用'
|
removed_success: '&c双重验证已从您的账号上禁用'
|
||||||
invalid_code: '&c无效的验证码'
|
invalid_code: '&c无效的验证码'
|
||||||
|
|
||||||
|
# 3rd party features: GUI Captcha
|
||||||
|
gui_captcha:
|
||||||
|
success: '&a*** 验证完成 ***'
|
||||||
|
bedrock_auto_verify_success: '&a*** 基岩版自动验证完成 ***'
|
||||||
|
captcha_window_name: '&k%random&r&n请验证你是真人'
|
||||||
|
captcha_clickable_name: '&k%random&r&n我是真人'
|
||||||
|
message_on_retry: '&c验证失败,你还有 %times 次机会'
|
||||||
|
denied_message_sending: '&c请先完成验证再聊天!'
|
||||||
|
kick_on_failed: '&c请先完成验证!'
|
||||||
|
kick_on_timeout: '&c验证超时'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ authors: [${pluginDescription.authors}]
|
|||||||
website: http://github.com/HaHaWTH/AuthMeReReloaded/
|
website: http://github.com/HaHaWTH/AuthMeReReloaded/
|
||||||
description: A fork of AuthMeReloaded that contains bug fixes
|
description: A fork of AuthMeReloaded that contains bug fixes
|
||||||
main: ${pluginDescription.main}
|
main: ${pluginDescription.main}
|
||||||
version: 5.6.0-FORK-b25
|
version: 5.6.0-FORK-b31
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
|
|||||||
Reference in New Issue
Block a user