mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-11 09:51:35 +01:00
Change Map Reduction flag to be an int property to avoid number parsing (#2460)
* Change Map Reduction flag to be an int property to avoid number parsing
This commit is contained in:
parent
16c9182ab0
commit
c148954a47
@ -56,7 +56,7 @@ public final class ServerFlag {
|
||||
|
||||
// Maps
|
||||
public static final @NotNull String MAP_RGB_MAPPING = stringProperty("minestom.map.rgbmapping", "lazy");
|
||||
public static final @Nullable String MAP_RGB_REDUCTION = stringProperty("minestom.map.rgbreduction"); // Only used if rgb mapping is "approximate"
|
||||
public static final int MAP_RGB_REDUCTION = intProperty("minestom.map.rgbreduction", -1); // Only used if rgb mapping is "approximate"
|
||||
|
||||
// Entities
|
||||
public static final boolean ENFORCE_INTERACTION_LIMIT = booleanProperty("minestom.enforce-entity-interaction-range", true);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.minestom.server.map;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.ServerFlag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -92,15 +91,10 @@ public enum MapColors {
|
||||
mappingStrategy = strategy;
|
||||
|
||||
int reduction = 10;
|
||||
if (ServerFlag.MAP_RGB_REDUCTION != null) {
|
||||
try {
|
||||
reduction = Integer.parseInt(ServerFlag.MAP_RGB_REDUCTION);
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("Invalid integer in reduction argument: {}", ServerFlag.MAP_RGB_REDUCTION);
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
}
|
||||
if (ServerFlag.MAP_RGB_REDUCTION != -1) {
|
||||
reduction = ServerFlag.MAP_RGB_REDUCTION;
|
||||
|
||||
if (reduction < 0 || reduction >= 255) {
|
||||
if (reduction < 0 || reduction > 255) {
|
||||
logger.warn("Reduction was found to be invalid: {}. Must in 0-255, defaulting to 10.", reduction);
|
||||
reduction = 10;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user