mc-ascendancy / AscendNations

GNU Affero General Public License v3.0
0 stars 0 forks source link

Cancel diamond hoe left click event when in claimed land #50

Closed mervinvb closed 3 years ago

mervinvb commented 3 years ago

Currently, I am developing a way for users to easily get rid of certain blocks by using a diamond hoe. To do this, the blocks get removed before a BlockBreak event occurs, this bypasses the claimed land.

My DenizenScript code is as follows:

after player left clicks pink_wool with:diamond_hoe bukkit_priority:HIGHEST:
        - if <context.location.biome.name> == sunflower_plains:
            - wait 0.1
            - modifyblock <context.location> air naturally
            - inventory adjust durability:<player.item_in_hand.durability.add[1]> slot:<player.held_item_slot>

Using the HIGHEST priority setting makes sure the DenizenScript processing gets handled last, so you can cancel the event before that.

VolticFroogo commented 3 years ago

Okay, so you would specifically like me to cancel the PlayerInteractEvent from left clicks with a diamond hoe?