Example #1
0
  @EventHandler(priority = EventPriority.NORMAL)
  public void fishing(PlayerFishEvent event) {
    Player player = event.getPlayer();
    ItemStack itemStack = player.getItemInHand();
    Material material = itemStack.getType();
    Location location = player.getLocation();
    Location bobber = event.getHook().getLocation();

    if (location.getWorld().getName().equals(getName())) {

      if (material == Material.FISHING_ROD) {

        if (event.getHook().getVelocity().getY() < 0.02 && isLocationNearBlock(bobber)) {
          player.launchProjectile(Snowball.class);
        }
      }
    }
  }
  @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
  public void onPlayerFish(PlayerFishEvent event) {
    Player player = event.getPlayer();

    String ability = EntityTools.getBendingAbility(player);

    if (Bloodbending.isBloodbended(player) || Concussion.getTarget(player) != null) {
      event.setCancelled(true);
      return;
    }

    RegisteredAbility register = AbilityManager.getManager().getRegisteredAbility(ability);

    if (MetalBending.NAME.equals(ability) && EntityTools.canBend(player, register)) {
      MetalWire.pull(player, event.getHook());
    }
  }