コード例 #1
0
	@Override
	public void onDisable()
	{
		if (ess != null)
		{
			ess.onDisable();
		}
	}
コード例 #2
0
	@Override
	public void onEnable()
	{

		final PluginManager pm = this.getServer().getPluginManager();
		//pm.registerEvents(getServer(), this);
		ess = new Essentials(getServer(), getLogger(), this);
		if (VersionCheck.checkVersion(this))
		{
			try
			{
				ess.onEnable();
			}
			catch (RuntimeException ex)
			{
				if (pm.getPlugin("EssentialsUpdate") == null)
				{
					getLogger().log(Level.SEVERE, _("The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat"));
				}
				else
				{
					getLogger().log(Level.SEVERE, _("The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat"));
				}
				getLogger().log(Level.SEVERE, ex.toString());
				pm.registerEvents(
						new Listener()
						{
							@EventHandler(priority = EventPriority.LOW)
							public void onPlayerJoin(final PlayerJoinEvent event)
							{
								event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
							}
						}, this);
				for (Player player : getServer().getOnlinePlayers())
				{
					player.sendMessage("Essentials failed to load, read the log file.");
				}
				this.setEnabled(false);
				return;
			}
		}
		else
		{
			this.setEnabled(false);
			return;
		}

		final EssentialsPluginListener serverListener = new EssentialsPluginListener(ess);
		pm.registerEvents(serverListener, this);
		ess.addReloadListener(serverListener);

		final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(ess);
		pm.registerEvents(playerListener, this);

		final EssentialsBlockListener blockListener = new EssentialsBlockListener(ess);
		pm.registerEvents(blockListener, this);

		final EssentialsEntityListener entityListener = new EssentialsEntityListener(ess);
		pm.registerEvents(entityListener, this);


		final MetricsStarter metricsStarter = new MetricsStarter(ess);
		if (metricsStarter.getStart() != null)
		{
			if (metricsStarter.getStart())
			{
				getServer().getScheduler().runTaskLaterAsynchronously(this, metricsStarter, 1);
			}
			else
			{
				final MetricsListener metricsListener = new MetricsListener(ess, metricsStarter);
				pm.registerEvents(metricsListener, this);
			}
		}
	}
コード例 #3
0
	@Override
	public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args)
	{
		return ess.getCommandHandler().onTabComplete(sender, command, alias, args);
	}
コード例 #4
0
	@Override
	public boolean onCommand(final org.bukkit.command.CommandSender sender, final Command command, final String label, final String[] args)
	{
		return ess.getCommandHandler().onCommand(sender, command, label, args);
	}