How to allow use of pressure pads/trap doors/buttons, but not dispensers?
LadyCailinBot opened this issue ยท 13 comments
WORLDGUARD-3228 - Reported by Simon.Teague
So I've just updated to Spigot 1.8, and so WG version 6.0.0.
It looks like in this version using buttons, trap doors and pressure plates are now denied by default. How exactly do I now allow players to use pressure pads, trap doors and buttons without being able to open dispensers.
I tried setting the 'use' flag to true, but this allows use of pressure pads but not buttons - and also allows access to dispensers. Is this a bug?
Comment by PseudoKnight
I believe interactions like this switched to an OR comparison (testBuild), which causes this unintuitive behavior. So in pseudocode: IF(canBuild OR canUse OR canAccessInventories) return(allow) ELSE return(deny). Something here needs to be changed before WG6 comes out of beta, imo. It makes it far too complicated to replicate normal 5.9 behavior or even expected behavior with the new 'deny by default' paradigm.
Comment by Simon.Teague
@PseudoKnight This is actually worse than I thought. Things like clicking signs don't work either, so this breaks a lot of mini-games. Any chance of releasing a fix relatively quick?
Comment by PseudoKnight
It's not necessarily "broken", per se. One of the reasons it's denying use by default now is to support a broader range of mods that add custom blocks. Since WG can't know about all mods, it treats all blocks the same with the interact events. However, there's a block whitelist in which you can put IDs for all blocks you NEVER want to deny interactions with. The upside is that you can add signs to this (68). [edit: signs don't appear to be blocked by this, though] The downside is that if you add buttons, for example, you can never have the option to block buttons in any region in that world.
Comment by PseudoKnight
Here's a list of blocks that is a good set of defaults for a typical survival server:
event-handling:
interaction-whitelist: [64,69,77,96,107,130,143,183,184,185,186,187,193,194,195,196,197]```
Unfortunately, it doesn't work for pressure plates and tripwires, which may be an oversight. It also only works on blocks that get changed on interaction, I believe.
Comment by PseudoKnight
Actually, signs shouldn't be affected by this. Are you sure it's blocking signs? I can't replicate that behavior.
Comment by PseudoKnight
Found the list that the interaction-whitelist can apply to:
https://github.com/sk89q/WorldGuard/blob/master/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java
If it has MODIFIES_BLOCKS or MODIFIED_ON_CLICK next to it, it can be whitelisted.
Comment by PseudoKnight
This doesn't look right:
https://github.com/sk89q/WorldGuard/blob/master/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java#L359
Not sure why it's talking about right-clicking within the LEFT_CLICK_BLOCK handler. And somehow the whitelist applies to right clicking when it only checks it in the LEFT_CLICK_BLOCK handler. That confuses me. How is that even working?
Comment by Simon.Teague
@PseudoKnight That might explain the sign issue. Currently players can only left-click signs, they can't right-click them.
Comment by PseudoKnight
Well, no. As I said, I can right-click signs in my tests perfectly fine. It appears to work even with "use deny". Are you sure it's not working? Maybe your signs got changed by the 1.8 update, because it can remove brackets, which many plugins depend on.
Comment by Simon.Teague
@PseudoKnight So I just tested this thoroughly to work out what's going on.
With the following WorldGuard config:
http://pastebin.com/7kj57tHN
When given full perms, when a player right-clicks a sign; the PlayerInteractEvent is fired.
But when a player with no WorldGuard perms (isn't a Member), right-clicks a sign; the playerInteractEvent isn't fired at all. I'm just printing to the console every time the event is firing and nothing is happening when a non-member right-clicks a sign inside this 'spawnarea' region.
So that said, are you sure this isn't a WorldGuard bug? Could one of the flags on the region be causing the issue?
Comment by PseudoKnight
WorldGuard cancelling an event shouldn't suppress the Bukkit event. If it is, it wouldn't be a WG issue. It'd apply to all plugins that cancel events. Are you sure you're not ignoring cancelled events? If you're not, then it may be a Spigot bug. I know they've been patching some interact issues, but most seem to be related to duplicates.
Note that I was testing without op or wg bypass, with "use deny" in global. It was denying interactions with buttons, but sign plugins worked fine. I tested this on 1.7.10, not 1.8! So this suggests even more so that it's a Spigot 1.8 bug (or maybe breaking change). Do a clean build and see if it keeps happening. I'll update my WG6 test server to 1.8 to see what I see.