diff --git a/src/main/java/aplini/ipacwhitelist/IpacWhitelist.java b/src/main/java/aplini/ipacwhitelist/IpacWhitelist.java index 5c4bbe3..cd9be5f 100644 --- a/src/main/java/aplini/ipacwhitelist/IpacWhitelist.java +++ b/src/main/java/aplini/ipacwhitelist/IpacWhitelist.java @@ -124,13 +124,19 @@ public void onPlayerLogin(PlayerLoginEvent event) { } } + case EXPIRED -> { // 白名单已过期 + getLogger().info("[IpacWhitelist] %s 白名单已过期".formatted(event.getPlayer().getName())); + event.setKickMessage(plugin.getConfig().getString("message.join.not", "").replace("%player%", event.getPlayer().getName())); + event.setResult(PlayerLoginEvent.Result.KICK_WHITELIST); + } + case BLACK -> { // 黑名单 getLogger().info("[IpacWhitelist] %s 在黑名单中".formatted(event.getPlayer().getName())); event.setKickMessage(plugin.getConfig().getString("message.join.black", "").replace("%player%", event.getPlayer().getName())); event.setResult(PlayerLoginEvent.Result.KICK_BANNED); } - case VISIT_DEL_DATA -> { // 已删除数据的参观账户 + case VISIT_DATA_DELETE -> { // 已删除数据的参观账户 Visit.onNewVisitPlayerLoginEvent(event); } diff --git a/src/main/java/aplini/ipacwhitelist/util/SQL.java b/src/main/java/aplini/ipacwhitelist/util/SQL.java index 92d7e61..6519523 100644 --- a/src/main/java/aplini/ipacwhitelist/util/SQL.java +++ b/src/main/java/aplini/ipacwhitelist/util/SQL.java @@ -130,7 +130,7 @@ public static wlType setPlayerData(String name, String UUID, int Time, wlType Wh // 输出账户类型 switch(results.getInt("Type")){ case 1 -> out = VISIT; - case 2 -> out = VISIT_DEL_DATA; + case 2 -> out = VISIT_DATA_DELETE; default -> out = DEFAULT; } // 处理缺省值 @@ -193,7 +193,7 @@ public static wlType banPlayerUUID(String UUID){ // 是否在白名单中 - // NOT = 不在, WHITE = 存在, ERROR = 出错, VISIT = 存在但是参观账号, VISIT_DEL_DATA = 已删除数据的参观账户 + // NOT = 不在, EXPIRED = 过期, WHITE = 存在, ERROR = 出错, VISIT = 存在但是参观账号, VISIT_DEL_DATA = 已删除数据的参观账户 public static wlType isWhitelisted(Player player){ try { PreparedStatement sql; @@ -209,9 +209,9 @@ public static wlType isWhitelisted(Player player){ if(results.getLong("WHITE") == BLACK.getID()){return BLACK;} // 是否为参观账户 if(results.getLong("Type") == VISIT.getID()){return VISIT;} - if(results.getLong("Type") == VISIT_DEL_DATA.getID()){return VISIT_DEL_DATA;} + if(results.getLong("Type") == VISIT_DATA_DELETE.getID()){return VISIT_DATA_DELETE;} // 白名单上的玩家是否超时 - if(Util.isWhitelistedTimeout(results.getLong("TIME"))){return NOT;} + if(Util.isWhitelistedTimeout(results.getLong("TIME"))){return EXPIRED;} // 更新名称和最后加入时间 PreparedStatement update = connection.prepareStatement("UPDATE `player` SET `NAME` = ?, `TIME` = ? WHERE `ID` = ?;"); @@ -236,9 +236,9 @@ public static wlType isWhitelisted(Player player){ if(results.getLong("WHITE") == BLACK.getID()){return BLACK;} // 是否为参观账户 if(results.getLong("Type") == VISIT.getID()){return VISIT;} - if(results.getLong("Type") == VISIT_DEL_DATA.getID()){return VISIT_DEL_DATA;} + if(results.getLong("Type") == VISIT_DATA_DELETE.getID()){return VISIT_DATA_DELETE;} // 白名单上的玩家是否超时 - if(Util.isWhitelistedTimeout(results.getLong("TIME"))){return NOT;} + if(Util.isWhitelistedTimeout(results.getLong("TIME"))){return EXPIRED;} // 更新UUID/名称和最后加入时间 PreparedStatement update = connection.prepareStatement("UPDATE `player` SET `UUID` = ?, `NAME` = ?, `TIME` = ? WHERE `ID` = ?;"); diff --git a/src/main/java/aplini/ipacwhitelist/util/wlType.java b/src/main/java/aplini/ipacwhitelist/util/wlType.java index 77d5c2a..4d6616e 100644 --- a/src/main/java/aplini/ipacwhitelist/util/wlType.java +++ b/src/main/java/aplini/ipacwhitelist/util/wlType.java @@ -7,7 +7,7 @@ public enum wlType { // 数据表 Type -> ID DEFAULT(0), // 默认, 正常的账户 VISIT(1), // 参观账户 - VISIT_DEL_DATA(2), // 已删除数据的参观账户 + VISIT_DATA_DELETE(2), // 已删除数据的参观账户 // 数据表 White NOT_WHITE(0), // 不在白名单中 @@ -16,6 +16,7 @@ public enum wlType { // 表示 NOT(0), // 不存在的 + EXPIRED(0), // 白名单过期 ERROR(-5), // 出错 ;