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

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

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

Command.setLabel介绍

[英]Sets the label of this command.

If the command is currently registered the label change will only take effect after its been re-registered e.g. after a /reload
[中]设置此命令的标签。
如果命令当前已注册,则标签更改仅在其重新注册后生效,例如在a/reload之后

代码示例

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

command.setLabel(label);

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

/**
 * {@inheritDoc}
 */
public boolean register(String label, String fallbackPrefix, Command command) {
  label = label.toLowerCase().trim();
  fallbackPrefix = fallbackPrefix.toLowerCase().trim();
  boolean registered = register(label, command, false, fallbackPrefix);
  Iterator<String> iterator = command.getAliases().iterator();
  while (iterator.hasNext()) {
    if (!register(iterator.next(), command, true, fallbackPrefix)) {
      iterator.remove();
    }
  }
  // If we failed to register under the real name, we need to set the command label to the direct address
  if (!registered) {
    command.setLabel(fallbackPrefix + ":" + label);
  }
  // Register to us so further updates of the commands label and aliases are postponed until its reregistered
  command.register(this);
  return registered;
}

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

@Override
public MCCommand setLabel(String name) {
  cmd.setLabel(name);
  return this;
}

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

command.setLabel(label);

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

/**
 * {@inheritDoc}
 */
public boolean register(String label, String fallbackPrefix, Command command) {
  label = label.toLowerCase().trim();
  fallbackPrefix = fallbackPrefix.toLowerCase().trim();
  boolean registered = register(label, command, false, fallbackPrefix);
  Iterator<String> iterator = command.getAliases().iterator();
  while (iterator.hasNext()) {
    if (!register(iterator.next(), command, true, fallbackPrefix)) {
      iterator.remove();
    }
  }
  // If we failed to register under the real name, we need to set the command label to the direct address
  if (!registered) {
    command.setLabel(fallbackPrefix + ":" + label);
  }
  // Register to us so further updates of the commands label and aliases are postponed until its reregistered
  command.register(this);
  return registered;
}

代码示例来源:origin: aikar/commands

if (split.length > 1) {
  oldCommand.unregister(commandMap);
  oldCommand.setLabel(split[0] + ":" + command.getName());
  oldCommand.register(commandMap);

代码示例来源: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);
  }
}

相关文章