How to make someone invincible or cancel death message

Discussion in 'Plugin Development' started by Tezlastorme, Apr 19, 2012.

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

    Tezlastorme

    Hey for one of my plugins I need to be able to either make the player briefly invincible or cancel their death message can someone help please? Thanks in advance :)
     
  2. Offline

    ftbastler

    PHP:
        @EventHandler
        
    public void onEntityDamage(EntityDamageEvent event) {
                if (
    event.getEntity() instanceof Player) {
                    
    event.setCancelled(true);
                }
        }
     
  3. Offline

    Alectriciti

    I would try an event. ftbastler posted how to cancel a death event. Here's an example you could use in your listener class. I'm not sure, but I believe this could be used to cancel the default death message and replace it with your own.
    PHP:
    @EventHandler
        
    public void fdfd(PlayerDeathEvent event){
            
    event.setDeathMessage("It's a shame that " event.getPlayer() + " died.");
        }
     
  4. Offline

    Tezlastorme

    Ok thanks very much guys I will try these :)
     
Thread Status:
Not open for further replies.

Share This Page