コード例 #1
0
  @EventHandler
  void onPlayerFishEvent(PlayerFishEvent event) {
    if (event.getState() == PlayerFishEvent.State.CAUGHT_ENTITY
        || event.getState() == PlayerFishEvent.State.CAUGHT_FISH) {
      if (new Random().nextInt(100) < 10) {
        ItemStack item;

        if (new Random().nextInt(2) == 1) {
          item = new ItemStack(Material.NAME_TAG);
        } else {
          item = new ItemStack(Material.SADDLE);
        }
        event.getPlayer().getLocation().getWorld().dropItem(event.getPlayer().getLocation(), item);
      }
    }
  }
コード例 #2
0
	@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
	public void onPlayerFishEvent(final PlayerFishEvent event)
	{
		final IUser user = userMap.getUser(event.getPlayer());
		user.updateActivity(true);
	}