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