Skip to content

Commit ebed9cb

Browse files
committed
添加 玩家以白名单身份首次加入服务器 事件
1 parent 5c1b3e3 commit ebed9cb

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ whitelist:
366366
# [AuthMe] 自动注册登录参观账户
367367
AuthMePlugin:
368368
# 为参观账户自动注册和登录, 相当于 `/authme register <playerName> <password>` 和 `/authme forcelogin <playerName>`, 但不会踢出玩家
369-
autoRegisterAndLogin: true
369+
autoRegisterAndLogin: false
370370
# 需要在这里填写一个复杂的密码, 只要满足 AuthMe 的密码规则即可
371371
autoRegisterPassword: 'complexPassword'
372372

@@ -430,6 +430,8 @@ whitelist:
430430
msgBroadcast:
431431
- '§6IpacEL §f> §a%playerName% §b加入游戏'
432432

433+
onPlayerWhiteFirstJoin: [ ] # 玩家以白名单身份首次加入服务器
434+
433435
onAuthMeLoginEvent: # 玩家通过 AuthMe 登录成功
434436
msgBroadcast:
435437
- '§6IpacEL §f> §a%playerName% §b登录成功'

src/main/java/aplini/ipacwhitelist/listener/onPlayerLogin.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,32 @@ public void onPlayerJoinEvent(PlayerJoinEvent event){
361361
runEventFunc("whitelist.VISIT_CONVERT.onPlayerJoinEvent", player);
362362
// 在这里设置为白名单
363363
pd.type = Type.WHITE;
364+
365+
// 处理白名单加入
366+
if(true){
367+
runEventFunc("whitelist.WHITE.onPlayerJoinEvent", player);
368+
// 玩家以白名单身份首次加入服务器
369+
if(pd.config.data.get("whiteFirstJoin") != "1"){
370+
pd.config.data.put("whiteFirstJoin", "1");
371+
runEventFunc("whitelist.WHITE.onPlayerWhiteFirstJoin", player);
372+
}
373+
}
374+
364375
pd.save();
365376
// 记录在线玩家
366377
playerList.add(pd.uuid);
367378
}
368379
case WHITE -> {
369-
// 白名单玩家加入事件
370-
runEventFunc("whitelist.WHITE.onPlayerJoinEvent", player);
380+
// 处理白名单加入
381+
if(true){
382+
runEventFunc("whitelist.WHITE.onPlayerJoinEvent", player);
383+
// 玩家以白名单身份首次加入服务器
384+
if(pd.config.data.get("whiteFirstJoin") != "1"){
385+
pd.config.data.put("whiteFirstJoin", "1");
386+
pd.save();
387+
runEventFunc("whitelist.WHITE.onPlayerWhiteFirstJoin", player);
388+
}
389+
}
371390
// 记录在线玩家
372391
playerList.add(pd.uuid);
373392
}

src/main/resources/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ whitelist:
177177
msgBroadcast:
178178
- '§6IpacEL §f> §a%playerName% §b加入游戏'
179179

180+
onPlayerWhiteFirstJoin: [ ] # 玩家以白名单身份首次加入服务器
181+
180182
onAuthMeLoginEvent: # 玩家通过 AuthMe 登录成功
181183
msgBroadcast:
182184
- '§6IpacEL §f> §a%playerName% §b登录成功'

0 commit comments

Comments
 (0)