Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
DongShaoNB committed Oct 15, 2023
2 parents df28e28 + ea8ba90 commit 56c839c
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 16 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
功能:
1. 当基岩版玩家收到 tpa/tpahere 申请时会弹出GUI让玩家选择 同意/拒绝/忽略 (CMI/EssentialsX/HuskHomes)
2. 基岩版玩家使用指令 /tpagui (/tpaheregui) 弹出基岩版玩家专属表单选择要 tpa (tpahere) 的玩家
3. 基岩版玩家进服登录时直接跳过基岩版玩家登录环节 (AuthMe/Others)
3. 基岩版玩家进服登录时直接跳过基岩版玩家登录环节 (AuthMe/CatSeedLogin/NexAuth/Others)

------

Expand All @@ -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] (可选)

------

Expand All @@ -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/
Binary file added libs/NexAuth-2.0.3.jar
Binary file not shown.
Binary file added libs/NexEngine.jar
Binary file not shown.
54 changes: 45 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,26 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -41,6 +51,7 @@
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -86,6 +97,11 @@
<id>william278.net</id>
<url>https://repo.william278.net/releases</url>
</repository>
<!-- CatSeedLogin -->
<repository>
<id>jitpack-repo</id>
<url>https://www.jitpack.io/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -111,13 +127,7 @@
<dependency>
<groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId>
<version>2.19.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.xephi</groupId>
<artifactId>authme</artifactId>
<version>5.6.0-SNAPSHOT</version>
<version>2.20.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -132,5 +142,31 @@
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.xephi</groupId>
<artifactId>authme</artifactId>
<version>5.6.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.CatSeed</groupId>
<artifactId>CatSeedLogin</artifactId>
<version>1.4.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>su.nexmedia.auth</groupId>
<artifactId>NexAuth</artifactId>
<version>2.0.3</version>
<scope>system</scope>
<systemPath>${basedir}/libs/NexAuth-2.0.3.jar</systemPath>
</dependency>
<dependency>
<groupId>su.nexmedia.engine</groupId>
<artifactId>NexEngine</artifactId>
<version>2.2.12</version>
<scope>system</scope>
<systemPath>${basedir}/libs/NexEngine.jar</systemPath>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;


Expand All @@ -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);
}

Expand Down Expand Up @@ -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("已开启基岩版玩家自动登录功能,使用插件: 其他(控制台使用命令强制登录)");
Expand All @@ -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("检测不到支持的登录插件,已关闭自动登录功能!");
Expand Down Expand Up @@ -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("-----------------");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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")));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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")));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ login:
# 请注意,注册仍需玩家手动注册,后续登录才可以自动登录
# 默认值: false
enable: false
# 使用的登录插件 (可选值: auto/authme/other)
# 使用的登录插件 (可选值: auto/authme/catseedlogin/nexauth/other)
# 如果是AuthMe请填写authme 其他则为other
# 当选择auto时如果服务器有安装AuthMe插件则自动更改为authme 否则自动关闭该功能
# 如果不需要此功能 请将上方的enable设置为false
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ softdepend:
- Essentials
- HuskHomes
- AuthMe
- CatSeedLogin
- NexAuth
authors: [ DongShaoNB ]
description: Support bedrock player fast use java plugin
website: www.dsnbo.cn
Expand Down

0 comments on commit 56c839c

Please sign in to comment.