I am trying to apply a potion effect to a player before I teleport them and it is not working with any type of potion effect. Any help would be great. Thanks in advance. Here is my code. Code: @EventHandler public void respawn(PlayerRespawnEvent event){ final Player player = event.getPlayer(); player.sendMessage(ChatColor.RED+"Hades has summoned you to the underworld!"); player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1)); World nether = Bukkit.getWorld(ExtendedDeath.nether); final Location loc = nether.getSpawnLocation(); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { publicvoid run() { player.teleport(loc); } }, (long)(20*5)); //5 seconds } The player just never gets a potion effect applied to them and I'm not sure why... I have applied potion effects to players in my other plugins and this just does not seem to work.
if you want to write your own plugin for this, i wouldn't be much help but currently there's a plugin that applies currently existing and hidden potion effects to players via command
2 things First did you make sure that you registered the event listener? Second Bukkit fires events 1 tick before they actually happen so what you might actually be doing is adding the potion effect the tick before the player respawns. Try scheduling a delayed event for 1 tick around everything