Skip to content

Commit 92c232b

Browse files
committed
Config: Aera values will be swap if min > max
1 parent 8a99245 commit 92c232b

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# 2.0.7
2-
- World surface biomes can be read from top value only.
1+
# 2.0.9
2+
- Config: Aera values will be swap if min > max.

Underilla-Spigot/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212

1313
group = "com.jkantrell.mc.underilla"
14-
version = "2.0.8"
14+
version = "2.0.9"
1515
description="Generate vanilla cave in custom world."
1616
val mainMinecraftVersion = "1.21.4"
1717
val supportedMinecraftVersions = "1.21.3 - 1.21.4"

Underilla-Spigot/src/main/java/com/jkantrell/mc/underilla/spigot/io/UnderillaConfig.java

+22
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public void reload(FileConfiguration fileConfiguration) {
104104
}
105105
integerMap.put(key, value);
106106
}
107+
swapAeraValueIfNeeded();
107108

108109
stringMap.clear();
109110
for (StringKeys key : StringKeys.values()) {
@@ -173,6 +174,27 @@ public void reload(FileConfiguration fileConfiguration) {
173174
}
174175
}
175176

177+
private void swapAeraValueIfNeeded() {
178+
if (getInt(IntegerKeys.GENERATION_AREA_MIN_X) > getInt(IntegerKeys.GENERATION_AREA_MAX_X)) {
179+
Underilla.warning("Min X is greater than max X. Swapping values.");
180+
int temp = getInt(IntegerKeys.GENERATION_AREA_MIN_X);
181+
integerMap.put(IntegerKeys.GENERATION_AREA_MIN_X, getInt(IntegerKeys.GENERATION_AREA_MAX_X));
182+
integerMap.put(IntegerKeys.GENERATION_AREA_MAX_X, temp);
183+
}
184+
if (getInt(IntegerKeys.GENERATION_AREA_MIN_Y) > getInt(IntegerKeys.GENERATION_AREA_MAX_Y)) {
185+
Underilla.warning("Min Y is greater than max Y. Swapping values.");
186+
int temp = getInt(IntegerKeys.GENERATION_AREA_MIN_Y);
187+
integerMap.put(IntegerKeys.GENERATION_AREA_MIN_Y, getInt(IntegerKeys.GENERATION_AREA_MAX_Y));
188+
integerMap.put(IntegerKeys.GENERATION_AREA_MAX_Y, temp);
189+
}
190+
if (getInt(IntegerKeys.GENERATION_AREA_MIN_Z) > getInt(IntegerKeys.GENERATION_AREA_MAX_Z)) {
191+
Underilla.warning("Min Z is greater than max Z. Swapping values.");
192+
int temp = getInt(IntegerKeys.GENERATION_AREA_MIN_Z);
193+
integerMap.put(IntegerKeys.GENERATION_AREA_MIN_Z, getInt(IntegerKeys.GENERATION_AREA_MAX_Z));
194+
integerMap.put(IntegerKeys.GENERATION_AREA_MAX_Z, temp);
195+
}
196+
}
197+
176198
public void initSetEntityType(FileConfiguration fileConfiguration) {
177199
for (SetEntityTypeKeys key : SetEntityTypeKeys.values()) {
178200
List<String> regexList = new ArrayList<>();

0 commit comments

Comments
 (0)