Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RegadPoleCN committed Jul 12, 2024
1 parent 99bf8b3 commit 1802e6e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void createConfig(){
if (!Config.getBotYamlVersion().equals("1.3.0")){
INSTANCE.saveResource(botFile.getName(), true);
}
if (!Config.getConfigYamlVersion().equals("1.3.2")){
if (!Config.getConfigYamlVersion().equals("1.3.3")){
INSTANCE.saveResource(configFile.getName(), true);
}
if (!Config.getCommandsYamlVersion().equals("1.2.2")){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,48 @@ public void onPreLogin(AsyncPlayerPreLoginEvent event){
@EventHandler(priority = EventPriority.MONITOR)
public void onJoin(PlayerJoinEvent event){

String name = event.getPlayer().getName();
Player player = event.getPlayer();
String name = player.getName();

if (!Config.JoinAndLeave()){
return;
}
List<Long> groups = Config.getGroupQQs();
for (long groupID : groups){
PlumBot.getBot().sendMsg(true, "玩家"+name+"加入游戏",groupID);
if (Config.WhiteList()) {
PlumBot.getScheduler().runTaskAsynchronously(() -> {
long qq;
qq = (DatabaseManager.getBindId(name, DataBase.type().toLowerCase(), PlumBot.getDatabase()));
if (qq == 0L) {
player.kickPlayer(Args.WhitelistKick());
List<Long> groups = Config.getGroupQQs();
for (long groupID : groups) {
PlumBot.getBot().sendMsg(true, "玩家" + name + "因为未在白名单中被踢出", groupID);
}
return;
}
for (long groupID : Config.getGroupQQs()) {
if(!PlumBot.getBot().checkUserInGroup(qq, groupID)){
player.kickPlayer(Args.WhitelistKick());
List<Long> groups = Config.getGroupQQs();
for (long group : groups) {
PlumBot.getBot().sendMsg(true, "玩家" + name + "因为未在白名单中被踢出", group);
}
DatabaseManager.removeBind(String.valueOf(qq), DataBase.type().toLowerCase(), PlumBot.getDatabase());
return;
}
}
if (!Config.JoinAndLeave()){
return;
}
List<Long> groups = Config.getGroupQQs();
for (long groupID : groups){
PlumBot.getBot().sendMsg(true, "玩家"+name+"加入游戏",groupID);
}
});
} else {
if (!Config.JoinAndLeave()){
return;
}
List<Long> groups = Config.getGroupQQs();
for (long groupID : groups){
PlumBot.getBot().sendMsg(true, "玩家"+name+"加入游戏",groupID);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion plumbot-bukkit/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#机器人功能设置
Ver: "1.3.2"
Ver: "1.3.3"

#QQ群聊命令前缀
Prefix: "/"
Expand Down

0 comments on commit 1802e6e

Please sign in to comment.