public final void addPlugin(final Plugin plugin)
	{
		if (plugin.getDescription().getMain().contains("com.earth2me.essentials"))
		{
			return;
		}
		final List<Command> commands = PluginCommandYamlParser.parse(plugin);
		final String pluginName = plugin.getDescription().getName().toLowerCase(Locale.ENGLISH);

		for (Command command : commands)
		{
			final PluginCommand pc = (PluginCommand)command;
			final List<String> labels = new ArrayList<String>(pc.getAliases());
			labels.add(pc.getName());

			PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase(Locale.ENGLISH));
			if (reg == null)
			{
				reg = ess.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH));
			}
			if (reg == null || !reg.getPlugin().equals(plugin))
			{
				continue;
			}
			for (String label : labels)
			{
				List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase(Locale.ENGLISH));
				if (plugincommands == null)
				{
					plugincommands = new ArrayList<PluginCommand>();
					altcommands.put(label.toLowerCase(Locale.ENGLISH), plugincommands);
				}
				boolean found = false;
				for (PluginCommand pc2 : plugincommands)
				{
					if (pc2.getPlugin().equals(plugin))
					{
						found = true;
					}
				}
				if (!found)
				{
					plugincommands.add(reg);
				}
			}
		}
	}
	public EssentialsCommandHandler(ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentialsModule module, IEssentials ess)
	{
		this.classLoader = classLoader;
		this.commandPath = commandPath;
		this.permissionPrefix = permissionPrefix;
		this.module = module;
		this.ess = ess;
		for (Plugin plugin : ess.getServer().getPluginManager().getPlugins())
		{
			if (plugin.isEnabled())
			{
				addPlugin(plugin);
			}
		}
	}
 @Override
 public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
   if (event.isCancelled()) {
     return;
   }
   final User user = ess.getUser(event.getPlayer());
   final String cmd =
       event.getMessage().toLowerCase().split(" ")[0].replace("/", "").toLowerCase();
   final List<String> commands =
       Arrays.asList(
           "msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email");
   if (commands.contains(cmd)) {
     for (Player player : ess.getServer().getOnlinePlayers()) {
       User spyer = ess.getUser(player);
       if (spyer.isSocialSpyEnabled() && !user.equals(spyer)) {
         player.sendMessage(user.getDisplayName() + " : " + event.getMessage());
       }
     }
   }
   if (!cmd.equalsIgnoreCase("afk")) {
     user.updateActivity(true);
   }
 }
Пример #4
0
 public OfflinePlayer(final String name, final IEssentials ess) {
   this.ess = ess;
   this.world = ess.getServer().getWorlds().get(0);
   this.base = ess.getServer().getOfflinePlayer(name);
 }
Пример #5
0
 public Server getServer() {
   return ess == null ? null : ess.getServer();
 }
 public EssentialsPlayerListener(final IEssentials parent) {
   this.ess = parent;
   this.server = parent.getServer();
 }