Пример #1
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onPlayerEggThrow(final PlayerEggThrowEvent event) {
    Location l = event.getEgg().getLocation();

    if (PlotManager.isPlotWorld(l)) {
      Player p = event.getPlayer();
      boolean canbuild = PlotMe.cPerms(p, "plotme.admin.buildanywhere");
      String id = PlotManager.getPlotId(l);

      if (id.equalsIgnoreCase("")) {
        if (!canbuild) {
          p.sendMessage(PlotMe.caption("ErrCannotUseEggs"));
          event.setHatching(false);
        }
      } else {
        Plot plot = PlotManager.getPlotById(p, id);

        if (plot == null) {
          if (!canbuild) {
            p.sendMessage(PlotMe.caption("ErrCannotUseEggs"));
            event.setHatching(false);
          }
        } else if (!plot.isAllowed(p.getName())) {
          if (!canbuild) {
            p.sendMessage(PlotMe.caption("ErrCannotUseEggs"));
            event.setHatching(false);
          }
        }
      }
    }
  }
 @Override
 public void onPlayerEggThrow(final PlayerEggThrowEvent event) {
   final User user = ess.getUser(event.getPlayer());
   final ItemStack is = new ItemStack(Material.EGG, 1);
   if (user.hasUnlimited(is)) {
     user.getInventory().addItem(is);
     user.updateInventory();
   }
 }
	@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
	public void onPlayerEggThrow(final PlayerEggThrowEvent event)
	{

		final IUser user = userMap.getUser(event.getPlayer());
		final ItemStack hand = new ItemStack(Material.EGG, 1);
		if (user.getData().hasUnlimited(hand.getType()))
		{
			user.getPlayer().getInventory().addItem(hand);
			user.getPlayer().updateInventory();
		}
	}