修复: 验证码GUI关闭逻辑 + Inner Class NoClassDefFoundError + 重复注册问题 + deploy脚本增强

This commit is contained in:
2026-07-04 21:46:03 +08:00
parent c9e740d4c9
commit b1ea407f3f
4 changed files with 27 additions and 4 deletions
+1 -1
View File
@@ -608,7 +608,7 @@ public class AreaCLIManager {
} }
} }
private static class PermItem { static class PermItem {
String key; String key;
String name; String name;
boolean enabled; boolean enabled;
+1 -1
View File
@@ -668,7 +668,7 @@ public class AreaGUIManager implements Listener {
/** /**
* 权限条目内部类 * 权限条目内部类
*/ */
private static class PermEntry { static class PermEntry {
String name; String name;
boolean enabled; boolean enabled;
@@ -64,7 +64,7 @@ public class ChatFilterManager {
/** 验证码数据存储(public供Main.java访问清理) */ /** 验证码数据存储(public供Main.java访问清理) */
public final Map<String, VerificationData> verificationData = new ConcurrentHashMap<>(); public final Map<String, VerificationData> verificationData = new ConcurrentHashMap<>();
// ★ 验证码类型对外公开 /** 验证码类型对外公开 */
public enum VerificationType { public enum VerificationType {
MATH, // 数学题 MATH, // 数学题
GUI // GUI物品选择 GUI // GUI物品选择
+24 -1
View File
@@ -3172,6 +3172,29 @@ public class Main extends JavaPlugin
} }
// ===== Inventory Close - 验证码GUI关闭处理 =====
@EventHandler
public void onInvClose(InventoryCloseEvent e) {
if (!(e.getPlayer() instanceof Player))
return;
Player p = (Player) e.getPlayer();
String title = e.getView().getTitle();
// ★ 验证码GUI关闭 → 清除验证码状态,下次消息重新触发验证码
if (title != null && title.contains("点击") && title.contains("完成验证")) {
if (chatFilter != null && chatFilter.isEnabled()) {
// 移除验证码数据
chatFilter.verificationData.remove(p.getName());
// 清除缓存的消息(关闭GUI时丢弃)
String cached = chatFilter.pendingMessages.remove(p.getName());
if (cached != null) {
// 消息已丢弃,下次发消息会重新触发验证码
}
// 不加入verifiedPlayers,玩家需要重新通过验证
}
}
}
// ===== Inventory Click(旧逻辑 + 新主菜单布局 + 新功能) ===== // ===== Inventory Click(旧逻辑 + 新主菜单布局 + 新功能) =====
@EventHandler @EventHandler
public void onInvClick(InventoryClickEvent e) { public void onInvClick(InventoryClickEvent e) {
@@ -3200,7 +3223,7 @@ public class Main extends JavaPlugin
} else { } else {
p.closeInventory(); p.closeInventory();
chatFilter.pendingMessages.remove(p.getName()); chatFilter.pendingMessages.remove(p.getName());
p.sendMessage("§c§l[验证码] §c点击错误,消息已被拦截"); p.sendMessage("§c§l[验证码] §c点击错误,请重新选择");
chatFilter.generateMathVerification(p.getName()); chatFilter.generateMathVerification(p.getName());
} }
} }