mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-14 11:21:23 +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
|
// Maps
|
||||||
public static final @NotNull String MAP_RGB_MAPPING = stringProperty("minestom.map.rgbmapping", "lazy");
|
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
|
// Entities
|
||||||
public static final boolean ENFORCE_INTERACTION_LIMIT = booleanProperty("minestom.enforce-entity-interaction-range", true);
|
public static final boolean ENFORCE_INTERACTION_LIMIT = booleanProperty("minestom.enforce-entity-interaction-range", true);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.minestom.server.map;
|
package net.minestom.server.map;
|
||||||
|
|
||||||
import net.minestom.server.MinecraftServer;
|
|
||||||
import net.minestom.server.ServerFlag;
|
import net.minestom.server.ServerFlag;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -92,15 +91,10 @@ public enum MapColors {
|
|||||||
mappingStrategy = strategy;
|
mappingStrategy = strategy;
|
||||||
|
|
||||||
int reduction = 10;
|
int reduction = 10;
|
||||||
if (ServerFlag.MAP_RGB_REDUCTION != null) {
|
if (ServerFlag.MAP_RGB_REDUCTION != -1) {
|
||||||
try {
|
reduction = ServerFlag.MAP_RGB_REDUCTION;
|
||||||
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 (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);
|
logger.warn("Reduction was found to be invalid: {}. Must in 0-255, defaulting to 10.", reduction);
|
||||||
reduction = 10;
|
reduction = 10;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user