Compare commits

...

24 Commits

Author SHA1 Message Date
HaHaWTH 6ffdc4d2b6 Update floodgate repo 2023-12-02 18:50:26 +08:00
HaHaWTH 44f9c75f41 Update floodgate repo 2023-12-02 18:48:25 +08:00
HaHaWTH e0cc4e0790 Optimise GeoIP & Bump floodgate to 2.2.2-SNAPSHOT 2023-12-02 18:45:22 +08:00
HaHaWTH 1d9e1cb033 CHANGES: Migrate config path 2023-12-01 23:00:38 +08:00
HaHaWTH e413760b32 rename method 2023-12-01 22:45:38 +08:00
HaHaWTH 72f0055c58 Move string generate to playerLogin 2023-12-01 22:39:52 +08:00
HaHaWTH 4260b9d1ec Remove extra check 2023-12-01 00:57:28 +08:00
HaHaWTH 4eee83ca6f Fix #57 2023-12-01 00:52:44 +08:00
HaHaWTH 5cbbe5fc61 Merge remote-tracking branch 'origin/master' 2023-12-01 00:07:00 +08:00
HaHaWTH a542a35eba Add FormUtils for advanced bedrock experience 2023-12-01 00:01:29 +08:00
DGun Otto 00e34c21e1 [ci skip] Update README.md 2023-11-29 00:03:02 +08:00
HaHaWTH cf718a4cbd LoginLocationFix patch 2023-11-28 00:14:37 +08:00
HaHaWTH 5b037221a7 Merge remote-tracking branch 'origin/master' 2023-11-27 22:58:10 +08:00
HaHaWTH bee35c4ebf patch for BedrockAutoLogin 2023-11-27 22:57:54 +08:00
DGun Otto 3c364edbe1 Merge pull request #56 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.44.1.0
Bump org.xerial:sqlite-jdbc from 3.44.0.0 to 3.44.1.0
2023-11-27 22:24:45 +08:00
HaHaWTH 98fee693a4 private final 2023-11-27 22:17:04 +08:00
HaHaWTH 2734c3e58e update 2023-11-27 22:14:55 +08:00
HaHaWTH 6d7c928197 update 2023-11-27 15:56:24 +08:00
dependabot[bot] 0635e67e93 Bump org.xerial:sqlite-jdbc from 3.44.0.0 to 3.44.1.0
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.44.0.0 to 3.44.1.0.
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.44.0.0...3.44.1.0)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 04:14:35 +00:00
HaHaWTH b4df964d79 Merge remote-tracking branch 'origin/master' 2023-11-27 02:26:34 +08:00
HaHaWTH 36e8f7691a patch 2023-11-27 02:25:59 +08:00
DGun Otto 94803c4ff1 [ci skip] Update README.md 2023-11-27 02:17:10 +08:00
HaHaWTH 4886e3464f Compatibility patch 2023-11-27 01:23:29 +08:00
HaHaWTH 352ab899d4 Compatibility patch 2023-11-27 01:18:50 +08:00
9 changed files with 146 additions and 48 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
# 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) MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471495)
![Graph](https://bstats.org/signatures/bukkit/AuthMeReloaded-Fork.svg) ![Graph](https://bstats.org/signatures/bukkit/AuthMeReloaded-Fork.svg)
<p align="center"> <p align="center">
@@ -10,7 +10,7 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
**Detailed Changes:** **Detailed Changes:**
1. Improved mail sending logic & support more emails 1. Improved mail sending logic & support more emails
2. Shutdown mail sending(When server is closed, email you) 2. Shutdown mail sending(When server is closed, email you)
3. Old bug fixes 3. Legacy 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)(based on UUID) 6. Bedrock Compatibility(Floodgate needed)(based on UUID)
@@ -23,7 +23,8 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
compatibility [Here](https://github.com/HaHaWTH/AuthMeReReloaded/releases/download/b20/AuthMe-5.6.0-FORK-Folia.jar) 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. Automatically fix portal stuck issue 14. Automatically fix portal stuck issue
15. More...... 15. Automatically login for Bedrock players(configurable)
16. More......
**Download links:** **Download links:**
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest) [Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
+32 -2
View File
@@ -531,6 +531,30 @@
</snapshots> </snapshots>
</repository> </repository>
<!-- Aliyun maven central repo -->
<repository>
<id>aliyun-repo</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- Tencent cloud maven central repo -->
<repository>
<id>tencent-repo</id>
<url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- CodeMC Repo (Contains many required libraries) --> <!-- CodeMC Repo (Contains many required libraries) -->
<repository> <repository>
<id>codemc-repo</id> <id>codemc-repo</id>
@@ -598,11 +622,13 @@
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> </repository>
<!-- FoliaLib --> <!-- FoliaLib -->
<repository> <repository>
<id>devmart-other</id> <id>devmart-other</id>
<url>https://nexuslite.gcnt.net/repos/other/</url> <url>https://nexuslite.gcnt.net/repos/other/</url>
</repository> </repository>
<repository> <repository>
<id>opencollab-snapshot</id> <id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url> <url>https://repo.opencollab.dev/maven-snapshots/</url>
@@ -623,6 +649,10 @@
<enabled>false</enabled> <enabled>false</enabled>
</snapshots> </snapshots>
</repository> </repository>
<repository>
<id>opencollab-snapshot-main</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
@@ -630,7 +660,7 @@
<dependency> <dependency>
<groupId>org.geysermc.floodgate</groupId> <groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId> <artifactId>api</artifactId>
<version>2.2.0-SNAPSHOT</version> <version>2.2.2-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Jalu Injector --> <!-- Jalu Injector -->
@@ -1081,7 +1111,7 @@
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId> <artifactId>sqlite-jdbc</artifactId>
<version>3.44.0.0</version> <version>3.44.1.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
+1 -2
View File
@@ -206,7 +206,6 @@ public class AuthMe extends JavaPlugin {
// 注册玩家加入事件监听 // 注册玩家加入事件监听
// register3rdPartyListeners(); // register3rdPartyListeners();
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();
} }
@@ -450,7 +449,7 @@ public class AuthMe extends JavaPlugin {
private void checkServerType() { private void checkServerType() {
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) { if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
logger.info("AuthMeReReloaded is running on Paper"); logger.info("AuthMeReReloaded is running on Paper");
}else if (isClassLoaded("catserver.server.CatServerConfig")) { } else if (isClassLoaded("catserver.server.CatServerConfig")) {
logger.info("AuthMeReReloaded is running on CatServer"); logger.info("AuthMeReReloaded is running on CatServer");
} else if (isClassLoaded("org.spigotmc.SpigotConfig")) { } else if (isClassLoaded("org.spigotmc.SpigotConfig")) {
logger.info("AuthMeReReloaded is running on Spigot"); logger.info("AuthMeReReloaded is running on Spigot");
@@ -3,6 +3,7 @@ package fr.xephi.authme.listener;
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.events.RestoreSessionEvent;
import fr.xephi.authme.message.MessageKey; import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages; import fr.xephi.authme.message.Messages;
import fr.xephi.authme.service.BukkitService; import fr.xephi.authme.service.BukkitService;
@@ -49,4 +50,13 @@ public class BedrockAutoLoginListener implements Listener {
messages.send(player, MessageKey.BEDROCK_AUTO_LOGGED_IN); messages.send(player, MessageKey.BEDROCK_AUTO_LOGGED_IN);
} }
} }
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerAuthMeSessionRestore(RestoreSessionEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if (isBedrockPlayer(uuid)) {
event.setCancelled(true);
}
}
} }
@@ -7,6 +7,7 @@ import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
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.events.LoginEvent;
import fr.xephi.authme.message.MessageKey; import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages; import fr.xephi.authme.message.Messages;
import fr.xephi.authme.service.BukkitService; import fr.xephi.authme.service.BukkitService;
@@ -23,6 +24,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent; 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;
@@ -73,19 +75,18 @@ public class GuiCaptchaHandler implements Listener {
Random howManyRandom = new Random(); Random howManyRandom = new Random();
private boolean isPacketListenersActive = false; private boolean isPacketListenersActive = false;
int howLongIsRandomString;
public GuiCaptchaHandler() { public GuiCaptchaHandler() {
} }
protected List<String> whiteList = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST); private StringBuilder sb;
private final List<String> whiteList = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST);
private boolean isBedrockPlayer(UUID uuid) { private boolean isBedrockPlayer(UUID uuid) {
return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null; return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
} }
private void addPacketListeners() { private void initializePacketListeners() {
if (!isPacketListenersActive) { if (!isPacketListenersActive) {
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener); ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener); ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
@@ -105,7 +106,9 @@ public class GuiCaptchaHandler implements Listener {
} }
if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)) { if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)) {
event.setCancelled(true); event.setCancelled(true);
if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified"); closeReasonMap.put(player, "verified");
}
player.closeInventory(); player.closeInventory();
messages.send(player, MessageKey.GUI_CAPTCHA_VERIFIED); messages.send(player, MessageKey.GUI_CAPTCHA_VERIFIED);
} }
@@ -113,26 +116,12 @@ public class GuiCaptchaHandler implements Listener {
} }
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerLogin(PlayerLoginEvent event) {
randomString = ""; Player player = event.getPlayer();
Player playerunreg = event.getPlayer();
String name = playerunreg.getName();
if (!authmeApi.isRegistered(name) && !isNpc(playerunreg)) {
if (!whiteList.isEmpty()) {
String ip = getPlayerIp(playerunreg);
if (whiteList.contains(authmeApi.getCountryCode(ip)) && ip != null) {
return;
}
}
if (isBedrockPlayer(playerunreg.getUniqueId())) {
closeReasonMap.put(playerunreg, "verified");
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
return;
}
bukkitService.runTaskAsynchronously(() -> { bukkitService.runTaskAsynchronously(() -> {
StringBuilder sb = new StringBuilder(); sb = new StringBuilder();
howLongIsRandomString = (howManyRandom.nextInt(3) + 1); int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
for (int i = 0; i < howLongIsRandomString; i++) { for (int i = 0; i < howLongIsRandomString; i++) {
//生成随机索引号 //生成随机索引号
int index = randomItemSet.nextInt(randomSet.length()); int index = randomItemSet.nextInt(randomSet.length());
@@ -143,6 +132,31 @@ public class GuiCaptchaHandler implements Listener {
// 将字符追加到字符串生成器 // 将字符追加到字符串生成器
sb.append(randomChar); sb.append(randomChar);
} }
if (!whiteList.isEmpty()) {
String ip = getPlayerIp(player);
if (whiteList.contains(authmeApi.getCountryCode(ip)) && ip != null) {
if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified:whitelist");
}
}
}
});
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent event) {
randomString = "";
Player playerunreg = event.getPlayer();
String name = playerunreg.getName();
if (!authmeApi.isRegistered(name) && !isNpc(playerunreg) && !closeReasonMap.containsKey(playerunreg)) {
if (isBedrockPlayer(playerunreg.getUniqueId())) {
if (!closeReasonMap.containsKey(playerunreg)) {
closeReasonMap.put(playerunreg, "verified:bedrock");
}
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
return;
}
bukkitService.runTaskAsynchronously(() -> {
bukkitService.runTask(() -> { bukkitService.runTask(() -> {
randomString = sb.toString(); randomString = sb.toString();
Random random_blockpos = new Random(); Random random_blockpos = new Random();
@@ -161,28 +175,29 @@ public class GuiCaptchaHandler implements Listener {
windowPacketListener = 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 (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) { Player packetPlayer = event.getPlayer();
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
if (timesLeft <= 0) { if (timesLeft <= 0) {
bukkitService.runTask(() -> { bukkitService.runTask(() -> {
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_FAILED)); packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
}); });
timesLeft = 3; timesLeft = 3;
} else { } else {
--timesLeft; --timesLeft;
if (timesLeft <= 0) { if (timesLeft <= 0) {
bukkitService.runTask(() -> { bukkitService.runTask(() -> {
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_FAILED)); packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
}); });
timesLeft = 3; timesLeft = 3;
return; return;
} }
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_RETRY_MESSAGE, String.valueOf(timesLeft)); messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_RETRY_MESSAGE, String.valueOf(timesLeft));
event.setCancelled(true); event.setCancelled(true);
random_num.set(random_blockpos.nextInt(26)); random_num.set(random_blockpos.nextInt(26));
bukkitService.runTask(() -> { bukkitService.runTask(() -> {
menu.clear(); menu.clear();
menu.setItem(random_num.get(), item); menu.setItem(random_num.get(), item);
playerunreg.openInventory(menu); packetPlayer.openInventory(menu);
}); });
} }
} }
@@ -191,13 +206,14 @@ public class GuiCaptchaHandler implements Listener {
chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) { chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
@Override @Override
public void onPacketReceiving(PacketEvent event) { public void onPacketReceiving(PacketEvent event) {
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) { Player packetPlayer = event.getPlayer();
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_DENIED_MESSAGE); if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_DENIED_MESSAGE);
event.setCancelled(true); event.setCancelled(true);
} }
} }
}; };
addPacketListeners(); initializePacketListeners();
//Open captcha inventory //Open captcha inventory
menu.setItem(random_num.get(), item); menu.setItem(random_num.get(), item);
playerunreg.openInventory(menu); playerunreg.openInventory(menu);
@@ -225,6 +241,15 @@ public class GuiCaptchaHandler implements Listener {
} }
} }
//This prevents players from unregistering by Admins
@EventHandler
public void onPlayerAuthMeLogin(LoginEvent event) {
Player player = event.getPlayer();
if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified:loggedIn");
}
}
private void deletePlayerData(UUID playerUUID) { private void deletePlayerData(UUID playerUUID) {
// 获取服务器的存储文件夹路径 // 获取服务器的存储文件夹路径
@@ -4,6 +4,7 @@ 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.MessageKey;
import fr.xephi.authme.message.Messages; import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.TeleportUtils; import fr.xephi.authme.util.TeleportUtils;
import org.bukkit.Location; import org.bukkit.Location;
@@ -24,6 +25,8 @@ public class LoginLocationFixListener implements Listener {
private AuthMe plugin; private AuthMe plugin;
@Inject @Inject
private Messages messages; private Messages messages;
@Inject
private Settings settings;
private final AuthMeApi authmeApi = AuthMeApi.getInstance(); private final AuthMeApi authmeApi = AuthMeApi.getInstance();
public LoginLocationFixListener() { public LoginLocationFixListener() {
@@ -14,6 +14,8 @@ import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.SpawnLoader;
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.util.TeleportUtils;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -140,7 +142,7 @@ public class TeleportationService implements Reloadable {
logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName()); logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName());
teleportToSpawn(player, true); teleportToSpawn(player, true);
} else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) { } else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) { if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
Location location = buildLocationFromAuth(player, auth); Location location = buildLocationFromAuth(player, auth);
logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName()); logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
teleportBackFromSpawn(player, location); teleportBackFromSpawn(player, location);
@@ -184,7 +186,9 @@ public class TeleportationService implements Reloadable {
private void performTeleportation(final Player player, final AbstractTeleportEvent event) { private void performTeleportation(final Player player, final AbstractTeleportEvent event) {
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> { bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
bukkitService.callEvent(event); bukkitService.callEvent(event);
if (player.isOnline() && isEventValid(event)) { if (player.isOnline() && isEventValid(event) && settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player, event.getTo());
} else if (player.isOnline() && isEventValid(event)) {
player.teleport(event.getTo()); player.teleport(event.getTo());
} }
}); });
@@ -24,7 +24,7 @@ public final class SecuritySettings implements SettingsHolder {
@Comment({"Should send GUI captcha by country code whitelist?", @Comment({"Should send GUI captcha by country code whitelist?",
"If the country of the player is in this list, the captcha won't be sent."}) "If the country of the player is in this list, the captcha won't be sent."})
public static final Property<List<String>> GUI_CAPTCHA_COUNTRY_WHITELIST = public static final Property<List<String>> GUI_CAPTCHA_COUNTRY_WHITELIST =
newListProperty("3rdPartyFeature.captcha.whiteList"); newListProperty("3rdPartyFeature.features.captcha.whiteList");
@Comment({"Should we let Bedrock players login automatically?", @Comment({"Should we let Bedrock players login automatically?",
"(Requires hookFloodgate to be true & floodgate loaded)"}) "(Requires hookFloodgate to be true & floodgate loaded)"})
@@ -38,21 +38,21 @@ public final class SecuritySettings implements SettingsHolder {
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.features.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)"})
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.captcha.timeOut",0); public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.features.captcha.timeOut", 0);
@Comment({"Should we ignore floodgate players when sending GUI captcha?", @Comment({"Should we ignore floodgate players when sending GUI captcha?",
"(Requires floodgate and hookFloodgate: true)"}) "(Requires floodgate and hookFloodgate: true)"})
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.captcha.ignoreBedrock",false); public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.features.captcha.ignoreBedrock", false);
@Comment("Should we delete player data and stats when they didn't finish the captcha?") @Comment("Should we delete player data and stats when they didn't finish the captcha?")
public static final Property<Boolean> DELETE_UNVERIFIED_PLAYER_DATA = newProperty("3rdPartyFeature.captcha.purgePlayerData",false); public static final Property<Boolean> DELETE_UNVERIFIED_PLAYER_DATA = newProperty("3rdPartyFeature.features.captcha.purgePlayerData", false);
@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.features.captcha.purgeWorldFolderName", "world");
@Comment("Should we fix the location when players logged in the portal?") @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); public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
@@ -0,0 +1,26 @@
package fr.xephi.authme.util;
import fr.xephi.authme.api.v3.AuthMeApi;
import org.bukkit.entity.Player;
import org.geysermc.cumulus.form.CustomForm;
import org.geysermc.floodgate.api.FloodgateApi;
import java.util.UUID;
public class FormUtils {
private static final FloodgateApi floodgateApi = FloodgateApi.getInstance();
private static final AuthMeApi authMeApi = AuthMeApi.getInstance();
public static void openRegisterForm(Player player, String title, String text, String textBar) {
String name = player.getName();
UUID uuid = player.getUniqueId();
CustomForm.Builder regForm = CustomForm.builder()
.title(title)
.input(text, textBar)
.validResultHandler(((customForm1, customFormResponse) -> {
authMeApi.registerPlayer(name, customFormResponse.asInput(0));
}));
floodgateApi.sendForm(uuid, regForm);
}
}