本文整理汇总了Java中cn.nukkit.command.data.CommandData类的典型用法代码示例。如果您正苦于以下问题:Java CommandData类的具体用法?Java CommandData怎么用?Java CommandData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandData类属于cn.nukkit.command.data包,在下文中一共展示了CommandData类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateCustomCommandData
import cn.nukkit.command.data.CommandData; //导入依赖的package包/类
/**
* Generates modified command data for the specified player
* for AvailableCommandsPacket.
*
* @return CommandData|null
*/
public CommandDataVersions generateCustomCommandData(Player player) {
if (!this.testPermission(player)) {
return null;
}
CommandData customData = this.commandData.clone();
customData.aliases = this.getAliases();
customData.description = player.getServer().getLanguage().translateString(this.getDescription());
customData.permission = player.hasPermission(this.getPermission()) ? "any" : "false";
this.commandParameters.forEach((key, par) -> {
CommandOverload overload = new CommandOverload();
overload.input.parameters = par;
customData.overloads.put(key, overload);
});
if (customData.overloads.size() == 0) customData.overloads.put("default", new CommandOverload());
CommandDataVersions versions = new CommandDataVersions();
versions.versions.add(customData);
return versions;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:26,代码来源:Command.java
示例2: Command
import cn.nukkit.command.data.CommandData; //导入依赖的package包/类
public Command(String name, String description, String usageMessage, String[] aliases) {
this.commandData = new CommandData();
this.name = name;
this.nextLabel = name;
this.label = name;
this.description = description;
this.usageMessage = usageMessage == null ? "/" + name : usageMessage;
this.aliases = aliases;
this.activeAliases = aliases;
this.timing = Timings.getCommandTiming(this);
this.commandParameters.put("default", new CommandParameter[]{new CommandParameter("args", "rawtext", true)});
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:13,代码来源:Command.java
示例3: generateDefaultData
import cn.nukkit.command.data.CommandData; //导入依赖的package包/类
public static final CommandData generateDefaultData() {
if (defaultDataTemplate == null) {
//defaultDataTemplate = new Gson().fromJson(new InputStreamReader(Server.class.getClassLoader().getResourceAsStream("command_default.json")));
}
return defaultDataTemplate.clone();
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:7,代码来源:Command.java
示例4: getDefaultCommandData
import cn.nukkit.command.data.CommandData; //导入依赖的package包/类
/**
* Returns an CommandData containing command data
*
* @return CommandData
*/
public CommandData getDefaultCommandData() {
return this.commandData;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:9,代码来源:Command.java
注:本文中的cn.nukkit.command.data.CommandData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论