Merge pull request #3004 from Multiverse/dtm/mv5/world-revamp-continue-tweaks

Tweaks for world revamp
This commit is contained in:
Jeremy Wood 2023-09-09 11:19:22 -04:00 committed by GitHub
commit 34b55e4b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 79 additions and 82 deletions

View File

@ -451,6 +451,7 @@
value="Method type name ''{0}'' must match pattern ''{1}''."/> value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module> </module>
<module name="PackageName"> <module name="PackageName">
<property name="severity" value="info"/>
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern" <message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/> value="Package name ''{0}'' must match pattern ''{1}''."/>

View File

@ -5,7 +5,10 @@ import com.google.common.base.Strings;
import com.onarandombox.MultiverseCore.api.BlockSafety; import com.onarandombox.MultiverseCore.api.BlockSafety;
import com.onarandombox.MultiverseCore.api.LocationManipulation; import com.onarandombox.MultiverseCore.api.LocationManipulation;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter; import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.message.MessageReplacement;
import com.onarandombox.MultiverseCore.utils.result.FailureReason;
import com.onarandombox.MultiverseCore.utils.result.Result; import com.onarandombox.MultiverseCore.utils.result.Result;
import com.onarandombox.MultiverseCore.utils.result.SuccessReason;
import com.onarandombox.MultiverseCore.worldnew.config.WorldConfig; import com.onarandombox.MultiverseCore.worldnew.config.WorldConfig;
import com.onarandombox.MultiverseCore.worldnew.config.WorldsConfigManager; import com.onarandombox.MultiverseCore.worldnew.config.WorldsConfigManager;
import com.onarandombox.MultiverseCore.worldnew.generators.GeneratorProvider; import com.onarandombox.MultiverseCore.worldnew.generators.GeneratorProvider;
@ -54,8 +57,6 @@ import static com.onarandombox.MultiverseCore.worldnew.helpers.DataStore.WorldCo
@Service @Service
public class WorldManager { public class WorldManager {
private static final String WORLD_PLACEHOLDER = "{world}";
private static final String ERROR_PLACEHOLDER = "{error}";
private static final List<String> CLONE_IGNORE_FILES = Arrays.asList("uid.dat", "session.lock"); private static final List<String> CLONE_IGNORE_FILES = Arrays.asList("uid.dat", "session.lock");
private final Map<String, MultiverseWorld> worldsMap; private final Map<String, MultiverseWorld> worldsMap;
@ -167,21 +168,17 @@ public class WorldManager {
public Result<CreateWorldResult.Success, CreateWorldResult.Failure> createWorld(CreateWorldOptions options) { public Result<CreateWorldResult.Success, CreateWorldResult.Failure> createWorld(CreateWorldOptions options) {
// Params validations // Params validations
if (!worldNameChecker.isValidWorldName(options.worldName())) { if (!worldNameChecker.isValidWorldName(options.worldName())) {
return Result.failure(CreateWorldResult.Failure.INVALID_WORLDNAME, return worldActionResult(CreateWorldResult.Failure.INVALID_WORLDNAME, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
if (getLoadedWorld(options.worldName()).isDefined()) { if (getLoadedWorld(options.worldName()).isDefined()) {
return Result.failure(CreateWorldResult.Failure.WORLD_EXIST_LOADED, return worldActionResult(CreateWorldResult.Failure.WORLD_EXIST_LOADED, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
if (getWorld(options.worldName()).isDefined()) { if (getWorld(options.worldName()).isDefined()) {
return Result.failure(CreateWorldResult.Failure.WORLD_EXIST_UNLOADED, return worldActionResult(CreateWorldResult.Failure.WORLD_EXIST_UNLOADED, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
File worldFolder = new File(Bukkit.getWorldContainer(), options.worldName()); File worldFolder = new File(Bukkit.getWorldContainer(), options.worldName());
if (worldFolder.exists()) { if (worldFolder.exists()) {
return Result.failure(CreateWorldResult.Failure.WORLD_EXIST_FOLDER, return worldActionResult(CreateWorldResult.Failure.WORLD_EXIST_FOLDER, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
String parsedGenerator = parseGenerator(options.worldName(), options.generator()); String parsedGenerator = parseGenerator(options.worldName(), options.generator());
@ -192,16 +189,15 @@ public class WorldManager {
.seed(options.seed()) .seed(options.seed())
.type(options.worldType())) .type(options.worldType()))
.fold( .fold(
exception -> Result.failure(CreateWorldResult.Failure.BUKKIT_CREATION_FAILED, exception -> worldActionResult(CreateWorldResult.Failure.BUKKIT_CREATION_FAILED,
replace(WORLD_PLACEHOLDER).with(options.worldName()), options.worldName(), exception.getMessage()),
replace(ERROR_PLACEHOLDER).with(exception.getMessage())),
world -> { world -> {
newLoadedMultiverseWorld(world, parsedGenerator, options.useSpawnAdjust()); newLoadedMultiverseWorld(world, parsedGenerator, options.useSpawnAdjust());
return Result.success(CreateWorldResult.Success.CREATED, return worldActionResult(CreateWorldResult.Success.CREATED, world.getName());
replace(WORLD_PLACEHOLDER).with(world.getName()));
}); });
} }
/** /**
* Imports an existing world folder. * Imports an existing world folder.
* *
@ -211,20 +207,16 @@ public class WorldManager {
public Result<ImportWorldResult.Success, ImportWorldResult.Failure> importWorld(ImportWorldOptions options) { public Result<ImportWorldResult.Success, ImportWorldResult.Failure> importWorld(ImportWorldOptions options) {
// Params validations // Params validations
if (!worldNameChecker.isValidWorldName(options.worldName())) { if (!worldNameChecker.isValidWorldName(options.worldName())) {
return Result.failure(ImportWorldResult.Failure.INVALID_WORLDNAME, return worldActionResult(ImportWorldResult.Failure.INVALID_WORLDNAME, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
if (!worldNameChecker.isValidWorldFolder(options.worldName())) { if (!worldNameChecker.isValidWorldFolder(options.worldName())) {
return Result.failure(ImportWorldResult.Failure.WORLD_FOLDER_INVALID, return worldActionResult(ImportWorldResult.Failure.WORLD_FOLDER_INVALID, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
if (isLoadedWorld(options.worldName())) { if (isLoadedWorld(options.worldName())) {
return Result.failure(ImportWorldResult.Failure.WORLD_EXIST_LOADED, return worldActionResult(ImportWorldResult.Failure.WORLD_EXIST_LOADED, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
if (isWorld(options.worldName())) { if (isWorld(options.worldName())) {
return Result.failure(ImportWorldResult.Failure.WORLD_EXIST_UNLOADED, return worldActionResult(ImportWorldResult.Failure.WORLD_EXIST_UNLOADED, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
} }
String parsedGenerator = parseGenerator(options.worldName(), options.generator()); String parsedGenerator = parseGenerator(options.worldName(), options.generator());
@ -232,13 +224,11 @@ public class WorldManager {
.environment(options.environment()) .environment(options.environment())
.generator(parsedGenerator)) .generator(parsedGenerator))
.fold( .fold(
exception -> Result.failure(ImportWorldResult.Failure.BUKKIT_CREATION_FAILED, exception -> worldActionResult(ImportWorldResult.Failure.BUKKIT_CREATION_FAILED,
replace(WORLD_PLACEHOLDER).with(options.worldName()), options.worldName(), exception.getMessage()),
replace(ERROR_PLACEHOLDER).with(exception.getMessage())),
world -> { world -> {
newLoadedMultiverseWorld(world, parsedGenerator, options.useSpawnAdjust()); newLoadedMultiverseWorld(world, parsedGenerator, options.useSpawnAdjust());
return Result.success(ImportWorldResult.Success.IMPORTED, return worldActionResult(ImportWorldResult.Success.IMPORTED, options.worldName());
replace(WORLD_PLACEHOLDER).with(options.worldName()));
}); });
} }
@ -290,10 +280,8 @@ public class WorldManager {
return getWorld(worldName) return getWorld(worldName)
.map(this::loadWorld) .map(this::loadWorld)
.getOrElse(() -> worldNameChecker.isValidWorldFolder(worldName) .getOrElse(() -> worldNameChecker.isValidWorldFolder(worldName)
? Result.failure(LoadWorldResult.Failure.WORLD_EXIST_FOLDER, ? worldActionResult(LoadWorldResult.Failure.WORLD_EXIST_FOLDER, worldName)
replace(WORLD_PLACEHOLDER).with(worldName)) : worldActionResult(LoadWorldResult.Failure.WORLD_NON_EXISTENT, worldName));
: Result.failure(LoadWorldResult.Failure.WORLD_NON_EXISTENT,
replace(WORLD_PLACEHOLDER).with(worldName)));
} }
/** /**
@ -307,22 +295,19 @@ public class WorldManager {
if (loadTracker.contains(mvWorld.getName())) { if (loadTracker.contains(mvWorld.getName())) {
// This is to prevent recursive calls by WorldLoadEvent // This is to prevent recursive calls by WorldLoadEvent
Logging.fine("World already loading: " + mvWorld.getName()); Logging.fine("World already loading: " + mvWorld.getName());
return Result.failure(LoadWorldResult.Failure.WORLD_ALREADY_LOADING, return worldActionResult(LoadWorldResult.Failure.WORLD_ALREADY_LOADING, mvWorld.getName());
replace(WORLD_PLACEHOLDER).with(mvWorld.getName()));
} }
if (isLoadedWorld(mvWorld)) { if (isLoadedWorld(mvWorld)) {
Logging.severe("World already loaded: " + mvWorld.getName()); Logging.severe("World already loaded: " + mvWorld.getName());
return Result.failure(LoadWorldResult.Failure.WORLD_EXIST_LOADED, return worldActionResult(LoadWorldResult.Failure.WORLD_EXIST_LOADED, mvWorld.getName());
replace(WORLD_PLACEHOLDER).with(mvWorld.getName()));
} }
return createBukkitWorld(WorldCreator.name(mvWorld.getName()) return createBukkitWorld(WorldCreator.name(mvWorld.getName())
.environment(mvWorld.getEnvironment()) .environment(mvWorld.getEnvironment())
.generator(Strings.isNullOrEmpty(mvWorld.getGenerator()) ? null : mvWorld.getGenerator()) .generator(Strings.isNullOrEmpty(mvWorld.getGenerator()) ? null : mvWorld.getGenerator())
.seed(mvWorld.getSeed())).fold( .seed(mvWorld.getSeed())).fold(
exception -> Result.failure(LoadWorldResult.Failure.BUKKIT_CREATION_FAILED, exception -> worldActionResult(LoadWorldResult.Failure.BUKKIT_CREATION_FAILED,
replace(WORLD_PLACEHOLDER).with(mvWorld.getName()), mvWorld.getName(), exception.getMessage()),
replace(ERROR_PLACEHOLDER).with(exception.getMessage())),
world -> { world -> {
// TODO: Check worldConfig null // TODO: Check worldConfig null
WorldConfig worldConfig = worldsConfigManager.getWorldConfig(mvWorld.getName()); WorldConfig worldConfig = worldsConfigManager.getWorldConfig(mvWorld.getName());
@ -334,8 +319,7 @@ public class WorldManager {
locationManipulation); locationManipulation);
loadedWorldsMap.put(loadedWorld.getName(), loadedWorld); loadedWorldsMap.put(loadedWorld.getName(), loadedWorld);
saveWorldsConfig(); saveWorldsConfig();
return Result.success(LoadWorldResult.Success.LOADED, return worldActionResult(LoadWorldResult.Success.LOADED, loadedWorld.getName());
replace(WORLD_PLACEHOLDER).with(loadedWorld.getName()));
}); });
} }
@ -359,10 +343,8 @@ public class WorldManager {
return getLoadedWorld(worldName) return getLoadedWorld(worldName)
.map(this::unloadWorld) .map(this::unloadWorld)
.getOrElse(() -> isUnloadedWorld(worldName) .getOrElse(() -> isUnloadedWorld(worldName)
? Result.failure(UnloadWorldResult.Failure.WORLD_UNLOADED, ? worldActionResult(UnloadWorldResult.Failure.WORLD_UNLOADED, worldName)
replace(WORLD_PLACEHOLDER).with(worldName)) : worldActionResult(UnloadWorldResult.Failure.WORLD_NON_EXISTENT, worldName));
: Result.failure(UnloadWorldResult.Failure.WORLD_NON_EXISTENT,
replace(WORLD_PLACEHOLDER).with(worldName)));
} }
/** /**
@ -376,27 +358,23 @@ public class WorldManager {
if (unloadTracker.contains(world.getName())) { if (unloadTracker.contains(world.getName())) {
// This is to prevent recursive calls by WorldUnloadEvent // This is to prevent recursive calls by WorldUnloadEvent
Logging.fine("World already unloading: " + world.getName()); Logging.fine("World already unloading: " + world.getName());
return Result.failure(UnloadWorldResult.Failure.WORLD_ALREADY_UNLOADING, return worldActionResult(UnloadWorldResult.Failure.WORLD_ALREADY_UNLOADING, world.getName());
replace(WORLD_PLACEHOLDER).with(world.getName()));
} }
// TODO: removePlayersFromWorld? // TODO: removePlayersFromWorld?
return unloadBukkitWorld(world.getBukkitWorld().getOrNull()).fold( return unloadBukkitWorld(world.getBukkitWorld().getOrNull()).fold(
exception -> Result.failure(UnloadWorldResult.Failure.BUKKIT_UNLOAD_FAILED, exception -> worldActionResult(UnloadWorldResult.Failure.BUKKIT_UNLOAD_FAILED,
replace(WORLD_PLACEHOLDER).with(world.getName()), world.getName(), exception.getMessage()),
replace(ERROR_PLACEHOLDER).with(exception.getMessage())),
success -> Option.of(loadedWorldsMap.remove(world.getName())).fold( success -> Option.of(loadedWorldsMap.remove(world.getName())).fold(
() -> { () -> {
Logging.severe("Failed to remove world from map: " + world.getName()); Logging.severe("Failed to remove world from map: " + world.getName());
return Result.failure(UnloadWorldResult.Failure.WORLD_NON_EXISTENT, return worldActionResult(UnloadWorldResult.Failure.WORLD_NON_EXISTENT, world.getName());
replace(WORLD_PLACEHOLDER).with(world.getName()));
}, },
mvWorld -> { mvWorld -> {
Logging.fine("Removed MultiverseWorld from map: " + world.getName()); Logging.fine("Removed MultiverseWorld from map: " + world.getName());
mvWorld.getWorldConfig().deferenceMVWorld(); mvWorld.getWorldConfig().deferenceMVWorld();
return Result.success(UnloadWorldResult.Success.UNLOADED, return worldActionResult(UnloadWorldResult.Success.UNLOADED, world.getName());
replace(WORLD_PLACEHOLDER).with(world.getName()));
})); }));
} }
@ -411,8 +389,7 @@ public class WorldManager {
removeWorld(@NotNull String worldName) { removeWorld(@NotNull String worldName) {
return getWorld(worldName) return getWorld(worldName)
.map(this::removeWorld) .map(this::removeWorld)
.getOrElse(() -> Result.failure(RemoveWorldResult.Failure.WORLD_NON_EXISTENT, .getOrElse(() -> worldActionResult(RemoveWorldResult.Failure.WORLD_NON_EXISTENT, worldName));
replace(WORLD_PLACEHOLDER).with(worldName)));
} }
/** /**
@ -470,8 +447,7 @@ public class WorldManager {
public Result<DeleteWorldResult.Success, DeleteWorldResult.Failure> deleteWorld(@NotNull String worldName) { public Result<DeleteWorldResult.Success, DeleteWorldResult.Failure> deleteWorld(@NotNull String worldName) {
return getWorld(worldName) return getWorld(worldName)
.map(this::deleteWorld) .map(this::deleteWorld)
.getOrElse(() -> Result.failure(DeleteWorldResult.Failure.WORLD_NON_EXISTENT, .getOrElse(() -> worldActionResult(DeleteWorldResult.Failure.WORLD_NON_EXISTENT, worldName));
replace(WORLD_PLACEHOLDER).with(worldName)));
} }
/** /**
@ -486,8 +462,7 @@ public class WorldManager {
() -> { () -> {
var result = loadWorld(world); var result = loadWorld(world);
if (result.isFailure()) { if (result.isFailure()) {
return Result.failure(DeleteWorldResult.Failure.LOAD_FAILED, return worldActionResult(DeleteWorldResult.Failure.LOAD_FAILED, world.getName());
replace(WORLD_PLACEHOLDER).with(world.getName()));
} }
return deleteWorld(world); return deleteWorld(world);
}, },
@ -505,8 +480,7 @@ public class WorldManager {
File worldFolder = world.getBukkitWorld().map(World::getWorldFolder).getOrNull(); File worldFolder = world.getBukkitWorld().map(World::getWorldFolder).getOrNull();
if (worldFolder == null || !worldNameChecker.isValidWorldFolder(worldFolder)) { if (worldFolder == null || !worldNameChecker.isValidWorldFolder(worldFolder)) {
Logging.severe("Failed to get world folder for world: " + world.getName()); Logging.severe("Failed to get world folder for world: " + world.getName());
return Result.failure(DeleteWorldResult.Failure.WORLD_FOLDER_NOT_FOUND, return worldActionResult(DeleteWorldResult.Failure.WORLD_FOLDER_NOT_FOUND, world.getName());
replace(WORLD_PLACEHOLDER).with(world.getName()));
} }
var result = removeWorld(world); var result = removeWorld(world);
@ -517,11 +491,9 @@ public class WorldManager {
// Erase world files from disk // Erase world files from disk
// TODO: Possible config options to keep certain files // TODO: Possible config options to keep certain files
return filesManipulator.deleteFolder(worldFolder).fold( return filesManipulator.deleteFolder(worldFolder).fold(
exception -> Result.failure(DeleteWorldResult.Failure.FAILED_TO_DELETE_FOLDER, exception -> worldActionResult(DeleteWorldResult.Failure.FAILED_TO_DELETE_FOLDER,
replace(WORLD_PLACEHOLDER).with(world.getName()), world.getName(), exception.getMessage()),
replace(ERROR_PLACEHOLDER).with(exception.getMessage())), success -> worldActionResult(DeleteWorldResult.Success.DELETED, world.getName()));
success -> Result.success(DeleteWorldResult.Success.DELETED,
replace(WORLD_PLACEHOLDER).with(world.getName())));
} }
/** /**
@ -542,13 +514,12 @@ public class WorldManager {
failure.getReasonMessage()), failure.getReasonMessage()),
success -> Result.success())) success -> Result.success()))
.onSuccessThen(s -> getLoadedWorld(options.newWorldName()).fold( .onSuccessThen(s -> getLoadedWorld(options.newWorldName()).fold(
() -> Result.failure(CloneWorldResult.Failure.MV_WORLD_FAILED, () -> worldActionResult(CloneWorldResult.Failure.MV_WORLD_FAILED, options.newWorldName()),
replace(WORLD_PLACEHOLDER).with(options.newWorldName())),
mvWorld -> { mvWorld -> {
cloneWorldTransferData(options, mvWorld); cloneWorldTransferData(options, mvWorld);
saveWorldsConfig(); saveWorldsConfig();
return Result.success(CloneWorldResult.Success.CLONED, return Result.success(CloneWorldResult.Success.CLONED,
replace(WORLD_PLACEHOLDER).with(options.world().getName()), replaceWorldName(options.world().getName()),
replace("{newworld}").with(mvWorld.getName())); replace("{newworld}").with(mvWorld.getName()));
})); }));
} }
@ -558,22 +529,18 @@ public class WorldManager {
String newWorldName = options.newWorldName(); String newWorldName = options.newWorldName();
if (!worldNameChecker.isValidWorldName(newWorldName)) { if (!worldNameChecker.isValidWorldName(newWorldName)) {
Logging.severe("Invalid world name: " + newWorldName); Logging.severe("Invalid world name: " + newWorldName);
return Result.failure(CloneWorldResult.Failure.INVALID_WORLDNAME, return worldActionResult(CloneWorldResult.Failure.INVALID_WORLDNAME, newWorldName);
replace(WORLD_PLACEHOLDER).with(newWorldName));
} }
if (worldNameChecker.isValidWorldFolder(newWorldName)) { if (worldNameChecker.isValidWorldFolder(newWorldName)) {
return Result.failure(CloneWorldResult.Failure.WORLD_EXIST_FOLDER, return worldActionResult(CloneWorldResult.Failure.WORLD_EXIST_FOLDER, newWorldName);
replace(WORLD_PLACEHOLDER).with(newWorldName));
} }
if (isLoadedWorld(newWorldName)) { if (isLoadedWorld(newWorldName)) {
Logging.severe("World already loaded when attempting to clone: " + newWorldName); Logging.severe("World already loaded when attempting to clone: " + newWorldName);
return Result.failure(CloneWorldResult.Failure.WORLD_EXIST_LOADED, return worldActionResult(CloneWorldResult.Failure.WORLD_EXIST_LOADED, newWorldName);
replace(WORLD_PLACEHOLDER).with(newWorldName));
} }
if (isWorld(newWorldName)) { if (isWorld(newWorldName)) {
Logging.severe("World already exist unloaded: " + newWorldName); Logging.severe("World already exist unloaded: " + newWorldName);
return Result.failure(CloneWorldResult.Failure.WORLD_EXIST_UNLOADED, return worldActionResult(CloneWorldResult.Failure.WORLD_EXIST_UNLOADED, newWorldName);
replace(WORLD_PLACEHOLDER).with(newWorldName));
} }
return Result.success(); return Result.success();
} }
@ -584,9 +551,8 @@ public class WorldManager {
File worldFolder = options.world().getBukkitWorld().map(World::getWorldFolder).getOrNull(); File worldFolder = options.world().getBukkitWorld().map(World::getWorldFolder).getOrNull();
File newWorldFolder = new File(Bukkit.getWorldContainer(), options.newWorldName()); File newWorldFolder = new File(Bukkit.getWorldContainer(), options.newWorldName());
return filesManipulator.copyFolder(worldFolder, newWorldFolder, CLONE_IGNORE_FILES).fold( return filesManipulator.copyFolder(worldFolder, newWorldFolder, CLONE_IGNORE_FILES).fold(
exception -> Result.failure(CloneWorldResult.Failure.COPY_FAILED, exception -> worldActionResult(CloneWorldResult.Failure.COPY_FAILED, options.world().getName(),
replace(WORLD_PLACEHOLDER).with(options.world().getName()), exception.getMessage()),
replace(ERROR_PLACEHOLDER).with(exception.getMessage())),
success -> Result.success()); success -> Result.success());
} }
@ -647,7 +613,30 @@ public class WorldManager {
dataTransfer.pasteAllTo(newWorld); dataTransfer.pasteAllTo(newWorld);
saveWorldsConfig(); saveWorldsConfig();
}); });
return Result.success(RegenWorldResult.Success.REGENERATED, replace(WORLD_PLACEHOLDER).with(world.getName())); return worldActionResult(RegenWorldResult.Success.REGENERATED, world.getName());
}
private <F extends FailureReason, S extends SuccessReason> Result<S, F> worldActionResult(
@NotNull S messageKeyProvider, @NotNull String worldName) {
return Result.success(messageKeyProvider, replaceWorldName(worldName));
}
private <F extends FailureReason, S extends SuccessReason> Result<S, F> worldActionResult(
@NotNull F messageKeyProvider, @NotNull String worldName) {
return Result.failure(messageKeyProvider, replaceWorldName(worldName));
}
private <F extends FailureReason, S extends SuccessReason> Result<S, F> worldActionResult(
@NotNull F messageKeyProvider, @NotNull String worldName, @NotNull String errorMessage) {
return Result.failure(messageKeyProvider, replaceWorldName(worldName), replaceError(errorMessage));
}
private MessageReplacement replaceWorldName(@NotNull String worldName) {
return replace("{world}").with(worldName);
}
private MessageReplacement replaceError(@NotNull String errorMessage) {
return replace("{error}").with(errorMessage);
} }
/** /**

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew.config;

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew.entrycheck;

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew.generators;

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew.helpers;

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew.options;

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew;

View File

@ -0,0 +1 @@
package com.onarandombox.MultiverseCore.worldnew.results;