TownyFlight icon indicating copy to clipboard operation
TownyFlight copied to clipboard

Add PlayerFlightChangeEvent

Open KermX opened this issue 10 months ago • 6 comments

Adds a new event that triggers whenever a player toggles flight

KermX avatar Mar 06 '25 05:03 KermX

The only other thing that might made sense is to make the event implement CancellableTownyEvent, so that it could be used by other plugins to stop flight in areas they don't want players flying.

LlmDl avatar Mar 06 '25 15:03 LlmDl

Would you like a new lang string for when the event is cancelled? Or just an early return in addFlight and removeFlight?

KermX avatar Mar 06 '25 19:03 KermX

If it's just early return then that should be good I think, otherwise I will revisit later.

KermX avatar Mar 06 '25 19:03 KermX

Since TownyFlight itself never cancels the event wouldn't it make sense to let the plugin cancelling the event handle messaging?

KermX avatar Mar 09 '25 04:03 KermX

Since TownyFlight itself never cancels the event wouldn't it make sense to let the plugin cancelling the event handle messaging?

That doesn't really make sense to me, the plugin cancelling it wouldn't know what the value of silent is and we've already got a getter/setter for the cancel message on the CancellableTownyEvent class

Warriorrrr avatar Mar 27 '25 07:03 Warriorrrr

I forgot I'd done the silent flag a while ago and was waiting on response to the pr before pushing. I think I understand what preferred solution is now. With this implementation plugins cancelling the event can use setCancelMessage, however, they cannot modify if it should be silent or not. Let me know if I got that right, thanks!

KermX avatar Mar 27 '25 08:03 KermX