本文整理汇总了Java中co.aikar.timings.Timings.getCommandTiming方法的典型用法代码示例。如果您正苦于以下问题:Java Timings.getCommandTiming方法的具体用法?Java Timings.getCommandTiming怎么用?Java Timings.getCommandTiming使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类co.aikar.timings.Timings
的用法示例。
在下文中一共展示了Timings.getCommandTiming方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callCommand
import co.aikar.timings.Timings; //导入方法依赖的package包/类
public void callCommand(String cmd) {
String trimedCmd = cmd.trim();
String label = null;
String[] args = null;
if (!cmd.trim().contains(" ")) {
label = trimedCmd.toLowerCase();
args = new String[0];
} else {
label = trimedCmd.substring(0, trimedCmd.indexOf(" ")).toLowerCase();
String argLine = trimedCmd.substring(trimedCmd.indexOf(" ") + 1);
args = argLine.contains(" ") ? argLine.split(" ") : new String[]{argLine};
}
if (label == null) {
proxy.getLogger().warning(proxy.getLang().get(Lang.COMMAND_NOT_FOUND));
return;
}
Command command = commandMap.get(label);
if (command == null) {
proxy.getLogger().warning(proxy.getLang().get(Lang.COMMAND_NOT_FOUND));
return;
}
try(Timing timing = Timings.getCommandTiming(command)) {
command.execute(proxy, args);
}
}
示例2: Command
import co.aikar.timings.Timings; //导入方法依赖的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: setLabel
import co.aikar.timings.Timings; //导入方法依赖的package包/类
public boolean setLabel(String name) {
this.nextLabel = name;
if (!this.isRegistered()) {
this.label = name;
this.timing = Timings.getCommandTiming(this);
return true;
}
return false;
}