Expand certain FAWE limits to use Long instead of Integer. (#1382)

This commit is contained in:
JayemCeekay 2021-11-02 11:38:39 -05:00 committed by GitHub
parent 0674f39600
commit 2c56e480c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -164,9 +164,9 @@ public class Settings extends Config {
@Comment("Max actions that can be run concurrently (i.e. commands)") @Comment("Max actions that can be run concurrently (i.e. commands)")
public int MAX_ACTIONS = 1; public int MAX_ACTIONS = 1;
@Comment("Max number of block changes (e.g. by `//set stone`).") @Comment("Max number of block changes (e.g. by `//set stone`).")
public int MAX_CHANGES = 50000000; public long MAX_CHANGES = 50000000;
@Comment("Max number of blocks checked (e.g. `//count stone` which doesn't change blocks)") @Comment("Max number of blocks checked (e.g. `//count stone` which doesn't change blocks)")
public int MAX_CHECKS = 50000000; public long MAX_CHECKS = 50000000;
@Comment("Number of times a change can fail (e.g. if the player can't access that region)") @Comment("Number of times a change can fail (e.g. if the player can't access that region)")
public int MAX_FAILS = 50000000; public int MAX_FAILS = 50000000;
@Comment("Allowed brush iterations (e.g. `//brush smooth`)") @Comment("Allowed brush iterations (e.g. `//brush smooth`)")
@ -616,7 +616,7 @@ public class Settings extends Config {
); );
limit.MAX_CHANGES = Math.max( limit.MAX_CHANGES = Math.max(
limit.MAX_CHANGES, limit.MAX_CHANGES,
newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Integer.MAX_VALUE newLimit.MAX_CHANGES != -1 ? newLimit.MAX_CHANGES : Long.MAX_VALUE
); );
limit.MAX_BLOCKSTATES = Math.max( limit.MAX_BLOCKSTATES = Math.max(
limit.MAX_BLOCKSTATES, limit.MAX_BLOCKSTATES,
@ -624,7 +624,7 @@ public class Settings extends Config {
); );
limit.MAX_CHECKS = Math.max( limit.MAX_CHECKS = Math.max(
limit.MAX_CHECKS, limit.MAX_CHECKS,
newLimit.MAX_CHECKS != -1 ? newLimit.MAX_CHECKS : Integer.MAX_VALUE newLimit.MAX_CHECKS != -1 ? newLimit.MAX_CHECKS : Long.MAX_VALUE
); );
limit.MAX_ENTITIES = Math.max( limit.MAX_ENTITIES = Math.max(
limit.MAX_ENTITIES, limit.MAX_ENTITIES,

View File

@ -7,9 +7,9 @@ import java.util.Set;
public class FaweLimit { public class FaweLimit {
public int MAX_ACTIONS = 0; public int MAX_ACTIONS = 0;
public int MAX_CHANGES = 0; public long MAX_CHANGES = 0;
public int MAX_FAILS = 0; public int MAX_FAILS = 0;
public int MAX_CHECKS = 0; public long MAX_CHECKS = 0;
public int MAX_ITERATIONS = 0; public int MAX_ITERATIONS = 0;
public int MAX_BLOCKSTATES = 0; public int MAX_BLOCKSTATES = 0;
public int MAX_ENTITIES = 0; public int MAX_ENTITIES = 0;
@ -103,9 +103,9 @@ public class FaweLimit {
MAX.SPEED_REDUCTION = 0; MAX.SPEED_REDUCTION = 0;
MAX.INVENTORY_MODE = 0; MAX.INVENTORY_MODE = 0;
MAX.MAX_ACTIONS = 1; MAX.MAX_ACTIONS = 1;
MAX.MAX_CHANGES = Integer.MAX_VALUE; MAX.MAX_CHANGES = Long.MAX_VALUE;
MAX.MAX_FAILS = Integer.MAX_VALUE; MAX.MAX_FAILS = Integer.MAX_VALUE;
MAX.MAX_CHECKS = Integer.MAX_VALUE; MAX.MAX_CHECKS = Long.MAX_VALUE;
MAX.MAX_ITERATIONS = Integer.MAX_VALUE; MAX.MAX_ITERATIONS = Integer.MAX_VALUE;
MAX.MAX_BLOCKSTATES = Integer.MAX_VALUE; MAX.MAX_BLOCKSTATES = Integer.MAX_VALUE;
MAX.MAX_ENTITIES = Integer.MAX_VALUE; MAX.MAX_ENTITIES = Integer.MAX_VALUE;
@ -229,9 +229,9 @@ public class FaweLimit {
} }
public boolean isUnlimited() { public boolean isUnlimited() {
return MAX_CHANGES == Integer.MAX_VALUE return MAX_CHANGES == Long.MAX_VALUE
&& MAX_FAILS == Integer.MAX_VALUE && MAX_FAILS == Integer.MAX_VALUE
&& MAX_CHECKS == Integer.MAX_VALUE && MAX_CHECKS == Long.MAX_VALUE
&& MAX_ITERATIONS == Integer.MAX_VALUE && MAX_ITERATIONS == Integer.MAX_VALUE
&& MAX_BLOCKSTATES == Integer.MAX_VALUE && MAX_BLOCKSTATES == Integer.MAX_VALUE
&& MAX_ENTITIES == Integer.MAX_VALUE && MAX_ENTITIES == Integer.MAX_VALUE

View File

@ -532,7 +532,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @see #getLimit() * @see #getLimit()
*/ */
@Deprecated @Deprecated
public int getBlockChangeLimit() { public long getBlockChangeLimit() {
return originalLimit.MAX_CHANGES; return originalLimit.MAX_CHANGES;
} }
@ -541,7 +541,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* *
* @param limit the limit (>= 0) or -1 for no limit * @param limit the limit (>= 0) or -1 for no limit
*/ */
public void setBlockChangeLimit(int limit) { public void setBlockChangeLimit(long limit) {
this.limit.MAX_CHANGES = limit; this.limit.MAX_CHANGES = limit;
} }