本文整理汇总了Java中co.aikar.timings.Timings.isTimingsEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Timings.isTimingsEnabled方法的具体用法?Java Timings.isTimingsEnabled怎么用?Java Timings.isTimingsEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类co.aikar.timings.Timings
的用法示例。
在下文中一共展示了Timings.isTimingsEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommand
import co.aikar.timings.Timings; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!isAllowed(sender, command)) {
sender.sendMessage(org.bukkit.ChatColor.DARK_RED + "Not whitelisted");
return true;
}
try {
Class.forName(EXPORT_CLASS);
} catch (ClassNotFoundException e) {
sender.sendMessage(ChatColor.DARK_RED + "You aren't using PaperSpigot.");
sender.sendMessage(ChatColor.DARK_RED + "This command is for the new timings (v2) system only");
sender.sendMessage(ChatColor.DARK_RED + "Please use '/timing' for the old system");
return true;
}
if (!Timings.isTimingsEnabled()) {
sender.sendMessage(ChatColor.DARK_RED + "The server deactivated timing reports");
sender.sendMessage(ChatColor.DARK_RED + "Go to paper.yml and activate timings");
return true;
}
EvictingQueue<TimingHistory> history = Reflection.getField(TimingsManager.class, "HISTORY", EvictingQueue.class)
.get(null);
TimingHistory lastHistory = history.peek();
if (lastHistory == null) {
sender.sendMessage(ChatColor.DARK_RED + "Not enough data collected yet");
return true;
}
List<BaseComponent[]> lines = Lists.newArrayList();
printTimings(lines, lastHistory);
Pagination pagination = new Pagination("Paper Timings", lines);
pagination.send(sender);
this.plugin.getPaginations().put(sender, pagination);
return true;
}
示例2: execute
import co.aikar.timings.Timings; //导入方法依赖的package包/类
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) {
return true;
}
if (args.length != 1) {
sender.sendMessage(new TranslationContainer("commands.generic.usage", usageMessage));
return true;
}
String mode = args[0].toLowerCase();
if (mode.equals("on")) {
Timings.setTimingsEnabled(true);
Timings.reset();
sender.sendMessage(new TranslationContainer("nukkit.command.timings.enable"));
return true;
} else if (mode.equals("off")) {
Timings.setTimingsEnabled(false);
sender.sendMessage(new TranslationContainer("nukkit.command.timings.disable"));
return true;
}
if (!Timings.isTimingsEnabled()) {
sender.sendMessage(new TranslationContainer("nukkit.command.timings.timingsDisabled"));
return true;
}
switch (mode) {
case "verbon":
sender.sendMessage(new TranslationContainer("nukkit.command.timings.verboseEnable"));
Timings.setVerboseEnabled(true);
break;
case "verboff":
sender.sendMessage(new TranslationContainer("nukkit.command.timings.verboseDisable"));
Timings.setVerboseEnabled(true);
break;
case "reset":
Timings.reset();
sender.sendMessage(new TranslationContainer("nukkit.command.timings.reset"));
break;
case "report":
case "paste":
TimingsExport.reportTimings(sender);
break;
}
return true;
}