yapzhenyie / GadgetsMenu

Feature-rich cosmetics plugin that provide players with the most powerful features.
http://bit.ly/GadgetsMenu
66 stars 24 forks source link

PlayerGrappleEvent is unable to be cancelled. #917

Closed ks-hl closed 2 years ago

ks-hl commented 2 years ago

Describe the bug Using the API to try to cancel PlayerGrappleEvent, the plugin will not listen to the cancellation state.

Expected behavior Cancelling PlayerGrappleEvent causes the action to not occur.

To fix this, change line 64 of GadgetGrapplingHook: @EventHandler(priority = EventPriority.HIGHEST) to @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)

This will cause the method to never be executed if the event is already cancelled, allowing other plugins to cancel it.

yapzhenyie commented 2 years ago

May I know why you want to use PlayerGrappleEvent? This is not an open API though.

ks-hl commented 2 years ago

You are calling events through the Spigot API, that inherently makes the execution of that event an API. If you don't want people listening to it, why call an event?

I'm trying to make it so players can't use the grappling hook to hover by spam clicking. The 1 second cooldown is too long and no cooldown is too fast.

yapzhenyie commented 2 years ago

Let me consider for it. Btw, currently I don't have free time to update the plugin. It will be postpone until 20 May.

yapzhenyie commented 2 years ago

The changes has been made in the latest update.