- 旧逻辑 OFF 时 selShield 默认硬编码 true 仍发盾(超冷兜不住「发了」), 改为 OFF 时 shield=false 不发盾 + 副手清空;使用闸硬拦。 - selShield/equipFullSet/reEquipAdjustments/onPVPShieldUse 四处盾模式 统一取房主键 customModeOwner(旧逻辑取 customCfg.get(name) 非房主键, 房主配置取不到 → 误判 OFF 漏拦/漏发)。 Co-Authored-By: WorkBuddy <noreply@workbuddy.cn>
This commit is contained in:
co-authored by
WorkBuddy
parent
811d836ec3
commit
d088dc1151
@@ -1888,7 +1888,10 @@ public class PVPArenaManager implements Listener {
|
||||
if (lore == null || !lore.contains(PVP_ITEM_MARKER)) continue;
|
||||
|
||||
// 仅当本局盾牌模式=OFF 才拦(FREE/ON 交还原版)
|
||||
PVPCustomModeManager.CustomConfig useCfg = customCfg.get(player.getName());
|
||||
// ★ 第121批续4:盾模式取房主键(customModeOwner),非房主键 customCfg.get(name)
|
||||
// 取不到房主配置会误判 OFF → 漏拦。
|
||||
PVPCustomModeManager.CustomConfig useCfg =
|
||||
(customModeOwner != null) ? customCfg.get(customModeOwner) : customCfg.get(player.getName());
|
||||
PVPCustomModeManager.ShieldMode useMode =
|
||||
(useCfg != null) ? useCfg.shieldMode : PVPCustomModeManager.ShieldMode.OFF;
|
||||
if (useMode != PVPCustomModeManager.ShieldMode.OFF) return;
|
||||
@@ -2622,20 +2625,20 @@ public class PVPArenaManager implements Listener {
|
||||
lockedEnchant = false;
|
||||
}
|
||||
// 为所有玩家初始化默认值(强制模式下材质/附魔默认跟随锁定值,非强制模式自由)
|
||||
if (!selWeaponTier.containsKey(name)) selWeaponTier.put(name, lockedWeaponTier != null ? lockedWeaponTier : 0);
|
||||
if (!selArmorTier.containsKey(name)) selArmorTier.put(name, lockedArmorTier != null ? lockedArmorTier : 0);
|
||||
if (!selEnchant.containsKey(name)) selEnchant.put(name, lockedEnchant != null ? lockedEnchant : false);
|
||||
if (!selShield.containsKey(name)) selShield.put(name, true);
|
||||
if (!selFood.containsKey(name)) selFood.put(name, FOOD_DEFAULT);
|
||||
if (!selRangedWeapon.containsKey(name)) selRangedWeapon.put(name, 0); // 0=弓(默认)
|
||||
|
||||
// ★ 第121批:强制装备=开 → 武器材质/护甲材质/附魔 锁死(GUI 灰显不可点不可改);
|
||||
// 强制=关 → 不锁定,全员自由选。弓/弩/熟食 以及 盾牌(FREE 中间值)仍可自由切换。
|
||||
// 盾牌三态(取本局房主配置):OFF=全员禁盾(超冷+拦使用) / FREE=中间值玩家自选 / ON=强制开盾
|
||||
// ★ 第121批续4:盾模式判定提前到 selShield 默认初始化前——OFF 时默认不选盾(false),
|
||||
// 避免旧逻辑 selShield 默认硬编码 true 导致「盾关了还发盾」。
|
||||
PVPCustomModeManager.CustomConfig shieldCfg =
|
||||
(customModeOwner != null) ? customCfg.get(customModeOwner) : openCfg;
|
||||
PVPCustomModeManager.ShieldMode shieldMode =
|
||||
(shieldCfg != null) ? shieldCfg.shieldMode : PVPCustomModeManager.ShieldMode.OFF;
|
||||
|
||||
if (!selWeaponTier.containsKey(name)) selWeaponTier.put(name, lockedWeaponTier != null ? lockedWeaponTier : 0);
|
||||
if (!selArmorTier.containsKey(name)) selArmorTier.put(name, lockedArmorTier != null ? lockedArmorTier : 0);
|
||||
if (!selEnchant.containsKey(name)) selEnchant.put(name, lockedEnchant != null ? lockedEnchant : false);
|
||||
if (!selShield.containsKey(name)) selShield.put(name, shieldMode != PVPCustomModeManager.ShieldMode.OFF);
|
||||
if (!selFood.containsKey(name)) selFood.put(name, FOOD_DEFAULT);
|
||||
if (!selRangedWeapon.containsKey(name)) selRangedWeapon.put(name, 0); // 0=弓(默认)
|
||||
|
||||
boolean shieldLocked = (shieldMode == PVPCustomModeManager.ShieldMode.ON)
|
||||
|| (shieldMode == PVPCustomModeManager.ShieldMode.OFF);
|
||||
// ★ 第121批续2:锁定判定 = 非房主 && lock已固化 && 强制开。
|
||||
@@ -3317,13 +3320,14 @@ public class PVPArenaManager implements Listener {
|
||||
}
|
||||
int wTier = selWeaponTier.getOrDefault(name, 0);
|
||||
int aTier = selArmorTier.getOrDefault(name, 0);
|
||||
// ★ 盾牌默认值:自定义模式"盾牌模式"为 ON 时默认发盾,OFF/FREE 时默认不发(玩家仍可在调整GUI开启)
|
||||
// 第121批:字段 shieldOn 已迁到 shieldMode 三态,用 isShieldOn() 等价读取
|
||||
boolean shield = selShield.getOrDefault(name,
|
||||
(cfg != null) ? cfg.isShieldOn() : true);
|
||||
// 本局盾牌模式(取房主配置):OFF=全员禁盾(超冷) / FREE=中间值 / ON=强制开盾
|
||||
// ★ 第121批续4:盾模式统一取房主键(customModeOwner),非房主键 customCfg.get(name)
|
||||
// 取不到房主配置会导致 OFF 误判成默认 true → 盾关了还发盾。
|
||||
PVPCustomModeManager.CustomConfig shieldCfg =
|
||||
(customModeOwner != null) ? customCfg.get(customModeOwner) : cfg;
|
||||
PVPCustomModeManager.ShieldMode shieldMode =
|
||||
(cfg != null) ? cfg.shieldMode : PVPCustomModeManager.ShieldMode.OFF;
|
||||
(shieldCfg != null) ? shieldCfg.shieldMode : PVPCustomModeManager.ShieldMode.OFF;
|
||||
// 盾默认值:ON 强制发 / FREE 玩家自定(默认发) / OFF 不发(超冷+使用闸拦)
|
||||
boolean shield = selShield.getOrDefault(name, shieldMode != PVPCustomModeManager.ShieldMode.OFF);
|
||||
int food = selFood.getOrDefault(name, FOOD_DEFAULT);
|
||||
int rw = selRangedWeapon.getOrDefault(name, 0); // 0弓 1弩
|
||||
|
||||
@@ -3348,8 +3352,8 @@ public class PVPArenaManager implements Listener {
|
||||
}
|
||||
player.getInventory().setArmorContents(armorPieces);
|
||||
|
||||
// 盾牌(可选,副手)
|
||||
if (shield) {
|
||||
// 盾牌(副手)— 第121批续4:OFF 全员禁盾不发(使用闸硬拦);ON/FREE 才发
|
||||
if (shield && shieldMode != PVPCustomModeManager.ShieldMode.OFF) {
|
||||
ItemStack sh = new ItemStack(Material.SHIELD);
|
||||
ItemMeta m = sh.getItemMeta();
|
||||
if (m != null) {
|
||||
@@ -3357,13 +3361,10 @@ public class PVPArenaManager implements Listener {
|
||||
m.setLore(Arrays.asList("§7格挡近战攻击", PVP_ITEM_MARKER));
|
||||
sh.setItemMeta(m);
|
||||
}
|
||||
// ★ 第121批:盾牌模式=OFF 时全员禁盾——发一把带超长冷却的盾牌,
|
||||
// 效果等同被斧头破盾冷却(拿出即进入冷却,不可使用);
|
||||
// 管理员帮忙从面板发盾也照拦(使用闸按 PVP 标记识别)。
|
||||
if (shieldMode == PVPCustomModeManager.ShieldMode.OFF) {
|
||||
applyShieldUseCooldown(sh, SHIELD_OFF_COOLDOWN_SECONDS);
|
||||
}
|
||||
player.getInventory().setItemInOffHand(sh);
|
||||
} else if (shieldMode == PVPCustomModeManager.ShieldMode.OFF) {
|
||||
// OFF:副手清空不发盾,杜绝任何来源的盾
|
||||
player.getInventory().setItemInOffHand(null);
|
||||
}
|
||||
|
||||
// 远程武器(默认装备):弓/弩二选一,默认弓,统一发放对应弹药(箭)
|
||||
@@ -3441,16 +3442,17 @@ public class PVPArenaManager implements Listener {
|
||||
|
||||
removePVPAdjustables(player);
|
||||
|
||||
boolean shield = selShield.getOrDefault(name, true);
|
||||
// 第121批续4:盾模式取房主键(customModeOwner),OFF 不发盾(清空副手),ON/FREE 才发
|
||||
PVPCustomModeManager.CustomConfig adjShieldCfg =
|
||||
(customModeOwner != null) ? customCfg.get(customModeOwner) : customCfg.get(name);
|
||||
PVPCustomModeManager.ShieldMode adjMode =
|
||||
(adjShieldCfg != null) ? adjShieldCfg.shieldMode : PVPCustomModeManager.ShieldMode.OFF;
|
||||
boolean shield = selShield.getOrDefault(name, adjMode != PVPCustomModeManager.ShieldMode.OFF);
|
||||
int food = selFood.getOrDefault(name, FOOD_DEFAULT);
|
||||
int rw = selRangedWeapon.getOrDefault(name, 0);
|
||||
// 本局盾牌模式(取房主配置):OFF=全员禁盾(超冷) / FREE=中间值 / ON=强制开盾
|
||||
PVPCustomModeManager.CustomConfig adjCfg = customCfg.get(name);
|
||||
PVPCustomModeManager.ShieldMode adjMode =
|
||||
(adjCfg != null) ? adjCfg.shieldMode : PVPCustomModeManager.ShieldMode.OFF;
|
||||
|
||||
// 盾牌(副手)
|
||||
if (shield) {
|
||||
if (shield && adjMode != PVPCustomModeManager.ShieldMode.OFF) {
|
||||
ItemStack sh = new ItemStack(Material.SHIELD);
|
||||
ItemMeta sm = sh.getItemMeta();
|
||||
if (sm != null) {
|
||||
@@ -3458,11 +3460,9 @@ public class PVPArenaManager implements Listener {
|
||||
sm.setLore(Arrays.asList("§7格挡近战攻击", PVP_ITEM_MARKER));
|
||||
sh.setItemMeta(sm);
|
||||
}
|
||||
// ★ 第121批:盾牌模式=OFF 时全员禁盾——超长冷却等同破盾冷却
|
||||
if (adjMode == PVPCustomModeManager.ShieldMode.OFF) {
|
||||
applyShieldUseCooldown(sh, SHIELD_OFF_COOLDOWN_SECONDS);
|
||||
}
|
||||
player.getInventory().setItemInOffHand(sh);
|
||||
} else if (adjMode == PVPCustomModeManager.ShieldMode.OFF) {
|
||||
player.getInventory().setItemInOffHand(null);
|
||||
}
|
||||
|
||||
// 远程武器 + 箭矢
|
||||
|
||||
Reference in New Issue
Block a user