diff --git a/LinearBot-bukkit/src/main/java/org/linear/linearbot/event/server/ServerEvent.java b/LinearBot-bukkit/src/main/java/org/linear/linearbot/event/server/ServerEvent.java index 6d70659..afc90ba 100644 --- a/LinearBot-bukkit/src/main/java/org/linear/linearbot/event/server/ServerEvent.java +++ b/LinearBot-bukkit/src/main/java/org/linear/linearbot/event/server/ServerEvent.java @@ -1,6 +1,7 @@ package org.linear.linearbot.event.server; import org.bukkit.Location; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -50,7 +51,22 @@ public void onJoin(PlayerJoinEvent event){ String realName = StringTool.filterColor(player.getName()); - if (Args.WhitelistMode()==1){ + /*if (Args.WhitelistMode()==1){ + if (Config.getWhitelistYaml().getString(realName)==null){ + player.kickPlayer(Config.getConfigYaml().getString("Whitelist.kickMsg")); + } + List groups = Config.getGroupQQs(); + for (long groupID : groups){ + Bot.sendMsg("玩家"+name+"因为未在白名单中被踢出",groupID); + } + return; + }*/ + boolean whitelisted = true; + YamlConfiguration white = YamlConfiguration.loadConfiguration(Config.WhitelistFile()); + List names = white.getStringList("name"); + whitelisted = names.contains(event.getPlayer().getName()); + + if(!whitelisted){ if (Config.getWhitelistYaml().getString(realName)==null){ player.kickPlayer(Config.getConfigYaml().getString("Whitelist.kickMsg")); } diff --git a/LinearBot-bukkit/src/main/resources/config.yml b/LinearBot-bukkit/src/main/resources/config.yml index 40f6b65..f57ff10 100644 --- a/LinearBot-bukkit/src/main/resources/config.yml +++ b/LinearBot-bukkit/src/main/resources/config.yml @@ -16,8 +16,7 @@ DieReport: false #白名单 WhiteList: enable: false - mode: 0 #mode设置为0则使用原版游戏自带白名单,设置为1则使用插件自带白名单 - kickMsg: "请加入qq群:xxx申请白名单" #当mode为1时且玩家因未在白名单中被踢出时显示的消息 + kickMsg: "请加入qq群:xxx申请白名单" #执行命令功能 CMD: true