JimiIT92 / UniverseGuard2

An easy to use world protection plugin for Sponge
https://ore.spongepowered.org/Francesco_Jimi/Universe-Guard
GNU General Public License v3.0
19 stars 3 forks source link

Glitch for players without permission to break blocks. #183

Open eVisper opened 3 years ago

eVisper commented 3 years ago

If there is a two-high wall and the player starts breaking the top block while jumping and running into the wall, then the player will be able to break the block.

https://user-images.githubusercontent.com/50687787/115646981-f199f800-a2d7-11eb-982d-3c2d8d4ecf95.mp4

CDFN commented 3 years ago

I picked up some debugging, here are results:

When bug occurs, that's how dump of event looks: Break{cancelled=false, cause=Cause[Context=Context[], Stack={EntityPlayerMP['CDFN'/100, l='world', x=227.55, y=63.00, z=-120.54]}], context=Context[], source=EntityPlayerMP['CDFN'/100, l='world', x=227.55, y=63.00, z=-120.54], transactions=[Transaction{original=SpongeBlockSnapshot{worldUniqueId=50ead76e-06ea-4d2c-a87f-05bb1b3c4141, position=(227, 62, -121), blockState=minecraft:dirt[snowy=false,variant=dirt], extendedState=minecraft:dirt[snowy=false,variant=dirt]}, default=SpongeBlockSnapshot{worldUniqueId=50ead76e-06ea-4d2c-a87f-05bb1b3c4141, position=(227, 62, -121), blockState=minecraft:air, extendedState=minecraft:air}, custom=null, valid=true}]} When event is being blocked, that's how dump of event looks: Break{cancelled=false, cause=Cause[Context=Context["sponge:spawn_type"=SpongeSpawnType{id=sponge:dropped_item, name=DroppedItem}, "sponge:owner"=EntityPlayerMP['CDFN'/104, l='world', x=227.41, y=62.00, z=-120.70], "sponge:used_hand"=MAIN_HAND, "sponge:block_hit"=SpongeBlockSnapshot{worldUniqueId=50ead76e-06ea-4d2c-a87f-05bb1b3c4141, position=(228, 62, -121), blockState=minecraft:dirt[snowy=false,variant=dirt], extendedState=minecraft:dirt[snowy=false,variant=dirt]}, "sponge:notifier"=EntityPlayerMP['CDFN'/104, l='world', x=227.41, y=62.00, z=-120.70], "sponge:used_item"=SpongeItemStackSnapshot{itemType=minecraft:dirt, quantity=18}], Stack={EntityPlayerMP['CDFN'/104, l='world', x=227.41, y=62.00, z=-120.70], com.google.common.util.concurrent.ListenableFutureTask@3161b038}], context=Context["sponge:spawn_type"=SpongeSpawnType{id=sponge:dropped_item, name=DroppedItem}, "sponge:owner"=EntityPlayerMP['CDFN'/104, l='world', x=227.41, y=62.00, z=-120.70], "sponge:used_hand"=MAIN_HAND, "sponge:block_hit"=SpongeBlockSnapshot{worldUniqueId=50ead76e-06ea-4d2c-a87f-05bb1b3c4141, position=(228, 62, -121), blockState=minecraft:dirt[snowy=false,variant=dirt], extendedState=minecraft:dirt[snowy=false,variant=dirt]}, "sponge:notifier"=EntityPlayerMP['CDFN'/104, l='world', x=227.41, y=62.00, z=-120.70], "sponge:used_item"=SpongeItemStackSnapshot{itemType=minecraft:dirt, quantity=18}], source=EntityPlayerMP['CDFN'/104, l='world', x=227.41, y=62.00, z=-120.70], transactions=[Transaction{original=SpongeBlockSnapshot{worldUniqueId=50ead76e-06ea-4d2c-a87f-05bb1b3c4141, position=(228, 62, -121), blockState=minecraft:dirt[snowy=false,variant=dirt], extendedState=minecraft:dirt[snowy=false,variant=dirt]}, default=SpongeBlockSnapshot{worldUniqueId=50ead76e-06ea-4d2c-a87f-05bb1b3c4141, position=(228, 62, -121), blockState=minecraft:air, extendedState=minecraft:air}, custom=null, valid=true}]}

if condition in following line doesn't let code go through, because we're missing sponge:spawn_type tag. https://github.com/JimiIT92/UniverseGuard2/blob/021debea6d6f97514e0821ecb216bd0adb8a76a7/src/main/java/com/universeguard/event/flags/FlagDestroyListener.java#L142

I'm wondering if it's something we can fix or it's problem on Sponge's end.