本文整理了Java中org.bukkit.command.Command.register()
方法的一些代码示例,展示了Command.register()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Command.register()
方法的具体详情如下:
包路径:org.bukkit.command.Command
类名称:Command
方法名:register
[英]Registers this command to a CommandMap. Once called it only allows changes the registered CommandMap
[中]将此命令注册到CommandMap。一旦调用,它只允许更改已注册的CommandMap
代码示例来源: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 boolean register(MCCommandMap map) {
return cmd.register(((BukkitMCCommandMap) map).scm);
}
代码示例来源: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
oldCommand.unregister(commandMap);
oldCommand.setLabel(split[0] + ":" + command.getName());
oldCommand.register(commandMap);
内容来源于网络,如有侵权,请联系作者删除!