CivClassic / 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 Paper 1.16.5
BSD 3-Clause "New" or "Revised" License
1 stars 21 forks source link

Fence gates can be opened by anyone via redstone #24

Closed Maxopoly closed 4 years ago

Maxopoly commented 4 years ago

Apparently their BlockData is not Openable? Investivate what it is instead and adjust redstone listeners accordingly

Protonull commented 4 years ago

After looking into this, Fence Gates are indeed Openable and Powerable.

What seems to be the problem is that BlockRedstoneEvent is seemingly not called under any circumstances for Fence Gates, so its redstone current cannot be cancelled if it's reinforced and not opened by someone with permissions.

When a pressure plate is next to a door, a BlockRedstoneEvent is called for the door, but not for the block underneath the pressure plate despite that block also receiving power, so there seems to be some logic going on to reduce the amount of events being emitted. Trap doors seem to work fine. I even tested putting the trap door right above the pressure plate and crawling over it. It receives a BlockRedstoneEvent as expected and is handled properly by Citadel.

There's just something about Fence Gates that exclude it from this logic.

Protonull commented 4 years ago

Looks like someone on PaperMC already figured out the problem here and here. It seems to be fixed on both accounts but evidently hasn't been back ported, so the only way for us to fix this is to either update to 1.15, use our own version of Paper, or change the way Citadel handles redstone.

After talking to someone on the PaperMC Discord, it appears that Mojang will be making some internal changes to redstone for 1.16, changes that are completely unknown so even if we fix this, we might need to refix it later.

Maxopoly commented 4 years ago

Let's just leave this the way it is then and revisit it once we are on 1.16 (likely Paper will just fix it for us and we can close it by then)

Maxopoly commented 4 years ago

Confirmed resolved in 1.16, see https://github.com/CivClassic/Citadel/issues/51 though (which has been around before I think)