本文整理汇总了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;
}
示例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)});
}
示例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();
}
示例4: getDefaultCommandData
import cn.nukkit.command.data.CommandData; //导入依赖的package包/类
/**
* Returns an CommandData containing command data
*
* @return CommandData
*/
public CommandData getDefaultCommandData() {
return this.commandData;
}