Esempio n. 1
0
	@Override
	public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
	{
		if (args.length < 1)
		{
			throw new NotEnoughArgumentsException();
		}
		ess.broadcastMessage(null, _("broadcast", FormatUtil.replaceFormat(getFinalArg(args, 0))));
	}
	@EventHandler(priority = EventPriority.MONITOR)
	public void onPlayerQuit(final PlayerQuitEvent event)
	{
		final String quitMessage = ess.getSettings().getData().getGeneral().getLeaveMessage();
		if (quitMessage != null)
		{
			final IText itOutput = new KeywordReplacer(new SimpleTextInput(quitMessage), userMap.getUser(event.getPlayer()), ess);
			final SimpleTextPager stPager = new SimpleTextPager(itOutput);
			event.setQuitMessage(FormatUtil.replaceFormat(stPager.getString(0)));
		}
		else
		{
			event.setQuitMessage(null);
		}


		final IUser user = userMap.getUser(event.getPlayer());

		final ISettings settings = ess.getSettings();
		if (settings.getData().getCommands().getGod().isRemoveOnDisconnect() && user.isGodModeEnabled())
		{
			user.setGodModeEnabled(false);
		}
		if (user.isVanished())
		{
			user.toggleVanished();
		}
		if (user.getData().getInventory() != null)
		{
			user.getPlayer().getInventory().setContents(user.getData().getInventory().getBukkitInventory());
			user.getData().setInventory(null);
		}
		user.updateActivity(false);
		//user.getPlayer().dispose();
		if (settings.getData().getGeneral().isPtClearOnQuit())
		{
			user.getData().clearAllPowertools();
			user.queueSave();
			user.sendMessage(_("§6All powertool commands have been cleared."));
		}
	}