第57批续21-fix: 修子领地创建不落库+确认创建按钮显隐
Check Source / check (push) Successful in 3s
Auto Release / build (push) Successful in 2m22s
Simple Test / test (push) Successful in 1s
Test Env / test (push) Successful in 2s

修1(问题2根因): saveAreaToDb INSERT VALUES 占位符76->77。续21加parent_id列(第77列)
但VALUES漏加第77个?,JDBC setInt(77,..)越界→SQLException被catch吞掉→DB未写入
→但代码继续areas.put+提示成功→loadAllAreas清空内存重读DB→子领地消失→传送/cli菜单找不到。
补全77个占位符后DB正常写入,loadAllAreas后子领地保留,传送/cli菜单可见。

修2(问题1): 圈地棒选区智能识别按钮显隐——身份不合格或部分重叠时不展示确认创建按钮。
canCreateSub标志:身份不合格→false,部分重叠→false,合格→true;false时隐藏一键创建链接,
提示'因身份或范围限制,已隐藏确认创建按钮'。confirm_create命令层闸门不变(双保险)。
This commit is contained in:
youpaishidifu
2026-10-27 17:40:11 +08:00
parent 7b8aa4e194
commit 74db3d022b
+8 -1
View File
@@ -5994,6 +5994,7 @@ public class AreaProtection implements Listener {
BondManager bnd = plugin.getBonds();
int bal = (bnd != null) ? bnd.getBonds(p.getName()) : 0;
p.sendMessage("§e§l[防护] §f选区完成!面积: §a" + a + "㎡§7(" + w + "×" + l + ") 单价: §f" + pricePerSqm + "/㎡" + src + " 预估: §e" + totalCost + "§7债券 余额: §a" + bal);
boolean canCreateSub = true; // ★ 续21修1: 身份不合格/部分重叠时不展示确认创建按钮
// ★ 第57批续21 圈地棒选区后智能识别:若落在已有领地内,提示需具备该领地管理身份才能建子领地
{
int sx1 = Math.min(lp1.getBlockX(), newLoc.getBlockX());
@@ -6004,6 +6005,7 @@ public class AreaProtection implements Listener {
if (selMain != null) {
p.sendMessage("§d§l[智能识别] §f选区位于领地 §e" + selMain.name + " §f内 → 创建成功则为【子领地】,需你具备该领地领主/管理员身份");
if (!isQualifiedLandManager(p, selMain)) {
canCreateSub = false;
p.sendMessage("§c 你当前不具备 §e" + selMain.name + " §f的管理身份,确认创建将被拒绝");
}
} else {
@@ -6013,12 +6015,14 @@ public class AreaProtection implements Listener {
int so1x = Math.min(sot.x1, sot.x2), so2x = Math.max(sot.x1, sot.x2);
int so1z = Math.min(sot.z1, sot.z2), so2z = Math.max(sot.z1, sot.z2);
if (sx1 <= so2x && sx2 >= so1x && sz1 <= so2z && sz2 >= so1z) {
canCreateSub = false;
p.sendMessage("§c§l[智能识别] §f选区与领地 §e" + sot.name + " §f部分重叠(跨边界),子领地必须完整位于某主领地内");
break;
}
}
}
}
if (canCreateSub) {
// ★ 一键创建超链接:自动用玩家名,冲突则加数字(重名不区分大小写)
String autoName = p.getName();
if (areaNameExists(autoName)) {
@@ -6034,6 +6038,9 @@ public class AreaProtection implements Listener {
.clickEvent(ClickEvent.runCommand("/protect confirm_create " + finalAutoName))
);
p.sendMessage(Component.text("§7或输入 §f/protect 创建 <自定义名> §7指定领地名"));
} else {
p.sendMessage("§c§l[防护] §f因身份或范围限制,已隐藏确认创建按钮");
}
}
}
}
@@ -10971,7 +10978,7 @@ public class AreaProtection implements Listener {
+ "deny_thrown_projectiles, deny_glowing, deny_redstone_interaction, deny_door_interaction, "
+ "deny_noteblock_jukebox, deny_lead, deny_crop_harvest, deny_wool_shear, deny_animal_feeding, "
+ "warp_x, warp_y, warp_z, warp_yaw, warp_pitch, warp_world, deny_container, deny_mob_attack, deny_sign_edit, is_public_building, allow_visitor_teleport, deny_farmland_trample, deny_ender_teleport, create_cost, deny_spawn_egg, deny_wax, bad_effects, deny_villager_trade, confiscate_count, return_on_leave, parent_id) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+ "ON CONFLICT(name) DO UPDATE SET "
+ "owner=excluded.owner, world=excluded.world, x1=excluded.x1, z1=excluded.z1, x2=excluded.x2, z2=excluded.z2, y_min=excluded.y_min, y_max=excluded.y_max, "
+ "confiscate_items=excluded.confiscate_items, deny_use_items=excluded.deny_use_items, give_effects=excluded.give_effects, clear_effects=excluded.clear_effects, clear_all_bad=excluded.clear_all_bad, "