mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
Make limiting parameters for block change tracking accessible.
(Not yet in use by default.
This commit is contained in:
parent
c7f19bdbe6
commit
48bc795fd5
|
@ -306,8 +306,10 @@ public class BlockChangeTracker {
|
|||
/** Change id/count, increasing with each entry added internally. */
|
||||
private long maxChangeId = 0;
|
||||
|
||||
private int expirationAgeTicks = 80; // TODO: Configurable.
|
||||
private int worldNodeSkipSize = 500; // TODO: Configurable.
|
||||
/** Global maximum age for entries, in ticks. */
|
||||
private int expirationAgeTicks = 80;
|
||||
/** Size at which entries get skipped, per world node. */
|
||||
private int worldNodeSkipSize = 500;
|
||||
|
||||
/**
|
||||
* Store the WorldNode instances by UUID, containing the block change
|
||||
|
@ -556,4 +558,20 @@ public class BlockChangeTracker {
|
|||
return size;
|
||||
}
|
||||
|
||||
public int getExpirationAgeTicks() {
|
||||
return expirationAgeTicks;
|
||||
}
|
||||
|
||||
public void setExpirationAgeTicks(int expirationAgeTicks) {
|
||||
this.expirationAgeTicks = expirationAgeTicks;
|
||||
}
|
||||
|
||||
public int getWorldNodeSkipSize() {
|
||||
return worldNodeSkipSize;
|
||||
}
|
||||
|
||||
public void setWorldNodeSkipSize(int worldNodeSkipSize) {
|
||||
this.worldNodeSkipSize = worldNodeSkipSize;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public abstract class ConfPaths {
|
|||
public static final String SUB_MODEL = "model";
|
||||
public static final String SUB_MODIFIERS = "modifiers";
|
||||
public static final String SUB_MODSPRINT = "modsprint";
|
||||
/** No trailing dot! */
|
||||
public static final String SUB_OVERRIDEFLAGS = "overrideflags";
|
||||
public static final String SUB_SPEED = "speed";
|
||||
public static final String SUB_VERTICAL = "vertical";
|
||||
|
@ -739,10 +740,13 @@ public abstract class ConfPaths {
|
|||
public static final String COMPATIBILITY_SERVER_CBREFLECT = COMPATIBILITY_SERVER + "cbreflect.";
|
||||
public static final String COMPATIBILITY_SERVER_CBREFLECT_ENABLE = COMPATIBILITY_SERVER_CBREFLECT + "enable";
|
||||
|
||||
public static final String COMPATIBILITY_BLOCKS = COMPATIBILITY + "blocks.";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER = COMPATIBILITY_BLOCKS + "changetracker.";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_ACTIVE = COMPATIBILITY_BLOCKS_CHANGETRACKER + "active";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_PISTONS= COMPATIBILITY_BLOCKS_CHANGETRACKER + "pistons";
|
||||
public static final String COMPATIBILITY_BLOCKS = COMPATIBILITY + "blocks.";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER = COMPATIBILITY_BLOCKS + "changetracker.";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_ACTIVE = COMPATIBILITY_BLOCKS_CHANGETRACKER + "active";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_PISTONS = COMPATIBILITY_BLOCKS_CHANGETRACKER + "pistons";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_MAXAGETICKS = COMPATIBILITY_BLOCKS_CHANGETRACKER + "maxageticks";
|
||||
private static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_PERWORLD = COMPATIBILITY_BLOCKS_CHANGETRACKER + "perworld.";
|
||||
public static final String COMPATIBILITY_BLOCKS_CHANGETRACKER_PERWORLD_MAXENTRIES = COMPATIBILITY_BLOCKS_CHANGETRACKER_PERWORLD + "maxentries";
|
||||
|
||||
// Moved paths.
|
||||
@Moved(newPath = LOGGING_BACKEND_CONSOLE_ACTIVE)
|
||||
|
|
|
@ -603,6 +603,8 @@ public class DefaultConfig extends ConfigFile {
|
|||
}
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_ACTIVE, false); // TODO: Activate once it really works?
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_PISTONS, true);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_MAXAGETICKS, 80);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_PERWORLD_MAXENTRIES, 1000);
|
||||
|
||||
// // Update internal factory based on all the new entries to the "actions" section.
|
||||
// setActionFactory();
|
||||
|
|
|
@ -1121,6 +1121,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||
}
|
||||
|
||||
private void updateBlockChangeTracker(final ConfigFile config) {
|
||||
// Activation / listener.
|
||||
if (config.getBoolean(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_ACTIVE)
|
||||
&& config.getBoolean(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_PISTONS)) {
|
||||
if (blockChangeListener == null) {
|
||||
|
@ -1133,6 +1134,9 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||
blockChangeListener.setEnabled(false);
|
||||
blockChangeTracker.clear();
|
||||
}
|
||||
// Configuration.
|
||||
blockChangeTracker.setExpirationAgeTicks(config.getInt(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_MAXAGETICKS));
|
||||
blockChangeTracker.setWorldNodeSkipSize(config.getInt(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_PERWORLD_MAXENTRIES));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user