DevotedMC / Citadel

A Minecraft plugin to protect your chests and builds using in-game materials. Requires an attacker to break each block a certain number of times. Built for Spigot 1.14.4
https://www.devotedmc.com/citadel.html
BSD 3-Clause "New" or "Revised" License
2 stars 20 forks source link

Fix offhand reinforced inventories bypass #55

Closed iNko97 closed 6 years ago

iNko97 commented 6 years ago

Fix offhand reinforced inventories bypass

ProgrammerDan commented 6 years ago

I'm assuming you did this already but just realized I didn't ask, this introduces no new regression? All positive states work as expected? (e.g. locked but permitted chest while holding x,y,z can be opened OK)?

iNko97 commented 6 years ago

I will test this right away, I would guess everything works fine as at least some of my players would have complained already. Moreover, we are just introducing an additional check when player interacts with inventory (using offhand):

Enemy chest:

Unobfuscated, click with food: a. Nothing in offhand: Blocked b. Block in offhand: Blocked c. Food in offhand: Blocked

Unobfuscated, click with non consumable: a. Nothing in offhand: Blocked b. Block in offhand: Blocked c. Food in offhand: Blocked

Unobfuscated, click with empty hand: a. Nothing in offhand: Blocked b. Block in offhand: Blocked c. Food in offhand: Blocked

Obfuscated, click with food: a. Nothing in offhand: Blocked b. Block in offhand: Blocked c. Food in offhand: Blocked

Obfuscated, click with non consumable: a. Nothing in offhand: Blocked b. Block in offhand: Blocked c. Food in offhand: Blocked

Obfuscated, click with empty hand: a. Nothing in offhand: Blocked b. Block in offhand: Blocked c. Food in offhand: Blocked

Neutral chest:

Unobfuscated, click with food: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Unobfuscated, click with non consumable: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Unobfuscated, click with empty hand: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Obfuscated, click with food: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Obfuscated, click with non consumable: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Obfuscated, click with empty hand: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Allied chest:

Unobfuscated, click with food: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Unobfuscated, click with non consumable: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Unobfuscated, click with empty hand: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Obfuscated, click with food: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Obfuscated, click with non consumable: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Obfuscated, click with empty hand: a. Nothing in offhand: Allowed b. Block in offhand: Allowed c. Food in offhand: Allowed

Additional tests since some events fire naturally double events: Shift-opening chest: Enemy chest: Blocked Allied chest: Client eats the food Neutral chest: Client eats the cookie

ProgrammerDan commented 6 years ago

Excellent! I'll merge this shortly, adding in v. increment and such.

ProgrammerDan commented 6 years ago

Got busy over the weekend, on my docket for today.