So I'm trying to make a impossibleX difficulty which is inspired by Fundy and I'm trying to make it so that when a player respawns he feels weak as shown below, but the thing is that it won't set their health to half and add the slowness/weakness/mining fatigue after he respawns, but it does send the message "You feel weak after respawning..."
May I have some help?
public static void nahwouldyounotrespawn(PlayerRespawnEvent e){
Player player = e.getPlayer();
player.sendMessage("You feel weak after respawning...");
player.setHealth(10);
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30000, 5));
player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 30000, 5));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 30000, 255));
}