/** * Resets all timings. */ public static void reload() { if ( Bukkit.getPluginManager().useTimings() ) { for ( CustomTimingsHandler timings : HANDLERS ) { timings.reset(); } } TimingsCommand.timingStart = System.nanoTime(); }
@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; } if (!Bukkit.getPluginManager().useTimings()) { sender.sendMessage(ChatColor.DARK_RED + "The server deactivated timing reports"); sender.sendMessage(ChatColor.DARK_RED + "Go to bukkit.yml and activate plugin-profiling"); return true; } //paperspigot moved to class to package co.aikar.timings try { Class.forName("org.bukkit.command.defaults.TimingsCommand"); } catch (ClassNotFoundException e) { sender.sendMessage(ChatColor.DARK_RED + "You're using a new Timings version on your server system"); sender.sendMessage(ChatColor.DARK_RED + "Please use the experimental command /paper"); } //place sampleTime here to be very accurate long sampleTime = System.nanoTime() - TimingsCommand.timingStart; Queue<CustomTimingsHandler> handlers = Reflection.getField(CustomTimingsHandler.class, "HANDLERS", Queue.class) .get(null); List<BaseComponent[]> lines = Lists.newArrayList(); sendParsedOutput(handlers, lines, sampleTime); Pagination pagination = new Pagination("Paper Timings", lines); pagination.send(sender); this.plugin.getPaginations().put(sender, pagination); return true; }
private void setDefaultCommands() { register("bukkit", new VersionCommand("version")); register("bukkit", new ReloadCommand("reload")); register("bukkit", new PluginsCommand("plugins")); register("bukkit", new TimingsCommand("timings")); }