playEffect Dosnt work upon death.

Discussion in 'Plugin Development' started by JooshYT, Mar 5, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    JooshYT

    Hi, so i try the playEffect but its not working.
    Code:
         //Player on death
         @EventHandler
         public void death(PlayerDeathEvent e) {
             Player dead = e.getEntity().getPlayer(); //get the guy who was killed
             Player killer = e.getEntity().getKiller(); //Get killer
             e.getDrops().clear(); //Clear drops
             dead.getWorld().playEffect(dead.getLocation(), Effect.EXPLOSION, 10);
             dead.playSound(dead.getLocation(), Sound.BLAZE_DEATH, 30, 30);
             killer.playSound(dead.getLocation(), Sound.BLAZE_DEATH, 30, 30);
             if(e.getDeathMessage().contains("fell from")){
                 e.setDeathMessage(ChatColor.RED + dead.getName() + ChatColor.GOLD + " hit the ground too hard.");
             }else if(e.getDeathMessage().contains("shot by")){
                 e.setDeathMessage(ChatColor.RED + dead.getName() + ChatColor.GOLD + " was shot by " + ChatColor.RED + killer.getName() + ChatColor.GOLD + ".");
             }else if(e.getDeathMessage().contains("drowned")){
                 e.setDeathMessage(ChatColor.RED + dead.getName() + ChatColor.GOLD + " drowned.");
             }else if(e.getDeathMessage().contains("slain by")){
                 e.setDeathMessage(ChatColor.RED + dead.getName() + ChatColor.GOLD + " has been slain by " + ChatColor.RED + killer.getName() + ChatColor.GOLD + ".");
             }
         }
    The playSound works just not the playEffect
     
  2. Offline

    pie_flavor

    @JooshYT Effect is a particle effect. Sound is a sound. You can't see particles while dead.
     
  3. Offline

    JooshYT

    No i use my 2nd accoll my own pl and i ll clnt see them thenunt to kill myself and i still cant see them
     
  4. @JooshYT Please use proper grammar. Otherwise we can't understand what you're trying to say. Anyway, on to your problem, when a player dies, it will only play particle effect where they spawn (correct me if wrong), it'd be much easier if you just shot a firework where they died, kind of like what Mineplex does.
     
  5. Offline

    JooshYT

    entomb player death event I have it to play effect at their death location. But it dosnt work
     
Thread Status:
Not open for further replies.

Share This Page