-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Winds-Studio/master
增加对CatSeedLogin和NexAuth的自动登录支持, 和其他小改动
- Loading branch information
Showing
11 changed files
with
144 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/CatSeedLoginListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"))); | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/cn/dsnbo/bedrockplayersupport/listener/login/NexAuthListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters