org.bukkit.event.world.WorldEvent Java Examples
The following examples show how to use
org.bukkit.event.world.WorldEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CauseFilter.java From CardinalPGM with MIT License | 4 votes |
private Boolean evaluate(Event event) { if (!(event instanceof EntityDamageEvent)) { switch (cause) { case WORLD: return event instanceof WorldEvent; case LIVING: return event instanceof EntityEvent && ((EntityEvent) event).getEntity() instanceof LivingEntity; case MOB: return event instanceof EntityEvent && ((EntityEvent) event).getEntity() instanceof Creature; case PLAYER: return event instanceof PlayerEvent || event instanceof BlockPlaceEvent || event instanceof BlockBreakEvent; case PUNCH: return event instanceof PlayerInteractEvent && ((PlayerInteractEvent) event).getAction().equals(Action.LEFT_CLICK_BLOCK); case TRAMPLE: return event instanceof PlayerMoveEvent; case MINE: return event instanceof BlockBreakEvent; case EXPLOSION: return event instanceof EntityExplodeEvent; } } else { EntityDamageEvent.DamageCause damageCause = ((EntityDamageEvent) event).getCause(); switch (cause) { case MELEE: return damageCause.equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK); case PROJECTILE: return damageCause.equals(EntityDamageEvent.DamageCause.PROJECTILE); case POTION: return damageCause.equals(EntityDamageEvent.DamageCause.MAGIC) || damageCause.equals(EntityDamageEvent.DamageCause.POISON) || damageCause.equals(EntityDamageEvent.DamageCause.WITHER) || damageCause.equals(EntityDamageEvent.DamageCause.DRAGON_BREATH); case EXPLOSION: return damageCause.equals(EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) || damageCause.equals(EntityDamageEvent.DamageCause.ENTITY_EXPLOSION); case COMBUSTION: return damageCause.equals(EntityDamageEvent.DamageCause.FIRE) || damageCause.equals(EntityDamageEvent.DamageCause.FIRE_TICK) || damageCause.equals(EntityDamageEvent.DamageCause.MELTING) || damageCause.equals(EntityDamageEvent.DamageCause.LAVA) || damageCause.equals(EntityDamageEvent.DamageCause.HOT_FLOOR); case FALL: return damageCause.equals(EntityDamageEvent.DamageCause.FALL); case GRAVITY: return damageCause.equals(EntityDamageEvent.DamageCause.FALL) || damageCause.equals(EntityDamageEvent.DamageCause.VOID); case VOID: return damageCause.equals(EntityDamageEvent.DamageCause.VOID); case SQUASH: return damageCause.equals(EntityDamageEvent.DamageCause.FALLING_BLOCK); case SUFFOCATION: return damageCause.equals(EntityDamageEvent.DamageCause.SUFFOCATION); case DROWNING: return damageCause.equals(EntityDamageEvent.DamageCause.DROWNING); case STARVATION: return damageCause.equals(EntityDamageEvent.DamageCause.STARVATION); case LIGHTNING: return damageCause.equals(EntityDamageEvent.DamageCause.LIGHTNING); case CACTUS: return damageCause.equals(EntityDamageEvent.DamageCause.CONTACT); case THORNS: return damageCause.equals(EntityDamageEvent.DamageCause.THORNS); } } return null; }