Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 36bc761c19 | |||
| 9c3f0b0142 | |||
| e6be595c16 | |||
| dd4739a822 | |||
| 39254506bf | |||
| 227d93d756 | |||
| d223f316d6 | |||
| b6ec553dcb | |||
| cc6a9c38bd | |||
| 04ad3adbd1 | |||
| ef3804bf4e | |||
| b5d3408773 | |||
| 470f5ff28f | |||
| 888ee7235b | |||
| c97eda6672 | |||
| 81478f203c | |||
| ec51635d44 | |||
| aae15fba60 | |||
| 57fad7e113 |
+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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# AuthMeReReloaded
|
# AuthMeReReloaded
|
||||||
**"A fork of the best authentication plugin for the Bukkit modding API!"**
|
**"A fork of the best authentication plugin for the Bukkit modding API!"**
|
||||||
|
MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471495)
|
||||||

|

|
||||||
|
|
||||||
**Detailed Changes:**
|
**Detailed Changes:**
|
||||||
@@ -14,4 +14,8 @@
|
|||||||
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
|
||||||
10. Player login logic improvement to reduce lag
|
10. Player login logic improvement to reduce lag
|
||||||
11. More......
|
11. Automatically purge bot data
|
||||||
|
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)
|
||||||
|
14. Automatically fix portal stuck issue
|
||||||
|
15. More......
|
||||||
|
|||||||
@@ -608,6 +608,16 @@
|
|||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack</id>
|
||||||
|
<url>https://jitpack.io/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -1060,7 +1070,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.39.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,14 @@ import fr.xephi.authme.initialization.SettingsProvider;
|
|||||||
import fr.xephi.authme.initialization.TaskCloser;
|
import fr.xephi.authme.initialization.TaskCloser;
|
||||||
import fr.xephi.authme.listener.BlockListener;
|
import fr.xephi.authme.listener.BlockListener;
|
||||||
import fr.xephi.authme.listener.EntityListener;
|
import fr.xephi.authme.listener.EntityListener;
|
||||||
|
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.DoubleLoginFixListener;
|
||||||
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
||||||
|
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;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
@@ -74,7 +76,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 = "23";
|
private static String pluginBuildNumber = "27";
|
||||||
protected final Boolean SHAEnabled = false;
|
protected final Boolean SHAEnabled = false;
|
||||||
// Private instances
|
// Private instances
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
@@ -209,6 +211,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
||||||
getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this);
|
getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this);
|
||||||
}
|
}
|
||||||
|
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX)) {
|
||||||
|
getServer().getPluginManager().registerEvents(new LoginLocationFixListener((Plugin) this), this);
|
||||||
|
}
|
||||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
||||||
logger.info("(Alpha4)GUICaptcha Feature is enabled successfully!");
|
logger.info("(Alpha4)GUICaptcha Feature is enabled successfully!");
|
||||||
@@ -321,11 +326,18 @@ 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);
|
||||||
|
|
||||||
// Try to register 1.9 player listeners
|
// Try to register 1.8+ player listeners
|
||||||
if (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);
|
||||||
|
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to register 1.9 player listeners(Moved to else-if)
|
||||||
|
// if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||||
|
// pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||||
|
// }
|
||||||
|
|
||||||
// Try to register 1.9 spigot player listeners
|
// Try to register 1.9 spigot player listeners
|
||||||
if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) {
|
if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener19Spigot.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PlayerListener19Spigot.class), this);
|
||||||
@@ -378,15 +390,16 @@ public class AuthMe extends JavaPlugin {
|
|||||||
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秒
|
||||||
@@ -398,20 +411,37 @@ 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) {
|
||||||
|
getLogger().log(Level.WARNING, "Error occurred while checking updates from GitHub. Reason: " + e.getMessage());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
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;
|
||||||
@@ -31,17 +30,16 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
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;
|
private final Plugin plugin;
|
||||||
|
|
||||||
|
|
||||||
//define timesLeft
|
//define timesLeft
|
||||||
public int timesLeft = 3;
|
public 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 = "";
|
||||||
@@ -60,7 +58,7 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
if (event.getWhoClicked() instanceof Player) {
|
if (event.getWhoClicked() instanceof Player) {
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
// 获取点击事件的容器
|
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 (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 (!closeReasonMap.containsKey(player)) {
|
if (!closeReasonMap.containsKey(player)) {
|
||||||
@@ -69,7 +67,7 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Objects.requireNonNull(event.getCurrentItem()).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();
|
||||||
@@ -135,7 +133,7 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
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, () -> {
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
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);
|
||||||
@@ -205,10 +203,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()) {
|
||||||
@@ -220,9 +218,9 @@ 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()) {
|
||||||
@@ -237,9 +235,11 @@ public class GuiCaptchaHandler implements Listener {
|
|||||||
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,() -> {
|
Bukkit.getScheduler().runTaskLater(this.plugin , () -> {
|
||||||
deletePlayerData(playerUUID);
|
if(!player.isOnline()) {
|
||||||
deletePlayerStats(playerUUID);
|
deletePlayerData(playerUUID);
|
||||||
|
deletePlayerStats(playerUUID);
|
||||||
|
}
|
||||||
},100L);
|
},100L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
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 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;
|
||||||
|
}
|
||||||
|
BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event){
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Material material = Material.matchMaterial("PORTAL");
|
||||||
|
if (material == null) {
|
||||||
|
material = Material.matchMaterial("PORTAL_BLOCK");
|
||||||
|
if(material == null){
|
||||||
|
material = Material.matchMaterial("NETHER_PORTAL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
|
||||||
|
if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
|
||||||
|
if (!JoinLocation.getBlock().getType().equals(material) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(material)) {
|
||||||
|
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)) {
|
||||||
|
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 (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND)) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
player.sendMessage("§a你被埋住了, 坐标已修正, 下次下线之前请小心!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == MaxHeight) {
|
||||||
|
player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5));
|
||||||
|
player.sendMessage("§a你被埋住了, 坐标无法修正, 只好送你去了最高点, 自求多福吧少年~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
//import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
@@ -54,7 +54,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
//import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
@@ -480,12 +480,12 @@ public class PlayerListener implements Listener{
|
|||||||
* Inventory interactions
|
* Inventory interactions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
// @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
// public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
if (listenerService.shouldCancelEvent(event)) {
|
// if (listenerService.shouldCancelEvent(event)) {
|
||||||
event.setCancelled(true);
|
// event.setCancelled(true);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
@@ -540,12 +540,12 @@ public class PlayerListener implements Listener{
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
// @EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
// public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||||
Player player = event.getPlayer();
|
// Player player = event.getPlayer();
|
||||||
if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
// if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||||
return;
|
// return;
|
||||||
event.setCancelled(true);
|
// event.setCancelled(true);
|
||||||
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
// Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
|
import fr.xephi.authme.data.QuickCommandsProtectionManager;
|
||||||
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
|
import fr.xephi.authme.process.Management;
|
||||||
|
import fr.xephi.authme.service.AntiBotService;
|
||||||
|
import fr.xephi.authme.service.BukkitService;
|
||||||
|
import fr.xephi.authme.service.JoinMessageService;
|
||||||
|
import fr.xephi.authme.service.TeleportationService;
|
||||||
|
import fr.xephi.authme.service.ValidationService;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
public class PlayerListenerHigherThan18 implements Listener {
|
||||||
|
@Inject
|
||||||
|
private ListenerService listenerService;
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
|
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
|
if (listenerService.shouldCancelEvent(event)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||||
|
return;
|
||||||
|
event.setCancelled(true);
|
||||||
|
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -308,7 +308,7 @@ public class Whirlpool extends UnsaltedMethod {
|
|||||||
if (bufferRem + sourceBits < 8) {
|
if (bufferRem + sourceBits < 8) {
|
||||||
// all remaining data fits on buffer[bufferPos], and there still
|
// all remaining data fits on buffer[bufferPos], and there still
|
||||||
// remains some space.
|
// remains some space.
|
||||||
bufferBits += sourceBits;
|
bufferBits += (int) sourceBits;
|
||||||
} else {
|
} else {
|
||||||
// buffer[bufferPos] is full:
|
// buffer[bufferPos] is full:
|
||||||
bufferPos++;
|
bufferPos++;
|
||||||
|
|||||||
@@ -43,6 +43,15 @@ 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 enable the new LoginLocationFix feature?")
|
||||||
|
public static final Property<Boolean> LOGIN_LOC_FIX = newProperty("3rdPartyFeature.fixes.loginLocationFix.enabled", false);
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|||||||
@@ -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-b23
|
version: 5.6.0-FORK-b27
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
|
|||||||
Reference in New Issue
Block a user