org.bukkit.command.Command.getLabel()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.bukkit.command.Command.getLabel()方法的一些代码示例,展示了Command.getLabel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Command.getLabel()方法的具体详情如下:
包路径:org.bukkit.command.Command
类名称:Command
方法名:getLabel

Command.getLabel介绍

[英]Returns the current label for this command
[中]返回此命令的当前标签

代码示例

代码示例来源:origin: Bukkit/Bukkit

if (conflict != null && conflict.getLabel().equals(label)) {
  return false;

代码示例来源:origin: Bukkit/Bukkit

public GenericCommandHelpTopic(Command command) {
  this.command = command;
  if (command.getLabel().startsWith("/")) {
    name = command.getLabel();
  } else {
    name = "/" + command.getLabel();

代码示例来源:origin: GlowstoneMC/Glowstone

continue;
HelpTopic original = getHelpTopic("/" + command.getLabel());
if (original != null) {
  for (String alias : command.getAliases()) {
String pluginName = getCommandPluginName(command);
if (pluginName != null) {
  HelpTopic topic = getHelpTopic("/" + command.getLabel());
  if (topic != null) {
    if (!pluginIndexes.containsKey(pluginName)) {

代码示例来源:origin: EngineHub/CommandHelper

@Override
public String getLabel() {
  return cmd.getLabel();
}

代码示例来源:origin: stackoverflow.com

@Override
 public void addCommand(Command cmd) {
   if (cmd.getLabel().equals("Edit_Cell")){
     removeCommand(sample1); // with all the previously added commands
   }
   super.addCommand(cmd);
   if (cmd.getLabel().equals("Edit_Cell")){
    addCommand(sample1); // again with all your previously added commands
   }
 }

代码示例来源:origin: NoCheatPlus/NoCheatPlus

/**
 * Get the command label (trim + lower case), include server commands [subject to change].
 * @param alias
 * @param strict If to return null if no command is found.
 * @return The command label, if possible to find, or the alias itself (+ trim + lower-case).
 */
public static String getCommandLabel(final String alias, final boolean strict) {
  final Command command = getCommand(alias);
  if (command == null) {
    return strict ? null : alias.trim().toLowerCase();
  }
  else {
    return command.getLabel().trim().toLowerCase();
  }
}

代码示例来源:origin: stackoverflow.com

// ... your AddReview class
 public AddReview(String title, MainFoodie mf) {
   super(title);
   this.mf = mf; // without that you'll get NPE in changeSreen
   // ...
 }
 //...
 private void changeScreen(Alert a, Form f){
   Display.getDisplay(mf).setCurrent(a, f);
 }
 public void commandAction(Command c, Displayable d) {
   if(c.getLabel().equals("Save")){
     // how to show alert here:
     changeScreen(cfmAlert, this)
   }

代码示例来源:origin: stackoverflow.com

Form myForm = new Form("Test form");
Command ok = new Command("OK",Command.OK,0);
Command cancel = new Command("CANCEL",Command.CANCEL,1);
myForm.addCommand(ok);
myForm.addCommand(cancel);       
myForm.setCommandListener(new CommandListener(){
  public void commandAction(Command c, Displayable d) {
    if(c.getLabel().equals("OK")){
      //Do something...
      myForm.removeCommand(c);//remove the command ok
    }
  }
});

代码示例来源:origin: SpigotMC/Spigot-API

if (conflict != null && conflict.getLabel().equals(label)) {
  return false;

代码示例来源:origin: lucko/commodore

/**
 * Gets all of the aliases known for the given command.
 *
 * <p>This will include the main label, as well as defined aliases, and
 * aliases including the fallback prefix added by Bukkit.</p>
 *
 * @param command the command
 * @return the aliases
 */
static Collection<String> getAliases(Command command) {
  Stream<String> aliasesStream = Stream.concat(
      Stream.of(command.getLabel()),
      command.getAliases().stream()
  );
  if (command instanceof PluginCommand) {
    String fallbackPrefix = ((PluginCommand) command).getPlugin().getName().toLowerCase().trim();
    aliasesStream = aliasesStream.flatMap(alias -> Stream.of(
        alias,
        fallbackPrefix + ":" + alias
    ));
  }
  return aliasesStream.distinct().collect(Collectors.toList());
}

代码示例来源:origin: SpigotMC/Spigot-API

public GenericCommandHelpTopic(Command command) {
  this.command = command;
  if (command.getLabel().startsWith("/")) {
    name = command.getLabel();
  } else {
    name = "/" + command.getLabel();

代码示例来源:origin: stackoverflow.com

// ...
public void commandAction(Command c, Displayable d) 
{
  String label = c.getLabel();
  // log the event details; note Displayable.getTitle is available since MIDP 2.0
  log("command  s [" + label + "], screen is [" + d.getTitle() + "]");

  if(label.equals("ok"))
  {
    // log detection of the command
    log("command obtained, showing input");
    showInput();
  }
}

private void log(String message)
{
  // show message in emulator console
  System.out.println(message);
}
// ...

代码示例来源:origin: stackoverflow.com

String label = c.getLabel();
if(label.equals("Exit")){
destroyApp(true);

代码示例来源:origin: NoCheatPlus/NoCheatPlus

public void restore() {
    // (Don't skip resetting, as there could be fall-back aliases.)
    //			Command registered = CommandUtil.getCommand(label);
    //			if (registered == null || registered != command) return;
    if (!label.equalsIgnoreCase(command.getLabel().trim().toLowerCase())) {
      command.setLabel(label);
    }
    command.setPermission(permission);
    if (permission != null && permissionDefault != null) {
      Permission perm = Bukkit.getPluginManager().getPermission(permission);
      if (perm != null && perm.getDefault() != permissionDefault) {
        perm.setDefault(permissionDefault);
      }
    }
    command.setPermissionMessage(permissionMessage);
  }
}

代码示例来源:origin: stackoverflow.com

String label = c.getLabel();
if(label.equals("Exit")){
 destroyApp(true);

代码示例来源:origin: stackoverflow.com

String label = c.getLabel();

代码示例来源:origin: NoCheatPlus/NoCheatPlus

messageVars.add("/" + command.getLabel().toLowerCase() + (split.length > 1 ? (" " + split[1]) : ""));

代码示例来源:origin: NoCheatPlus/NoCheatPlus

final String lcLabel = command.getLabel().trim().toLowerCase();
if (checked.contains(lcLabel) || containsAnyAliases(checked, command)) {
  if (!invertIgnored) {

相关文章