WorldGuard

WorldGuard

8M Downloads

WG issue -- blacklist.txt on-interact black list restriction stops anvil removal.

LadyCailinBot opened this issue ยท 10 comments

commented

WORLDGUARD-3360 - Reported by Kainzo

[12:51:08 INFO]: WorldGuard version 6.0.0-SNAPSHOT.1575-

#Anvil2
[anvil]
ignore-groups=founder,admin
ignore-perms=wg.anvil2
message=Restricted completely!
on-interact=deny,tell

#Anvil
[145]
ignore-groups=founder,admin
ignore-perms=wg.anvil
message=Restricted to ArtisanSmith
on-place=deny,tell

commented

Comment by wizjany

Um, what exactly is the issue?

commented

Comment by Kainzo

Issue is:
If we restrict "on-interact" this makes it so the player cannot remove the anvil. This could be an enhancement, but in previous versions of Worldguard, only the "on-break" prevented the removal of the block.

commented

Comment by wizjany

[14:14:36 INFO]: [WorldGuard] INTERACT ANVIL [CraftPlayer{name=wizjany}] @ :PlayerInteractEvent [DENY] [14:14:36 INFO]: [WorldGuard] USE DIAMOND_PICKAXE [CraftPlayer{name=wizjany}] @world :PlayerInteractEvent [14:14:37 INFO]: [WorldGuard] DIG ANVIL [CraftPlayer{name=wizjany}] @207,64,297 :BlockBreakEvent

So it seems the issue is that the server/someone is sending interact events on left click, we might need to workaround this somehow.
edit: ok so blacklist events aren't aware of pre-allowed events...

commented

Comment by shroomdog27

Is this being looked at? I'm having the exact same issue, and it would be really nice if it was fixed.

commented

Comment by PseudoKnight

I'm not an expert on WorldGuard's internals, but should this line:

https://github.com/sk89q/WorldGuard/blob/master/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java#L332

if (Events.fireAndTestCancel(new UseBlockEvent(event, cause, clicked).setAllowed(!modifiesWorld))) {

instead be:

if (modifiesWorld && Events.fireAndTestCancel(new UseBlockEvent(event, cause, clicked))) {

Since I'm fairly certain we only really want to fire a UseBlockEvent if left-clicking modifies the block. So it should only fire for DRAGON_EGG, which is the only block in Materials that is modified on left click. (though the DRAGON_EGG might be better as a BreakBlockEvent, come to think of it)

commented

Comment by wizjany

that is indeed the line, but unfortunately that's not the solution.

commented

Comment by ZachBail

I'm here for this as well. The "on-break" event seems to be set to "on-break=deny" for everything on the blacklist. I have also not been able to add anything to the on-break event like tell or notify. I think this would be a significant fix for WorldGuard.

commented

Comment by lifehome

Hi, I think this issue needs a big push, as it has been 4 years and on 1.13.2, this problem still exists.

However, my problem would be when the following settings are in blacklist, neither the players can place or break the anvil. Even I have explicit setting other flags to allow the action, it still doesn't allow placing or breaking anvils.

My config in blacklist.txt:

[anvil,chipped_anvil,damaged_anvil]
ignore-perms=toughlife.player.level.advanced
on-interact=deny,tell
message=You do not have the Scroll of Advanced Magic to use anvil.
commented

Comment by lifehome

Give another push, I think this should be a small fix.

commented

We run into the same issue, we try to prevent players from opening enderchests with

[ender_chest]
on-break=allow
on-interact=deny

But the players are not allowed to destroy the blocks, becuase it is also an interaction