Skip to content

Commit

Permalink
Trying fix ex
Browse files Browse the repository at this point in the history
  • Loading branch information
glowingstone124 committed Oct 12, 2024
1 parent 1d20959 commit dc71ac5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event) throws Exception {
public void onPlayerJoin(PlayerJoinEvent event) throws Exception {
QuantumPlugin quantumPlugin = QuantumPlugin.getInstance();
Player player = event.getPlayer();
cs.sendChatMsg("玩家" + player.getName() + "加入了服务器。");
Thread.startVirtualThread(() -> {
try {
IPUtils.locIsCn(event, quantumPlugin);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/vip/qoriginal/quantumplugin/Login.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ class Login : Listener {
val playerLoginMap = hashMapOf<Player, Int>()
}
@OptIn(DelicateCoroutinesApi::class)
fun performLogin(player: Player, password: String) {
fun performLogin(player: Player, password: String) {
GlobalScope.launch {
val loginResult = withContext(Dispatchers.IO) {
JsonParser.parseString(Request.sendGetRequest("http://localhost:8080/qo/game/login?username=${player.name}&password=$password").get()).asJsonObject
}

if (loginResult.get("result").asBoolean) {
player.removeScoreboardTag("guest")
player.sendTitlePart(TitlePart.TITLE, Component.text("登录成功").color(NamedTextColor.GREEN))
Expand All @@ -37,10 +36,10 @@ class Login : Listener {
player.sendMessage(
Component.text("登录成功,您已经游玩 ${time.get("time").asLong}分钟").color(NamedTextColor.GREEN)
)
ChatSync().sendChatMsg("玩家${player.name}加入了服务器");

} else {
player.sendMessage(Component.text("登录失败,原因:密码不正确").color(NamedTextColor.RED))

playerLoginMap[player] = (playerLoginMap[player] ?: 0) + 1
if (playerLoginMap[player]!! >= 3) {
player.kick(Component.text("失败次数过多。"))
Expand Down

0 comments on commit dc71ac5

Please sign in to comment.