Codota Logo
Command
Code IndexAdd Codota to your IDE (free)

How to use
Command
in
net.md_5.bungee.api.plugin

Best Java code snippets using net.md_5.bungee.api.plugin.Command (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: SpigotMC/BungeeCord

if ( !command.hasPermission( sender ) )
      } );
    command.execute( sender, args );
  } else if ( commandLine.contains( " " ) && command instanceof TabExecutor )
origin: SpigotMC/BungeeCord

/**
 * Register a command so that it may be executed.
 *
 * @param plugin the plugin owning this command
 * @param command the command to register
 */
public void registerCommand(Plugin plugin, Command command)
{
  commandMap.put( command.getName().toLowerCase( Locale.ROOT ), command );
  for ( String alias : command.getAliases() )
  {
    commandMap.put( alias.toLowerCase( Locale.ROOT ), command );
  }
  commandsByPlugin.put( plugin, command );
}
origin: CodeCrafter47/BungeeTabListPlus

@Override
public void execute(CommandSender sender, String[] args) {
  if (args.length > 0 && subCommands.containsKey(args[0])) {
    Command command = subCommands.get(args[0]);
    if (command.getPermission() == null || checkPermission(sender, command)) {
      command.execute(sender, Arrays.copyOfRange(args, 1, args.length));
    } else {
      sender.sendMessage(TextComponent.fromLegacyText(ProxyServer.getInstance().getTranslation("no_permission")));
    }
  } else if (defaultAction != null) {
    defaultAction.accept(sender);
  } else {
    sender.sendMessage(ChatUtil.parseBBCode("&cWrong usage!"));
  }
}
origin: CodeCrafter47/BungeeTabListPlus

@Override
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
  if (args.length == 1) {
    return subCommands.keySet().stream()
        .filter(cmd -> cmd.startsWith(args[0]))
        .collect(Collectors.toList());
  } else if (args.length > 1) {
    Command command = subCommands.get(args[0]);
    if (command != null && command instanceof TabExecutor) {
      if (command.getPermission() == null || checkPermission(sender, command)) {
        ((TabExecutor) command).onTabComplete(sender, Arrays.copyOfRange(args, 1, args.length));
      }
    }
  }
  return Collections.emptyList();
}
origin: SpigotMC/BungeeCord

@Override
public void handle(Commands commands) throws Exception
{
  boolean modified = false;
  if ( BungeeCord.getInstance().config.isInjectCommands() )
  {
    for ( Map.Entry<String, Command> command : bungee.getPluginManager().getCommands() )
    {
      if ( !bungee.getDisabledCommands().contains( command.getKey() ) && commands.getRoot().getChild( command.getKey() ) == null && command.getValue().hasPermission( con ) )
      {
        LiteralCommandNode dummy = LiteralArgumentBuilder.literal( command.getKey() )
            .then( RequiredArgumentBuilder.argument( "args", StringArgumentType.greedyString() )
                .suggests( Commands.SuggestionRegistry.ASK_SERVER ) )
            .build();
        commands.getRoot().addChild( dummy );
        modified = true;
      }
    }
  }
  if ( modified )
  {
    con.unsafe().sendPacket( commands );
    throw CancelSendSignal.INSTANCE;
  }
}
origin: WaterfallMC/Waterfall-Old

String permission = command.getPermission();
if ( permission != null && !permission.isEmpty() && !sender.hasPermission( permission ) )
      } );
    command.execute( sender, args );
  } else if ( commandLine.contains( " " ) && command instanceof TabExecutor )
origin: CodeCrafter47/BungeeTabListPlus

  private static boolean checkPermission(CommandSender sender, Command command) {
    return BungeeTabListPlus.getInstance().getPermissionManager().hasPermission(sender, command.getPermission());
  }
}
origin: CodeCrafter47/BungeeTabListPlus

public void addSubCommand(Command command) {
  subCommands.put(command.getName(), command);
  for (String alias : command.getAliases()) {
    subCommands.put(alias, command);
  }
}
origin: WaterfallMC/Waterfall-Old

/**
 * Register a command so that it may be executed.
 *
 * @param plugin the plugin owning this command
 * @param command the command to register
 */
public void registerCommand(Plugin plugin, Command command)
{
  commandMap.put( command.getName().toLowerCase(), command );
  for ( String alias : command.getAliases() )
  {
    commandMap.put( alias.toLowerCase(), command );
  }
  commandsByPlugin.put( plugin, command );
}
net.md_5.bungee.api.pluginCommand

Javadoc

A command that can be executed by a CommandSender.

Most used methods

  • execute
    Execute this command with the specified sender and arguments.
  • getAliases
  • getName
  • getPermission
  • hasPermission
    Check if this command can be executed by the given sender.

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • findViewById (Activity)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Notification (javax.management)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now