a method checkDespawn will fire. override it and see yourself. this one is useful if you want to do some checks and decide whether to keep the entity or remove it.
for simple cases maybe just override isPersistenceRequired and finito.
I copied the Totem of Undying event for my coin charm, and as you can see in line 113 it has the method removeAllEffects in there, so if you're building a similar event, simply don't add the method to prevent it from removing effects.
https://github.com/toadie-odie/TodeCoins/blob/1.3.2/src/main/java/net/warrentode/todecoins/event/ModEvents.java