Advertisement
Adamki11s

ExampleEntityListener.Java

May 9th, 2011
5,839
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.Adamki11s.Example;
  2.  
  3. import org.bukkit.entity.Entity;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.event.entity.EntityDamageEvent;
  6. import org.bukkit.event.entity.EntityListener;
  7.  
  8. /* Example Template
  9.  * By Adamki11s
  10.  * HUGE Plugin Tutorial
  11.  */
  12.  
  13. public class ExampleEntityListener extends EntityListener {
  14.    
  15.     public static Example plugin;
  16.    
  17.     public ExampleEntityListener(Example instance) {
  18.         plugin = instance;
  19.     }
  20.  
  21.     public void onEntityDamage(EntityDamageEvent event){
  22.        
  23.         if(event.getEntity() instanceof Player){
  24.         //If the entity being damaged is a player then...
  25.  
  26.             event.setCancelled(true);
  27.         //Cancel the damage event, this will give the player unlimited health
  28.         }
  29.     }
  30.  
  31. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement