Example #1
0
  public void onEntityDamage(EntityDamageEvent event) {
    Entity entity = event.getEntity();
    if (!(entity instanceof Player)) {
      return;
    }

    Player player = (Player) entity;
    if (!plugin.checkAuth(player)) {
      event.setCancelled(true);
    }
  }
Example #2
0
  public void onEntityTarget(EntityTargetEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Player) {
      return;
    }

    Entity target = event.getTarget();
    if (!(target instanceof Player)) {
      return;
    }
    Player targetPlayer = (Player) target;

    if (!plugin.checkAuth(targetPlayer)) {
      event.setCancelled(true);
    }
  }