No reason to keep calling potionEvent.getEffect() here. Store potionEvent.getEffect() in a local variable, then use that in the MobEffect constructor.