Beispiel #1
0
	@Override
	public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
	{
		ess.getPlugin().callSuicideEvent(user.getPlayer());
		user.getPlayer().damage(Short.MAX_VALUE);
		user.sendMessage(_("suicideMessage"));
		user.setDisplayNick();
		ess.broadcastMessage(user,_("suicideSuccess", user.getPlayer().getDisplayName()));		
	}
Beispiel #2
0
	@Override
	public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
	{
		if (args.length < 1)
		{
			throw new NotEnoughArgumentsException();
		}
		user.setDisplayNick();
		final String message = _("helpOp", user.getDisplayName(), Util.stripFormat(getFinalArg(args, 0)));
		logger.log(Level.INFO, message);
		for (Player onlinePlayer : server.getOnlinePlayers())
		{
			final IUser player = ess.getUser(onlinePlayer);
			if (!Permissions.HELPOP_RECEIVE.isAuthorized(player))
			{
				continue;
			}
			player.sendMessage(message);
		}
	}
	@EventHandler(priority = EventPriority.LOWEST)
	public void onPlayerChat(final AsyncPlayerChatEvent event) // TODO: Does this update work?
	{
		final IUser user = userMap.getUser(event.getPlayer());
		if (user.getData().isMuted())
		{
			event.setCancelled(true);
			user.sendMessage(_("§6You have been muted!"));
			ess.getLogger().info(_("{0} tried to speak, but is muted.", user.getName()));
		}
		final Iterator<Player> it = event.getRecipients().iterator();
		while (it.hasNext())
		{
			final IUser u = userMap.getUser(it.next());
			if (u.getData().getIgnore().contains(user.getName()))
			{
				it.remove();
			}
		}
		user.updateActivity(true);
		user.setDisplayNick();
	}
	public void delayedJoin(final Player player)
	{
		if (!player.isOnline())
		{
			return;
		}
		ess.getBackup().startTask();
		final IUser user = userMap.getUser(player);
		user.setDisplayNick();
		user.updateCompass();
		user.getData().setTimestamp(TimestampType.LOGIN, System.currentTimeMillis());
		user.updateActivity(false);

		if (!ess.getVanishedPlayers().isEmpty() && !Permissions.VANISH_SEE_OTHERS.isAuthorized(user))
		{
			for (String p : ess.getVanishedPlayers())
			{
				final Player toVanish = userMap.getUser(p).getPlayer();
				if (toVanish.isOnline())
				{
					user.setVanished(true);
				}
			}
		}

		if (Permissions.SLEEPINGIGNORED.isAuthorized(user))
		{
			ess.getPlugin().scheduleSyncDelayedTask(
					new Runnable()
					{
						@Override
						public void run()
						{
							user.getPlayer().setSleepingIgnored(true);
						}
					});
		}

		final Commands settings = ess.getSettings().getData().getCommands();

		if (!settings.isDisabled("motd") && Permissions.MOTD.isAuthorized(user))
		{
			try
			{
				final IText input = new TextInput(user, "motd", true, ess);
				final IText output = new KeywordReplacer(input, user, ess);
				final TextPager pager = new TextPager(output, true);
				pager.showPage("1", null, "motd", user);
			}
			catch (IOException ex)
			{
				if (ess.getSettings().isDebug())
				{
					ess.getLogger().log(Level.WARNING, ex.getMessage(), ex);
				}
				else
				{
					ess.getLogger().log(Level.WARNING, ex.getMessage());
				}
			}
		}

		if (!settings.isDisabled("mail") && Permissions.MAIL.isAuthorized(user))
		{
			final List<String> mail = user.getMails();
			if (mail.isEmpty())
			{
				final String msg = _("§6You have no new mail.");
				if (!msg.isEmpty())
				{
					user.sendMessage(msg);
				}
			}
			else
			{
				user.sendMessage(_("§6You have§c {0} §6messages! Type §c/mail read§6 to view your mail.", mail.size()));
			}
		}
		if (Permissions.FLY_SAFELOGIN.isAuthorized(user))
		{
			final Location loc = user.getPlayer().getLocation();
			final World world = loc.getWorld();
			final int x = loc.getBlockX();
			int y = loc.getBlockY();
			final int z = loc.getBlockZ();
			while (LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1)
			{
				y--;
			}

			if (loc.getBlockY() - y > 1 || y < 0)
			{
				user.getPlayer().setAllowFlight(true);
				user.getPlayer().setFlying(true);
				user.sendMessage(_("§6Set fly mode§c {0} §6for {1}§6.", _("enabled"), user.getPlayer().getDisplayName()));
			}
		}
	}