Java Code Examples for org.bukkit.command.defaults.TimingsCommand#timingStart()

The following examples show how to use org.bukkit.command.defaults.TimingsCommand#timingStart() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpigotTimingsCommand.java    From LagMonitor with MIT License 6 votes vote down vote up
@Override
protected void sendTimings(CommandSender sender) {
    //place sampleTime here to be very accurate
    long sampleTime = System.nanoTime() - TimingsCommand.timingStart;
    if (TimeUnit.NANOSECONDS.toMinutes(sampleTime) <= 5) {
        sendError(sender, "Sampling time is too low");
        return;
    }

    Queue<CustomTimingsHandler> handlers = Reflection.getField(CustomTimingsHandler.class, "HANDLERS", Queue.class)
            .get(null);

    List<BaseComponent[]> lines = new ArrayList<>();
    sendParsedOutput(handlers, lines, sampleTime);

    Pages pagination = new Pages("Paper Timings", lines);
    pagination.send(sender);

    this.plugin.getPageManager().setPagination(sender.getName(), pagination);
}
 
Example 2
Source File: SpigotTimingsCommand.java    From LagMonitor with MIT License 6 votes vote down vote up
@Override
protected void sendTimings(CommandSender sender) {
    //place sampleTime here to be very accurate
    long sampleTime = System.nanoTime() - TimingsCommand.timingStart;
    if (TimeUnit.NANOSECONDS.toMinutes(sampleTime) <= 5) {
        sendError(sender, "Sampling time is too low");
        return;
    }

    Queue<CustomTimingsHandler> handlers = Reflection.getField(CustomTimingsHandler.class, "HANDLERS", Queue.class)
            .get(null);

    List<BaseComponent[]> lines = new ArrayList<>();
    sendParsedOutput(handlers, lines, sampleTime);

    Pages pagination = new Pages("Paper Timings", lines);
    pagination.send(sender);

    this.plugin.getPageManager().setPagination(sender.getName(), pagination);
}
 
Example 3
Source File: CustomTimingsHandler.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Resets all timings.
 */
public static void reload() {
    if (Bukkit.getPluginManager().useTimings()) {
        for (CustomTimingsHandler timings : HANDLERS) {
            timings.reset();
        }
    }
    TimingsCommand.timingStart = System.nanoTime();
}
 
Example 4
Source File: CustomTimingsHandler.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Resets all timings.
 */
public static void reload()
{
    if ( Bukkit.getPluginManager().useTimings() )
    {
        for ( CustomTimingsHandler timings : HANDLERS )
        {
            timings.reset();
        }
    }
    TimingsCommand.timingStart = System.nanoTime();
}