mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-01 05:18:00 +01:00
Make lag warnings toggleable
This commit is contained in:
parent
a9839ca6d6
commit
6f93951028
@ -104,6 +104,9 @@ logging:
|
||||
showactivechecks:
|
||||
Should NoCheat display lists of checks that are enabled for each world. Set to true
|
||||
if you are unsure if you setup your configuration correctly.
|
||||
debugmessages:
|
||||
Should some additional messages be displayed in the server console, e.g. about
|
||||
NoCheat encountering lag.
|
||||
|
||||
checks:
|
||||
Anything that has to do with the checks that NoCheat executes
|
||||
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cc.co.evenprime.bukkit</groupId>
|
||||
<artifactId>NoCheat</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>NoCheat</name>
|
||||
<properties>
|
||||
|
@ -14,6 +14,7 @@ public abstract class ConfPaths {
|
||||
public final static String LOGGING_LOGTOCONSOLE = LOGGING + "console";
|
||||
public final static String LOGGING_LOGTOINGAMECHAT = LOGGING + "ingamechat";
|
||||
public final static String LOGGING_SHOWACTIVECHECKS = LOGGING + "showactivechecks";
|
||||
public final static String LOGGING_DEBUGMESSAGES = LOGGING + "debugmessages";
|
||||
|
||||
private final static String CHECKS = "checks.";
|
||||
private final static String INVENTORY_DROP = CHECKS + "inventory.drop.";
|
||||
|
@ -17,6 +17,7 @@ public class DefaultConfiguration extends NoCheatConfiguration {
|
||||
/** LOGGING **/
|
||||
set(ConfPaths.LOGGING_ACTIVE, true);
|
||||
set(ConfPaths.LOGGING_SHOWACTIVECHECKS, false);
|
||||
set(ConfPaths.LOGGING_DEBUGMESSAGES, false);
|
||||
set(ConfPaths.LOGGING_PREFIX, "&4NC&f: ");
|
||||
set(ConfPaths.LOGGING_FILENAME, "nocheat.log");
|
||||
set(ConfPaths.LOGGING_LOGTOFILE, true);
|
||||
|
@ -12,11 +12,13 @@ public class LoggingConfig {
|
||||
public final boolean toConsole;
|
||||
public final boolean toChat;
|
||||
public final String prefix;
|
||||
public final boolean debugmessages;
|
||||
|
||||
public LoggingConfig(NoCheatConfiguration data) {
|
||||
|
||||
active = data.getBoolean(ConfPaths.LOGGING_ACTIVE);
|
||||
showactivechecks = data.getBoolean(ConfPaths.LOGGING_SHOWACTIVECHECKS);
|
||||
debugmessages = data.getBoolean(ConfPaths.LOGGING_DEBUGMESSAGES);
|
||||
prefix = data.getString(ConfPaths.LOGGING_PREFIX);
|
||||
toFile = data.getBoolean(ConfPaths.LOGGING_LOGTOFILE);
|
||||
toConsole = data.getBoolean(ConfPaths.LOGGING_LOGTOCONSOLE);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cc.co.evenprime.bukkit.nocheat.debug;
|
||||
|
||||
import org.bukkit.World;
|
||||
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
||||
|
||||
public class LagMeasureTask implements Runnable {
|
||||
@ -28,12 +29,13 @@ public class LagMeasureTask implements Runnable {
|
||||
// If the previous second took to long, skip checks during
|
||||
// this second
|
||||
skipCheck = lastIngamesecondDuration > 1500;
|
||||
|
||||
if(oldStatus != skipCheck && skipCheck) {
|
||||
System.out.println("[NoCheat] detected server lag, some checks will not work.");
|
||||
}
|
||||
else if(oldStatus != skipCheck && !skipCheck) {
|
||||
System.out.println("[NoCheat] server lag seems to have stopped, reenabling checks.");
|
||||
|
||||
if(plugin.getConfig((World) null).logging.debugmessages) {
|
||||
if(oldStatus != skipCheck && skipCheck) {
|
||||
System.out.println("[NoCheat] detected server lag, some checks will not work.");
|
||||
} else if(oldStatus != skipCheck && !skipCheck) {
|
||||
System.out.println("[NoCheat] server lag seems to have stopped, reenabling checks.");
|
||||
}
|
||||
}
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
|
Loading…
Reference in New Issue
Block a user