congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
PluginCommand
Code IndexAdd Tabnine to your IDE (free)

How to use
PluginCommand
in
org.bukkit.command

Best Java code snippets using org.bukkit.command.PluginCommand (Showing top 20 results out of 540)

origin: EngineHub/WorldEdit

public static boolean isFakeNijiPerms(Plugin plugin) {
  PluginCommand permsCommand = Bukkit.getServer().getPluginCommand("permissions");
  return permsCommand == null || !(permsCommand.getPlugin().equals(plugin));
}
origin: GlowstoneMC/Glowstone

  .isAssignableFrom(((PluginCommand) command).getExecutor().getClass())) {
HelpTopic t = entry.getValue().createTopic(command);
if (t != null) {
origin: SkyWars/SkyWars

  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);
    }
  }
}
origin: libraryaddict/LibsDisguises

private void registerCommand(String commandName, CommandExecutor executioner) {
  PluginCommand command = getCommand(commandName);
  command.setExecutor(executioner);
  if (executioner instanceof TabCompleter) {
    command.setTabCompleter((TabCompleter) executioner);
  }
}
origin: filoghost/ChestCommands

/**
 * 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;
}
origin: lucko/helper

/**
 * 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;
}
origin: EpicEricEE/ShopChest

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;
}
origin: stackoverflow.com

 private Command registerCommand(String name) {
  PluginCommand command = plugin.getCommand(name);
  if (command.getExecutor() != this) {
    command.setExecutor(this);
  }
  return command;
}
origin: Dytanic/CloudNet

getCommand("cloudserver").setExecutor(server);
getCommand("cloudserver").setPermission("cloudnet.command.cloudserver");
getCommand("cloudserver").setTabCompleter(server);
origin: ChestShop-authors/ChestShop-3

private void registerCommand(String name, CommandExecutor executor, Permission permission) {
  PluginCommand command = getCommand(name);
  command.setExecutor(executor);
  command.setPermission(permission.toString());
  commands.add(command);
}
origin: EngineHub/CommandHelper

@Override
public void setTabCompleter(MCPlugin plugin) {
  if(cmd instanceof PluginCommand) {
    ((PluginCommand) cmd).setTabCompleter(((BukkitMCPlugin) plugin).getHandle());
  }
}
origin: Bkm016/TabooLib

if (entry.getValue() instanceof PluginCommand) {
  PluginCommand c = (PluginCommand) entry.getValue();
  if (c.getPlugin() == plugin) {
    c.unregister(commandMap);
    it.remove();
origin: Bkm016/TabooLib

TabooLib.debug("Registered " + (methods.size() + fields.size()) + " sub-command with " + baseMainCommand.getRegisterCommand().getName() + " (" + baseMainCommand.getRegisterCommand().getPlugin().getName() + ")");
origin: SkyWars/SkyWars

  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);
    }
  }
}
origin: PyvesB/AdvancedAchievements

/**
 * 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);
}
origin: EngineHub/CommandHelper

@Override
public void setExecutor(MCPlugin plugin) {
  if(cmd instanceof PluginCommand) {
    ((PluginCommand) cmd).setExecutor(((BukkitMCPlugin) plugin).getHandle());
  }
}
origin: me.lucko/helper

/**
 * 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;
}
origin: artex-development/Lukkit

@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.");
  }
}
origin: r-clancy/PlugMan

if (entry.getValue() instanceof PluginCommand) {
  PluginCommand c = (PluginCommand) entry.getValue();
  if (c.getPlugin() == plugin) {
    c.unregister(commandMap);
    it.remove();
origin: mcMMO-Dev/mcMMO

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());
}
org.bukkit.commandPluginCommand

Javadoc

Represents a Command belonging to a plugin

Most used methods

  • setExecutor
  • setTabCompleter
  • getPlugin
    Gets the owner of this PluginCommand
  • getExecutor
  • getName
  • setDescription
  • setPermission
  • setUsage
  • setAliases
  • <init>
  • setPermissionMessage
  • getAliases
  • setPermissionMessage,
  • getAliases,
  • testPermission,
  • unregister,
  • getTabCompleter,
  • getUsage,
  • setLabel

Popular in Java

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now