Skip to content

Commit 3e4ded5

Browse files
committed
Merge branch 'main' into v5.4
2 parents 8bffffd + bca71e1 commit 3e4ded5

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

src/main/java/org/mvplugins/multiverse/core/command/MVCommandCompletions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,16 @@ private Collection<String> suggestMVWorlds(BukkitCommandCompletionContext contex
279279
case "both" -> {
280280
return worldManager.getWorlds().stream()
281281
.map(MultiverseWorld::getTabCompleteName)
282-
.map(StringFormatter::quoteMultiWordString)
283282
.toList();
284283
}
285284
case "loaded" -> {
286285
return worldManager.getLoadedWorlds().stream()
287286
.map(MultiverseWorld::getTabCompleteName)
288-
.map(StringFormatter::quoteMultiWordString)
289287
.toList();
290288
}
291289
case "unloaded" -> {
292290
return worldManager.getUnloadedWorlds().stream()
293291
.map(MultiverseWorld::getTabCompleteName)
294-
.map(StringFormatter::quoteMultiWordString)
295292
.toList();
296293
}
297294
case "potential" -> {

src/main/java/org/mvplugins/multiverse/core/command/MVRootCommand.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public BaseCommand execute(CommandIssuer sender, String commandLabel, String[] a
2222
@Override
2323
public List<String> getTabCompletions(CommandIssuer sender, String alias, String[] args, boolean commandsOnly, boolean isAsync) {
2424
String[] quoteFormatedArgs = StringFormatter.parseQuotesInArgs(args).toArray(String[]::new);
25-
return super.getTabCompletions(sender, alias, quoteFormatedArgs, commandsOnly, isAsync);
25+
return super.getTabCompletions(sender, alias, quoteFormatedArgs, commandsOnly, isAsync)
26+
.stream()
27+
.map(StringFormatter::quoteMultiWordString)
28+
.toList();
2629
}
2730
}

src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import com.dumptruckman.minecraft.util.Logging;
1818
import com.google.common.base.Strings;
19+
import io.papermc.lib.PaperLib;
1920
import io.vavr.control.Option;
2021
import io.vavr.control.Try;
2122
import jakarta.inject.Inject;
@@ -379,7 +380,7 @@ private LoadedMultiverseWorld newLoadedMultiverseWorld(
379380
// Properties from the bukkit world
380381
worldConfig.setDifficulty(world.getDifficulty());
381382
worldConfig.setKeepSpawnInMemory(world.getKeepSpawnInMemory());
382-
worldConfig.setScale(world.getCoordinateScale());
383+
worldConfig.setScale(getCoordinateScale(world));
383384

384385
worldConfig.save();
385386

@@ -398,6 +399,17 @@ private LoadedMultiverseWorld newLoadedMultiverseWorld(
398399
return loadedWorld;
399400
}
400401

402+
private double getCoordinateScale(World world) {
403+
if (PaperLib.isPaper()) {
404+
return world.getCoordinateScale();
405+
}
406+
return switch (world.getEnvironment()) {
407+
case NORMAL -> 1;
408+
case NETHER -> 8;
409+
default -> 1;
410+
};
411+
}
412+
401413
/**
402414
* Loads an existing world in config.
403415
*

src/main/java/org/mvplugins/multiverse/core/world/entity/SpawnCategoryConfig.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,12 @@ private <N extends Node> N node(N node) {
167167
final ConfigNode<Integer> tickRate = node(ConfigNode.builder("tick-rate", Integer.class)
168168
.defaultValue(-1)
169169
.suggester(input -> List.of("-1", "10", "100", "400", "1000"))
170-
.validator(input -> config.getApplyEntitySpawnRate()
171-
? Try.success(null)
172-
: Try.failure(new IllegalStateException("Cannot set tick rate as 'apply-entity-spawn-rate' is false in config. " +
173-
"You can re-enable this option with '/mv config set apply-entity-spawn-rate true' command.")))
174170
.onSetValue((oldValue, newValue) -> applyConfigToWorld())
175171
.build());
176172

177173
final ConfigNode<Integer> spawnLimit = node(ConfigNode.builder("spawn-limit", Integer.class)
178174
.defaultValue(-1)
179175
.suggester(input -> List.of("-1", "10", "100", "400", "1000"))
180-
.validator(input -> config.getApplyEntitySpawnLimit()
181-
? Try.success(null)
182-
: Try.failure(new IllegalStateException("Cannot set spawn limit as 'apply-entity-spawn-limit' is false in config. " +
183-
"You can re-enable this option with '/mv config set apply-entity-spawn-limit true' command.")))
184176
.onSetValue((oldValue, newValue) -> applyConfigToWorld())
185177
.build());
186178

0 commit comments

Comments
 (0)