public static boolean isFakeNijiPerms(Plugin plugin) { PluginCommand permsCommand = Bukkit.getServer().getPluginCommand("permissions"); return permsCommand == null || !(permsCommand.getPlugin().equals(plugin)); }
.isAssignableFrom(((PluginCommand) command).getExecutor().getClass())) { HelpTopic t = entry.getValue().createTopic(command); if (t != null) {
public void latchOnto(PluginCommand command) { if (command != null) { command.setDescription(SkyTrans.get(TransKey.SETUP_CMD_DESCRIPTION)); command.setExecutor(base); command.setUsage("/<command>"); command.setPermission(null); } } }
private void registerCommand(String commandName, CommandExecutor executioner) { PluginCommand command = getCommand(commandName); command.setExecutor(executioner); if (executioner instanceof TabCompleter) { command.setTabCompleter((TabCompleter) executioner); } }
/** * Register a command through the framework. */ public static boolean register(JavaPlugin plugin, CommandFramework command) { PluginCommand pluginCommand = plugin.getCommand(command.label); if (pluginCommand == null) { return false; } pluginCommand.setExecutor(command); return true; }
/** * 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; }
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; }
private Command registerCommand(String name) { PluginCommand command = plugin.getCommand(name); if (command.getExecutor() != this) { command.setExecutor(this); } return command; }
getCommand("cloudserver").setExecutor(server); getCommand("cloudserver").setPermission("cloudnet.command.cloudserver"); getCommand("cloudserver").setTabCompleter(server);
private void registerCommand(String name, CommandExecutor executor, Permission permission) { PluginCommand command = getCommand(name); command.setExecutor(executor); command.setPermission(permission.toString()); commands.add(command); }
@Override public void setTabCompleter(MCPlugin plugin) { if(cmd instanceof PluginCommand) { ((PluginCommand) cmd).setTabCompleter(((BukkitMCPlugin) plugin).getHandle()); } }
if (entry.getValue() instanceof PluginCommand) { PluginCommand c = (PluginCommand) entry.getValue(); if (c.getPlugin() == plugin) { c.unregister(commandMap); it.remove();
public void latchOnto(PluginCommand command) { if (command != null) { command.setDescription(SkyTrans.get(TransKey.MAIN_CMD_DESCRIPTION)); command.setExecutor(base); command.setUsage("/<command>"); command.setPermission(null); } } }
/** * 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); }
@Override public void setExecutor(MCPlugin plugin) { if(cmd instanceof PluginCommand) { ((PluginCommand) cmd).setExecutor(((BukkitMCPlugin) plugin).getHandle()); } }
/** * 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."); } }
if (entry.getValue() instanceof PluginCommand) { PluginCommand c = (PluginCommand) entry.getValue(); if (c.getPlugin() == plugin) { c.unregister(commandMap); it.remove();
private static void registerMcscoreboardCommand() { PluginCommand command = mcMMO.p.getCommand("mcscoreboard"); command.setDescription("Change the current mcMMO scoreboard being displayed"); //TODO: Localize command.setPermission("mcmmo.commands.mcscoreboard"); command.setPermissionMessage(permissionsMessage); command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcscoreboard", "<CLEAR | KEEP>")); command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", "mcscoreboard", "time", "<seconds>")); command.setExecutor(new McscoreboardCommand()); }