my code works but after the effect ends the player can still fly, how can i remove this from it, i have some ideas but they all looks ugly AF, like checking for the effect in player.tick. Is there way to trigger something after the effect has ended?
e.create('flight')
.displayName("§9Flight")
// Set a tick event to apply the action
.effectTick((entity, lvl) => global.flying(entity, lvl))
.color(Color.BLUE)
.beneficial()
/**
*
* @param {Internal.LivingEntity} entity
*/
global.flying = (entity, lvl) => {
if(!entity.isPlayer()) return
if(!entity.level.isClientSide()){
entity.resetFallDistance()
}else{
Client.player.abilities.mayfly = true
}
}```





