diff --git a/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java b/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java index a94e2f29..de522455 100644 --- a/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java +++ b/src/main/java/org/mvplugins/multiverse/core/world/WorldManager.java @@ -119,8 +119,8 @@ public class WorldManager { */ private Try updateWorldsFromConfig() { return worldsConfigManager.load().mapTry(result -> { - loadNewWorldConfigs(result._1()); - removeWorldsNotInConfigs(result._2()); + loadNewWorldConfigs(result.newWorlds()); + removeWorldsNotInConfigs(result.removedWorlds()); return null; }); } diff --git a/src/main/java/org/mvplugins/multiverse/core/world/config/NewAndRemovedWorlds.java b/src/main/java/org/mvplugins/multiverse/core/world/config/NewAndRemovedWorlds.java new file mode 100644 index 00000000..7f56bdf6 --- /dev/null +++ b/src/main/java/org/mvplugins/multiverse/core/world/config/NewAndRemovedWorlds.java @@ -0,0 +1,12 @@ +package org.mvplugins.multiverse.core.world.config; + +import java.util.List; + +/** + * A record containing a list of the new WorldConfigs added and a list of the worlds removed from the config. + * + * @param newWorlds List of the new WorldConfigs added + * @param removedWorlds List of the worlds removed from the config + */ +public record NewAndRemovedWorlds(List newWorlds, List removedWorlds) { +} diff --git a/src/main/java/org/mvplugins/multiverse/core/world/config/WorldsConfigManager.java b/src/main/java/org/mvplugins/multiverse/core/world/config/WorldsConfigManager.java index 2bd1263f..e0cdaf91 100644 --- a/src/main/java/org/mvplugins/multiverse/core/world/config/WorldsConfigManager.java +++ b/src/main/java/org/mvplugins/multiverse/core/world/config/WorldsConfigManager.java @@ -47,9 +47,9 @@ public final class WorldsConfigManager { /** * Loads the worlds.yml file and creates a WorldConfig for each world in the file if it doesn't already exist. * - * @return A tuple containing a list of the new WorldConfigs added and a list of the worlds removed from the config. + * @return A {@link NewAndRemovedWorlds} record. */ - public Try, List>> load() { + public Try load() { return Try.of(() -> { loadWorldYmlFile(); return parseNewAndRemovedWorlds(); @@ -116,7 +116,7 @@ public final class WorldsConfigManager { * * @return A tuple containing a list of the new WorldConfigs added and a list of the worlds removed from the config. */ - private Tuple2, List> parseNewAndRemovedWorlds() { + private NewAndRemovedWorlds parseNewAndRemovedWorlds() { Set allWorldsInConfig = worldsConfig.getKeys(false); List newWorldsAdded = new ArrayList<>(); @@ -141,7 +141,7 @@ public final class WorldsConfigManager { worldConfigMap.remove(s); } - return new Tuple2<>(newWorldsAdded, worldsRemoved); + return new NewAndRemovedWorlds(newWorldsAdded, worldsRemoved); } /**