fix(D-01/A): adversarial review fixes — 4 logic bugs
1. NECK region explicitly blocked in interactLivingEntity() — prevents V2 collars equipping without ownership setup (latent, no JSONs yet) 2. Swap rollback safety: if re-equip fails after swap failure, drop the old bind as item entity instead of losing it silently 3. GaggingComponent: cache GagMaterial at construction time — eliminates valueOf() log spam on every chat message with misconfigured material 4. Dual-bind prevention: check both V1 isTiedUp() AND V2 region occupied in TyingInteractionHelper and PacketSelfBondage to prevent equipping V2 bind on top of V1 bind
This commit is contained in:
@@ -46,8 +46,8 @@ public final class TyingInteractionHelper {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
// Already tied — try to swap
|
||||
if (targetState.isTiedUp()) {
|
||||
// Already tied — try to swap (check both V1 state and V2 region to prevent dual-bind)
|
||||
if (targetState.isTiedUp() || V2EquipmentHelper.isRegionOccupied(target, BodyRegionV2.ARMS)) {
|
||||
if (stack.isEmpty()) return InteractionResult.PASS;
|
||||
ItemStack oldBind = V2EquipmentHelper.unequipFromRegion(target, BodyRegionV2.ARMS);
|
||||
if (!oldBind.isEmpty()) {
|
||||
@@ -59,8 +59,14 @@ public final class TyingInteractionHelper {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
// Equip failed — rollback: re-equip old bind
|
||||
V2EquipmentHelper.equipItem(target, oldBind);
|
||||
TiedUpMod.LOGGER.debug("[TyingInteraction] Swap failed, rolled back old bind on {}", target.getName().getString());
|
||||
V2EquipResult rollback = V2EquipmentHelper.equipItem(target, oldBind);
|
||||
if (!rollback.isSuccess()) {
|
||||
// Rollback also failed — drop old bind as safety net
|
||||
target.spawnAtLocation(oldBind);
|
||||
TiedUpMod.LOGGER.warn("[TyingInteraction] Swap AND rollback failed, dropped old bind for {}", target.getName().getString());
|
||||
} else {
|
||||
TiedUpMod.LOGGER.debug("[TyingInteraction] Swap failed, rolled back old bind on {}", target.getName().getString());
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user