Solved Need help killing with an "explosion"

Discussion in 'Plugin Development' started by bunny365, Sep 6, 2013.

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

    bunny365

    How would I make my plugin kill a player saying they were blown up without any real explosion? This doesn't want to work:
    Code:java
    1. EntityDamageEvent cause = new EntityDamageEvent(null, DamageCause.BLOCK_EXPLOSION, 0.0F);
    2. user.setLastDamageCause(cause);
    3. user.setHealth(0.0F);
    Code:
    >explode dynamine
    22:28:07 [INFO] [Explode] Exploding dynamine
    22:28:07 [INFO] dynamine died
     
  2. Offline

    OcelotcR

    You can go ahead and play the effect, rather than actually using the cause. This causes the explosion effect but wont effect the surrounding blocks.
     
  3. Offline

    The_Doctor_123

    Something along these lines should work:

    Code:
        @EventHandler
        public void onPlayerDeath(PlayerDeathEvent event)
        {
            if (event.getEntity().equals(player))
            {
                event.setDeathMessage("Whatever the death message is for an explosion.. Oh, and " + event.getEntity().getName() + " died!");
            }
        }
    
     
  4. Offline

    bunny365

    I'm trying to make it say:
    Code:
    dynamine blew up
    Instead of:
    Code:
    dynamine died
    I'm trying to not use Listeners in my plugin. Bukkit SHOULD have a way to alter the reason for the death.
     
  5. Offline

    OcelotcR

    Yes, that alter way is using setDeathMessage.
     
  6. Offline

    The_Doctor_123

    But it doesn't... There's nothing wrong with Listeners, just use it if you want this feature in your plugin.
     
Thread Status:
Not open for further replies.

Share This Page