Java Code Examples for co.aikar.timings.Timings#isTimingsEnabled()

The following examples show how to use co.aikar.timings.Timings#isTimingsEnabled() . 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: TimingsCommand.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@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;
}
 
Example 2
Source File: TimingsCommand.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@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;
}
 
Example 3
Source File: SkriptTimings.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
public static boolean enabled() {
	// First check if we can run timings (enabled in settings + running Paper)
	// After that (we know that class exists), check if server has timings running
	return enabled && Timings.isTimingsEnabled();
}
 
Example 4
Source File: PaperTimingsCommand.java    From LagMonitor with MIT License 4 votes vote down vote up
@Override
protected boolean isTimingsEnabled() {
    return Timings.isTimingsEnabled();
}
 
Example 5
Source File: TimingsCommand.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
@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;
}
 
Example 6
Source File: PaperTimingsCommand.java    From LagMonitor with MIT License 4 votes vote down vote up
@Override
protected boolean isTimingsEnabled() {
    return Timings.isTimingsEnabled();
}