@Override public void setTabCompleter(MCPlugin plugin) { if(cmd instanceof PluginCommand) { ((PluginCommand) cmd).setTabCompleter(((BukkitMCPlugin) plugin).getHandle()); } }
/** * Links the plugin's custom command tab completer and command executor. */ private void initialiseCommands() { logger.info("Setting up command executor and custom tab completers..."); PluginCommand pluginCommand = Bukkit.getPluginCommand("aach"); pluginCommand.setTabCompleter(commandTabCompleter); pluginCommand.setExecutor(pluginCommandExecutor); }
private void registerCommand(String commandName, CommandExecutor executioner) { PluginCommand command = getCommand(commandName); command.setExecutor(executioner); if (executioner instanceof TabCompleter) { command.setTabCompleter((TabCompleter) executioner); } }
@Override public void registerCommand(CommandSpec command) { PluginCommand cmd = getCommand(command.getAliases().get(0)); if (cmd != null) { PEXBukkitCommand bukkitCommand = new PEXBukkitCommand(command, PermissionsExPlugin.this); cmd.setExecutor(bukkitCommand); cmd.setTabCompleter(bukkitCommand); } }
public static BaseMainCommand createCommandExecutor(String command, BaseMainCommand baseMainCommand) { Preconditions.checkArgument(Bukkit.getPluginCommand(command) != null, "PluginCommand \"" + command + "\" not found"); Preconditions.checkArgument(baseMainCommand != null, "Executor cannot be null"); Preconditions.checkArgument(baseMainCommand.getClass() != BaseMainCommand.class, "Executor can not be \"BaseMainCommand.class\""); baseMainCommand.setRegisterCommand(Bukkit.getPluginCommand(command)); baseMainCommand.getRegisterCommand().setExecutor(baseMainCommand); baseMainCommand.getRegisterCommand().setTabCompleter(baseMainCommand); baseMainCommand.getLinkClasses().add(baseMainCommand.getClass()); baseMainCommand.disguisedPlugin(); loadCommandRegister(baseMainCommand); return baseMainCommand; }
protected void register(JavaPlugin plugin, String command) { plugin.getCommand(command).setExecutor(this); plugin.getCommand(command).setTabCompleter(this); }
PluginCommand pluginCommand = constructor.newInstance(command, plugin); pluginCommand.setExecutor(commandExecutor); pluginCommand.setTabCompleter(tabCompleter); ReflectionUtils.setValue(pluginCommand, pluginCommand.getClass().getSuperclass(), true, "description", description); ReflectionUtils.setValue(pluginCommand, pluginCommand.getClass().getSuperclass(), true, "usageMessage", usage);
/** * Registers a CommandExecutor with the server * * @param plugin the plugin instance * @param command the command instance * @param aliases the command aliases * @param <T> the command executor class type * @return the command executor */ @Nonnull public static <T extends CommandExecutor> T registerCommand(@Nonnull Plugin plugin, @Nonnull T command, @Nonnull String... aliases) { Preconditions.checkArgument(aliases.length != 0, "No aliases"); for (String alias : aliases) { try { PluginCommand cmd = COMMAND_CONSTRUCTOR.newInstance(alias, plugin); getCommandMap().register(plugin.getDescription().getName(), cmd); getKnownCommandMap().put(plugin.getDescription().getName().toLowerCase() + ":" + alias.toLowerCase(), cmd); getKnownCommandMap().put(alias.toLowerCase(), cmd); cmd.setLabel(alias.toLowerCase()); cmd.setExecutor(command); if (command instanceof TabCompleter) { cmd.setTabCompleter((TabCompleter) command); } } catch (Exception e) { e.printStackTrace(); } } return command; }
/** * Registers a CommandExecutor with the server * * @param plugin the plugin instance * @param command the command instance * @param aliases the command aliases * @param <T> the command executor class type * @return the command executor */ @Nonnull public static <T extends CommandExecutor> T registerCommand(@Nonnull Plugin plugin, @Nonnull T command, @Nonnull String... aliases) { Preconditions.checkArgument(aliases.length != 0, "No aliases"); for (String alias : aliases) { try { PluginCommand cmd = COMMAND_CONSTRUCTOR.newInstance(alias, plugin); getCommandMap().register(plugin.getDescription().getName(), cmd); getKnownCommandMap().put(plugin.getDescription().getName().toLowerCase() + ":" + alias.toLowerCase(), cmd); getKnownCommandMap().put(alias.toLowerCase(), cmd); cmd.setLabel(alias.toLowerCase()); cmd.setExecutor(command); if (command instanceof TabCompleter) { cmd.setTabCompleter((TabCompleter) command); } } catch (Exception e) { e.printStackTrace(); } } return command; }
@Override public void onEnable() { // Check for updates if it's enabled in the config if (getConfig().get("update-checker").equals(true)) UpdateChecker.checkForUpdates(getDescription().getVersion()); // Set up the tab completer for the /lukkit command this.getCommand("lukkit").setTabCompleter(new TabCompleter()); // Subtract one to count for Lukkit being loaded. Should replace with check internally because other plugins will be registered int totalPlugins = (this.pluginLoader == null) ? 0 : this.pluginLoader.loadedPlugins.size(); if (totalPlugins > 0) { this.getLogger().info(((totalPlugins != 1) ? totalPlugins + " Lukkit plugins were loaded" : "1 Lukkit plugin was loaded") + " in " + loadTime + "ms."); } else { this.getLogger().info("No Lukkit plugins were loaded."); } }
private PluginCommand createPluginCommand() { plugin.debug("Creating plugin command"); try { Constructor<PluginCommand> c = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class); c.setAccessible(true); PluginCommand cmd = c.newInstance(name, plugin); cmd.setDescription("Manage players' shops or this plugin."); cmd.setUsage("/" + name); cmd.setExecutor(new ShopBaseCommandExecutor()); cmd.setTabCompleter(new ShopBaseTabCompleter()); return cmd; } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { plugin.getLogger().severe("Failed to create command"); plugin.debug("Failed to create plugin command"); plugin.debug(e); } return null; }
/** * Registers a new executor and a new tab completer of the /betonquest command */ public QuestCommand() { BetonQuest.getInstance().getCommand("betonquest").setExecutor(this); BetonQuest.getInstance().getCommand("betonquest").setTabCompleter(this); }
public LangCommand() { BetonQuest.getInstance().getCommand("questlang").setExecutor(this); BetonQuest.getInstance().getCommand("questlang").setTabCompleter(this); }
@Override public void onEnable() { if (lateBind) { Via.getManager().init(); } getCommand("viaversion").setExecutor(commandHandler); getCommand("viaversion").setTabCompleter(commandHandler); // Warn them if they have anti-xray on and they aren't using spigot if (conf.isAntiXRay() && !spigot) { getLogger().info("You have anti-xray on in your config, since you're not using spigot it won't fix xray!"); } // Run queued tasks for (Runnable r : queuedTasks) { Bukkit.getScheduler().runTask(this, r); } queuedTasks.clear(); // Run async queued tasks for (Runnable r : asyncQueuedTasks) { Bukkit.getScheduler().runTaskAsynchronously(this, r); } asyncQueuedTasks.clear(); }
@Override public void onEnable() { instance = this; messageFormatter = new MessageFormatter(); this.getCommand("plugman").setExecutor(new PlugManCommandHandler()); this.getCommand("plugman").setTabCompleter(new PlugManTabCompleter()); initConfig(); }
@Override public void onDisable() { WGSupport.unload(); HandlerList.unregisterAll(plugin); getCommand("rpgitem").setExecutor(null); getCommand("rpgitem").setTabCompleter(null); this.getServer().getScheduler().cancelTasks(plugin); ItemManager.unload(); managedPlugins.forEach(Bukkit.getPluginManager()::disablePlugin); } }
getCommand("rpgitem").setTabCompleter(commandHandler); getServer().getPluginManager().registerEvents(new ServerLoadListener(), this); managedPlugins.forEach(Bukkit.getPluginManager()::enablePlugin);
plugin.getCommand("tardis").setTabCompleter(new TARDISTabComplete(plugin)); TARDISAdminCommands tardisAdminCommand = new TARDISAdminCommands(plugin); plugin.getCommand("tardisadmin").setExecutor(tardisAdminCommand); plugin.getGeneralKeeper().setTardisAdminCommand(tardisAdminCommand); plugin.getCommand("tardisadmin").setTabCompleter(new TARDISAdminTabComplete(plugin)); plugin.getCommand("tardisarea").setExecutor(new TARDISAreaCommands(plugin)); plugin.getCommand("tardisarea").setTabCompleter(new TARDISAreaTabComplete()); plugin.getCommand("tardisartron").setExecutor(new TARDISArtronStorageCommand(plugin)); plugin.getCommand("tardisartron").setTabCompleter(new TARDISArtronTabComplete()); plugin.getCommand("tardisbind").setExecutor(new TARDISBindCommands(plugin)); plugin.getCommand("tardisbind").setTabCompleter(new TARDISBindTabComplete()); plugin.getCommand("tardisbook").setExecutor(new TARDISBookCommands(plugin)); plugin.getCommand("tardisgive").setExecutor(new TARDISGiveCommand(plugin)); plugin.getCommand("tardisgive").setTabCompleter(new TARDISGiveTabComplete(plugin)); plugin.getCommand("tardisgravity").setExecutor(new TARDISGravityCommands(plugin)); plugin.getCommand("tardisgravity").setTabCompleter(new TARDISGravityTabComplete()); plugin.getCommand("tardisjunk").setExecutor(new TARDISJunkCommands(plugin)); plugin.getCommand("tardisjunk").setTabCompleter(new TARDISJunkTabComplete()); plugin.getCommand("tardisprefs").setExecutor(new TARDISPrefsCommands(plugin)); plugin.getCommand("tardisprefs").setTabCompleter(new TARDISPrefsTabComplete(plugin)); plugin.getCommand("tardisrecipe").setExecutor(new TARDISRecipeCommands(plugin)); plugin.getCommand("tardisrecipe").setTabCompleter(new TARDISRecipeTabComplete()); plugin.getCommand("tardisroom").setExecutor(new TARDISRoomCommands(plugin)); plugin.getCommand("tardisroom").setTabCompleter(new TARDISRoomTabComplete(plugin)); plugin.getCommand("tardisschematic").setExecutor(new TARDISSchematicCommand(plugin)); plugin.getCommand("tardistexture").setExecutor(new TARDISTextureCommands(plugin)); plugin.getCommand("tardistexture").setTabCompleter(new TARDISTextureTabComplete()); TARDISTravelCommands tardisTravelCommand = new TARDISTravelCommands(plugin); plugin.getCommand("tardistravel").setExecutor(tardisTravelCommand);
projectkorra.setTabCompleter(new BendingTabComplete());
getCommand(getSettingsManager().getCommandGlobal()).setExecutor(new GlobalCommandExecutor()); getCommand(getSettingsManager().getCommandClan()).setTabCompleter(new PlayerNameTabCompleter()); logger.info("[SimpleClans] Online Mode: " + hasUUID); //TODO: Is this necessary? logger.info("[SimpleClans] Modo Multithreading: " + SimpleClans.getInstance().getSettingsManager().getUseThreads());