コード例 #1
0
 @Override
 public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) {
   final User user = ess.getUser(event.getPlayer());
   if (user.hasUnlimited(new ItemStack(event.getBucket()))) {
     event.getItemStack().setType(event.getBucket());
     ess.scheduleSyncDelayedTask(
         new Runnable() {
           public void run() {
             user.updateInventory();
           }
         });
   }
 }
コード例 #2
0
	public void onPlayerJoin(final PlayerJoinEvent event)
	{
		if (event.getPlayer().hasPlayedBefore())
		{
			LOGGER.log(Level.FINE, "Old player join");
			return;
		}

		final User user = ess.getUser(event.getPlayer());

		if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
		{
			ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
		}

		if (ess.getSettings().getAnnounceNewPlayers())
		{
			final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess);
			final SimpleTextPager pager = new SimpleTextPager(output);
			ess.broadcastMessage(user, pager.getString(0));
		}

		final String kitName = ess.getSettings().getNewPlayerKit();
		if (!kitName.isEmpty())
		{
			try
			{
				final Map<String, Object> kit = ess.getSettings().getKit(kitName.toLowerCase(Locale.ENGLISH));
				final List<String> items = Kit.getItems(user, kit);
				Kit.expandItems(ess, user, items);
			}
			catch (Exception ex)
			{
				LOGGER.log(Level.WARNING, ex.getMessage());
			}
		}

		LOGGER.log(Level.FINE, "New player join");
	}