Esempio n. 1
0
 @EventHandler
 public void onEntityTarget(EntityTargetEvent event) {
   if (event.getTarget() instanceof Player) {
     Player p = (Player) event.getTarget();
     if (um.isSpectator(p.getName())) event.setCancelled(true);
   }
 }
Esempio n. 2
0
 @EventHandler
 public void onFoodLevelChange(FoodLevelChangeEvent event) {
   if (event.getEntity() instanceof Player) {
     Player p = (Player) event.getEntity();
     if (um.isSpectator(p.getName())) event.setCancelled(true);
   }
 }
Esempio n. 3
0
  @SuppressWarnings("deprecation")
  @EventHandler
  public void onEntityDamage(EntityDamageByEntityEvent event) {
    Player damager = null;
    if (event.getDamager() instanceof Player) {
      damager = (Player) event.getDamager();
    } else if (event.getDamager() instanceof Projectile) {
      Projectile pro = (Projectile) event.getDamager();
      if (pro.getShooter() instanceof Player) {
        damager = (Player) pro.getShooter();
      }
    }

    if (damager != null) {
      if (um.isSpectator(damager.getName())) event.setCancelled(true);
    }
  }
Esempio n. 4
0
 @EventHandler
 public void onExpChangeEvent(PlayerExpChangeEvent event) {
   if (um.isSpectator(event.getPlayer().getName())) event.setAmount(0);
 }
Esempio n. 5
0
 @EventHandler
 public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
   if (um.isSpectator(event.getPlayer().getName())) event.setCancelled(true);
 }
Esempio n. 6
0
 @EventHandler
 public void onItemDrop(PlayerDropItemEvent event) {
   if (um.isSpectator(event.getPlayer().getName())) event.setCancelled(true);
 }
Esempio n. 7
0
 @EventHandler
 public void onBlockPlace(BlockPlaceEvent event) {
   if (um.isSpectator(event.getPlayer().getName())) event.setCancelled(true);
 }