Пример #1
0
  @EventHandler(priority = EventPriority.HIGH)
  public void liquidEmpty(PlayerBucketEmptyEvent event) {
    OwnedLand land = OwnedLand.getApplicableLand(event.getBlockClicked().getLocation());
    if (land == null) {
      return;
    }

    Player p = event.getPlayer();

    if (!land.hasPermTo(p, this)) {
      p.sendMessage(
          ChatColor.RED + getPlugin().getMessageConfig().getString("event.build.bucketEmpty"));
      event.setCancelled(true);
    }
  }
	@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
	public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
	{

		final IUser user = userMap.getUser(event.getPlayer());
		if (user.getData().hasUnlimited(event.getBucket()))
		{
			event.getItemStack().setType(event.getBucket());
			ess.getPlugin().scheduleSyncDelayedTask(
					new Runnable()
					{
						@Override
						public void run()
						{
							user.getPlayer().updateInventory();
						}
					});
		}
	}