diff --git a/README.md b/README.md index 056ab532..5c39feda 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 功能: 1. 当基岩版玩家收到 tpa/tpahere 申请时会弹出GUI让玩家选择 同意/拒绝/忽略 (CMI/EssentialsX/HuskHomes) 2. 基岩版玩家使用指令 /tpagui (/tpaheregui) 弹出基岩版玩家专属表单选择要 tpa (tpahere) 的玩家 - 3. 基岩版玩家进服登录时直接跳过基岩版玩家登录环节 (AuthMe/Others) + 3. 基岩版玩家进服登录时直接跳过基岩版玩家登录环节 (AuthMe/CatSeedLogin/NexAuth/Others) ------ @@ -17,7 +17,7 @@ 直接丢进 plugins 文件夹即可 前置: - [floodgate][2] (必要) - - [CMI][1] [EssentialsX][3] [HuskHomes][5] [AuthMe][4] (可选) + - [CMI][1] / [EssentialsX][3] / [HuskHomes][5] / [AuthMe][4] / [CatSeedLogin][6] / [NexAuth][7] (可选) ------ @@ -28,5 +28,7 @@ QQ群: 159323818 [1]: https://www.spigotmc.org/resources/cmi-298-commands-insane-kits-portals-essentials-economy-mysql-sqlite-much-more.3742/ [2]: https://github.com/GeyserMC/Floodgate [3]: https://www.spigotmc.org/resources/essentialsx.9089/ - [4]: https://dev.bukkit.org/bukkit-plugins/authme-reloaded/ + [4]: https://github.com/AuthMe/AuthMeReloaded [5]: https://www.spigotmc.org/resources/%E2%AD%90-huskhomes-1-16-1-20-%E2%AD%90-simple-intuitive-teleportation-suite-with-cross-server-support.83767/ + [6]: https://www.mcbbs.net/thread-847859-1-1.html + [7]: https://www.spigotmc.org/resources/nexauth-simple-and-lightweight-login-system.88015/ diff --git a/libs/NexAuth-2.0.3.jar b/libs/NexAuth-2.0.3.jar new file mode 100644 index 00000000..106d1cde Binary files /dev/null and b/libs/NexAuth-2.0.3.jar differ diff --git a/libs/NexEngine.jar b/libs/NexEngine.jar new file mode 100644 index 00000000..f24f894c Binary files /dev/null and b/libs/NexEngine.jar differ diff --git a/pom.xml b/pom.xml index 5b5f2cd6..b907ea4a 100644 --- a/pom.xml +++ b/pom.xml @@ -23,16 +23,26 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.11.0 ${java.version} ${java.version} + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + false + + + org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.5.1 package @@ -41,6 +51,7 @@ false + true @@ -86,6 +97,11 @@ william278.net https://repo.william278.net/releases + + + jitpack-repo + https://www.jitpack.io/ + @@ -111,13 +127,7 @@ net.essentialsx EssentialsX - 2.19.7 - provided - - - fr.xephi - authme - 5.6.0-SNAPSHOT + 2.20.1 provided @@ -132,5 +142,31 @@ 1.18.30 provided + + fr.xephi + authme + 5.6.0-SNAPSHOT + provided + + + com.github.CatSeed + CatSeedLogin + 1.4.1 + provided + + + su.nexmedia.auth + NexAuth + 2.0.3 + system + ${basedir}/libs/NexAuth-2.0.3.jar + + + su.nexmedia.engine + NexEngine + 2.2.12 + system + ${basedir}/libs/NexEngine.jar + diff --git a/src/main/java/cn/dsnbo/bedrockplayersupport/BedrockPlayerSupport.java b/src/main/java/cn/dsnbo/bedrockplayersupport/BedrockPlayerSupport.java index 02e4c8be..9f32736f 100644 --- a/src/main/java/cn/dsnbo/bedrockplayersupport/BedrockPlayerSupport.java +++ b/src/main/java/cn/dsnbo/bedrockplayersupport/BedrockPlayerSupport.java @@ -2,6 +2,8 @@ import cn.dsnbo.bedrockplayersupport.command.TpaCommand; import cn.dsnbo.bedrockplayersupport.command.TpaHereCommand; +import cn.dsnbo.bedrockplayersupport.listener.login.CatSeedLoginListener; +import cn.dsnbo.bedrockplayersupport.listener.login.NexAuthListener; import cn.dsnbo.bedrockplayersupport.listener.login.OtherLoginListener; import cn.dsnbo.bedrockplayersupport.listener.teleport.HuskHomesTeleportListener; import cn.dsnbo.bedrockplayersupport.listener.login.AuthMeListener; @@ -27,6 +29,8 @@ public final class BedrockPlayerSupport extends JavaPlugin implements Listener { private boolean isEssxEnabled; private boolean isHuskHomesEnabled; private boolean isAuthMeEnabled; + private boolean isCatSeedLoginEnabled; + private boolean isNexAuthEnabled; private boolean isFloodgateEnabled; @@ -52,6 +56,8 @@ private void loadDependLoadStatus() { isEssxEnabled = !(Bukkit.getPluginManager().getPlugin("Essentials") == null); isHuskHomesEnabled = !(Bukkit.getPluginManager().getPlugin("HuskHomes") == null); isAuthMeEnabled = !(Bukkit.getPluginManager().getPlugin("AuthMe") == null); + isCatSeedLoginEnabled = !(Bukkit.getPluginManager().getPlugin("CatSeedLogin") == null); + isNexAuthEnabled = !(Bukkit.getPluginManager().getPlugin("NexAuth") == null); isFloodgateEnabled = !(Bukkit.getPluginManager().getPlugin("floodgate") == null); } @@ -105,6 +111,14 @@ public void loadConfig() { Bukkit.getPluginManager().registerEvents(new AuthMeListener(), this); getLogger().info("已开启基岩版玩家自动登录功能,使用插件: AuthMe"); } + case "catseedlogin" -> { + Bukkit.getPluginManager().registerEvents(new CatSeedLoginListener(), this); + getLogger().info("已开启基岩版玩家自动登录功能,使用插件: CatSeedLogin"); + } + case "nexauth" -> { + Bukkit.getPluginManager().registerEvents(new NexAuthListener(), this); + getLogger().info("已开启基岩版玩家自动登录功能,使用插件: NexAuth"); + } case "other" -> { Bukkit.getPluginManager().registerEvents(new OtherLoginListener(), this); getLogger().info("已开启基岩版玩家自动登录功能,使用插件: 其他(控制台使用命令强制登录)"); @@ -115,6 +129,14 @@ public void loadConfig() { getConfig().set("login.plugin", "authme"); Bukkit.getPluginManager().registerEvents(new AuthMeListener(), this); getLogger().info("已开启基岩版玩家自动登录功能,使用插件: AuthMe"); + } else if (isCatSeedLoginEnabled) { + getConfig().set("login.plugin", "catseedlogin"); + Bukkit.getPluginManager().registerEvents(new CatSeedLoginListener(), this); + getLogger().info("已开启基岩版玩家自动登录功能,使用插件: CatSeedLogin"); + } else if (isNexAuthEnabled) { + getConfig().set("login.plugin", "nexauth"); + Bukkit.getPluginManager().registerEvents(new NexAuthListener(), this); + getLogger().info("已开启基岩版玩家自动登录功能,使用插件: NexAuth"); } else { getConfig().set("login.enable", "false"); getLogger().warning("检测不到支持的登录插件,已关闭自动登录功能!"); @@ -147,6 +169,8 @@ private void printSupportPluginLoadStatus() { getLogger().info("EssentialsX: " + isEssxEnabled); getLogger().info("HuskHomes: " + isHuskHomesEnabled); getLogger().info("AuthMe: " + isAuthMeEnabled); + getLogger().info("CatSeedLogin: " + isCatSeedLoginEnabled); + getLogger().info("NexAuth: " + isNexAuthEnabled); getLogger().info("-----------------"); } diff --git a/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/AuthMeListener.java b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/AuthMeListener.java index 72649e08..ad085b8d 100644 --- a/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/AuthMeListener.java +++ b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/AuthMeListener.java @@ -2,6 +2,7 @@ import cn.dsnbo.bedrockplayersupport.BedrockPlayerSupport; import fr.xephi.authme.api.v3.AuthMeApi; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -18,9 +19,8 @@ public void onPlayerJoinEvent(PlayerJoinEvent e) { if (FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) { if (!AuthMeApi.getInstance().isAuthenticated(player)) { if (AuthMeApi.getInstance().isRegistered(player.getName())) { - if (BedrockPlayerSupport.getInstance().getConfig().getBoolean("login.enable")) { - AuthMeApi.getInstance().forceLogin(player); - } + AuthMeApi.getInstance().forceLogin(player); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', BedrockPlayerSupport.getInstance().getConfig().getString("login.auto-message"))); } } } diff --git a/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/CatSeedLoginListener.java b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/CatSeedLoginListener.java new file mode 100644 index 00000000..5eca86f8 --- /dev/null +++ b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/CatSeedLoginListener.java @@ -0,0 +1,34 @@ +package cn.dsnbo.bedrockplayersupport.listener.login; + +import cc.baka9.catseedlogin.bukkit.Config; +import cc.baka9.catseedlogin.bukkit.database.Cache; +import cc.baka9.catseedlogin.bukkit.object.LoginPlayer; +import cc.baka9.catseedlogin.bukkit.object.LoginPlayerHelper; +import cn.dsnbo.bedrockplayersupport.BedrockPlayerSupport; +import cc.baka9.catseedlogin.bukkit.CatSeedLoginAPI; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.geysermc.floodgate.api.FloodgateApi; + +/** + * @author DongShaoNB + */ +public class CatSeedLoginListener implements Listener { + @EventHandler + public void onPlayerJoinEvent(PlayerJoinEvent e) { + Player player = e.getPlayer(); + if (FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) { + if (!CatSeedLoginAPI.isLogin(player.getName()) && CatSeedLoginAPI.isRegister(player.getName())) { + LoginPlayerHelper.add(new LoginPlayer(player.getName(), "")); + Cache.refresh(player.getName()); + if (Config.Settings.AfterLoginBack && Config.Settings.CanTpSpawnLocation) { + Config.getOfflineLocation(player).ifPresent(player::teleport); + } + player.sendMessage(ChatColor.translateAlternateColorCodes('&', BedrockPlayerSupport.getInstance().getConfig().getString("login.auto-message"))); + } + } + } +} diff --git a/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/NexAuthListener.java b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/NexAuthListener.java new file mode 100644 index 00000000..e2721f24 --- /dev/null +++ b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/NexAuthListener.java @@ -0,0 +1,28 @@ +package cn.dsnbo.bedrockplayersupport.listener.login; + +import cn.dsnbo.bedrockplayersupport.BedrockPlayerSupport; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.geysermc.floodgate.api.FloodgateApi; +import su.nexmedia.auth.NexAuthAPI; +import su.nexmedia.auth.auth.impl.AuthPlayer; +import su.nexmedia.auth.auth.impl.PlayerState; + +/** + * @author DongShaoNB + */ +public class NexAuthListener implements Listener { + @EventHandler + public void onPlayerJoinEvent(PlayerJoinEvent e) { + Player player = e.getPlayer(); + if (FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) { + if (AuthPlayer.getOrCreate(player).getState() == PlayerState.IN_LOGIN && AuthPlayer.getOrCreate(player).isRegistered()) { + NexAuthAPI.getAuthManager().login(player); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', BedrockPlayerSupport.getInstance().getConfig().getString("login.auto-message"))); + } + } + } +} diff --git a/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/OtherLoginListener.java b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/OtherLoginListener.java index 0f114adb..f119dbd0 100644 --- a/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/OtherLoginListener.java +++ b/src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/OtherLoginListener.java @@ -2,6 +2,7 @@ import cn.dsnbo.bedrockplayersupport.BedrockPlayerSupport; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,6 +20,7 @@ public void onPlayerJoinEvent(PlayerJoinEvent e) { if (FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) { Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), BedrockPlayerSupport.getInstance().getConfig().getString("login.forcelogin-command") .replace("%player%", player.getName())); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', BedrockPlayerSupport.getInstance().getConfig().getString("login.auto-message"))); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index af194148..7a010057 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -16,7 +16,7 @@ login: # 请注意,注册仍需玩家手动注册,后续登录才可以自动登录 # 默认值: false enable: false - # 使用的登录插件 (可选值: auto/authme/other) + # 使用的登录插件 (可选值: auto/authme/catseedlogin/nexauth/other) # 如果是AuthMe请填写authme 其他则为other # 当选择auto时如果服务器有安装AuthMe插件则自动更改为authme 否则自动关闭该功能 # 如果不需要此功能 请将上方的enable设置为false diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ec8ebace..0de83284 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,6 +10,8 @@ softdepend: - Essentials - HuskHomes - AuthMe + - CatSeedLogin + - NexAuth authors: [ DongShaoNB ] description: Support bedrock player fast use java plugin website: www.dsnbo.cn