From 0f3fd89228458716f2a72a1a8b8e4080b542baca Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sun, 15 Jan 2012 13:15:01 -0700 Subject: [PATCH] Add new WorldTypes to Multiverse This closed #394 --- pom.xml | 2 +- .../onarandombox/MultiverseCore/MVWorld.java | 13 ++++ .../MultiverseCore/MultiverseCore.java | 28 --------- .../MultiverseCore/api/MVWorldManager.java | 7 ++- .../MultiverseCore/api/MultiverseWorld.java | 15 ++++- .../commands/CreateCommand.java | 19 +++++- .../commands/EnvironmentCommand.java | 63 ++++++++++++++++++- .../commands/ImportCommand.java | 19 +++++- .../MultiverseCore/utils/WorldManager.java | 50 ++++++++------- .../test/utils/MockWorldFactory.java | 12 ++-- .../test/utils/TestInstanceCreator.java | 2 +- 11 files changed, 161 insertions(+), 69 deletions(-) diff --git a/pom.xml b/pom.xml index 88058d8c..146295f7 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,7 @@ org.bukkit bukkit - 1.0.0-R1-SNAPSHOT + 1.1-R1-SNAPSHOT jar compile diff --git a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java index a91775d7..74c2fad0 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java @@ -23,6 +23,7 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.World.Environment; +import org.bukkit.WorldType; import org.bukkit.command.CommandSender; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; @@ -68,6 +69,7 @@ public class MVWorld implements MultiverseWorld { private Permission ignoreperm; private static final Map TIME_ALIASES; + private WorldType type; static { Map staticTimes = new HashMap(); @@ -90,6 +92,7 @@ public class MVWorld implements MultiverseWorld { this.name = world.getName(); this.seed = seed; this.environment = world.getEnvironment(); + this.type = world.getWorldType(); // Initialize our lists this.initLists(); @@ -107,6 +110,8 @@ public class MVWorld implements MultiverseWorld { } worldSection.set("environment", this.environment.toString()); + worldSection.set("type", this.type.toString()); + // Start NEW config awesomeness. ConfigPropertyFactory fac = new ConfigPropertyFactory(this.worldSection); this.propertyList = new HashMap>(); @@ -1145,6 +1150,14 @@ public class MVWorld implements MultiverseWorld { return String.format("%d:%02d", hours, minutes); } + /** + * {@inheritDoc} + */ + @Override + public WorldType getWorldType() { + return this.type; + } + /** * Used by the active time-property to set the "actual" property. * @return True if the property was successfully set. diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 59bcd135..60b44ecb 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -38,7 +38,6 @@ import com.onarandombox.MultiverseCore.utils.WorldManager; import com.pneumaticraft.commandhandler.CommandHandler; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.World.Environment; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.Configuration; @@ -582,33 +581,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { return MultiverseCore.LOG_TAG; } - // TODO This code should get moved somewhere more appropriate, but for now, it's here. - // TODO oh, and it should be static. - /** - * Converts a {@link String} into an {@link Environment}. - * - * @param env The environment as {@link String} - * @return The environment as {@link Environment} - */ - public Environment getEnvFromString(String env) { - // Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way - if (env.equalsIgnoreCase("HELL") || env.equalsIgnoreCase("NETHER")) - env = "NETHER"; - - if (env.equalsIgnoreCase("END") || env.equalsIgnoreCase("THEEND") || env.equalsIgnoreCase("STARWARS")) - env = "THE_END"; - - if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD")) - env = "NORMAL"; - - try { - // If the value wasn't found, maybe it's new, try checking the enum directly. - return Environment.valueOf(env); - } catch (IllegalArgumentException e) { - return null; - } - } - /** * Shows a message that the given world is not a MultiverseWorld. * diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java index 75cc9da7..40300ef0 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java @@ -10,6 +10,7 @@ package com.onarandombox.MultiverseCore.api; import com.onarandombox.MultiverseCore.utils.PurgeWorlds; import org.bukkit.World; import org.bukkit.World.Environment; +import org.bukkit.WorldType; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.generator.ChunkGenerator; @@ -32,10 +33,11 @@ public interface MVWorldManager { * @param seedString The seed in the form of a string. * If the seed is a Long, * it will be interpreted as such. + * @param type The Type of the world to be made. * @param generator The Custom generator plugin to use. * @return True if the world is added, false if not. */ - boolean addWorld(String name, Environment env, String seedString, String generator); + boolean addWorld(String name, Environment env, String seedString, WorldType type, String generator); /** * Add a new World to the Multiverse Setup. @@ -45,11 +47,12 @@ public interface MVWorldManager { * @param seedString The seed in the form of a string. * If the seed is a Long, * it will be interpreted as such. + * @param type The Type of the world to be made. * @param generator The Custom generator plugin to use. * @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat. * @return True if the world is added, false if not. */ - boolean addWorld(String name, Environment env, String seedString, String generator, boolean useSpawnAdjust); + boolean addWorld(String name, Environment env, String seedString, WorldType type, String generator, boolean useSpawnAdjust); /** * Remove the world from the Multiverse list, from the diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java b/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java index 7d878328..1b2cca3f 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java +++ b/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseWorld.java @@ -15,6 +15,7 @@ import org.bukkit.Difficulty; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; +import org.bukkit.WorldType; import org.bukkit.command.CommandSender; import org.bukkit.permissions.Permission; @@ -22,8 +23,6 @@ import java.util.List; /** * The API for a Multiverse Handled World. - *

- * Currently INCOMPLETE */ public interface MultiverseWorld { @@ -536,7 +535,7 @@ public interface MultiverseWorld { /** * Sets the current time in a world. - * + *

* This method will take the following formats: * 11:37am * 4:30p @@ -552,4 +551,14 @@ public interface MultiverseWorld { * @return The time as a short string: 12:34pm */ String getTime(); + + /** + * Gets the type of this world. As of 1.1-R1 this will be: + * FLAT or NORMAL + *

+ * This is *not* the generator. + * + * @return The Type of this world. + */ + WorldType getWorldType(); } diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java index e6613c17..4479b753 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java @@ -12,6 +12,7 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager; import com.pneumaticraft.commandhandler.CommandHandler; import org.bukkit.ChatColor; import org.bukkit.World.Environment; +import org.bukkit.WorldType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; @@ -28,7 +29,7 @@ public class CreateCommand extends MultiverseCommand { public CreateCommand(MultiverseCore plugin) { super(plugin); this.setName("Create World"); - this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]] [-n]"); + this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]] -t [WORLDTYPE] [-n]"); this.setArgRange(2, 7); // SUPPRESS CHECKSTYLE: MagicNumberCheck this.addKey("mvcreate"); this.addKey("mvc"); @@ -49,6 +50,7 @@ public class CreateCommand extends MultiverseCommand { String env = args.get(1); String seed = CommandHandler.getFlag("-s", args); String generator = CommandHandler.getFlag("-g", args); + String typeString = CommandHandler.getFlag("-t", args); boolean useSpawnAdjust = true; for (String s : args) { if (s.equalsIgnoreCase("-n")) { @@ -61,16 +63,27 @@ public class CreateCommand extends MultiverseCommand { return; } - Environment environment = this.plugin.getEnvFromString(env); + Environment environment = EnvironmentCommand.getEnvFromString(env); if (environment == null) { sender.sendMessage(ChatColor.RED + "That is not a valid environment."); EnvironmentCommand.showEnvironments(sender); return; } + // If they didn't specify a type, default to NORMAL + if (typeString == null) { + typeString = "NORMAL"; + } + WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString); + if (type == null) { + sender.sendMessage(ChatColor.RED + "That is not a valid World Type."); + EnvironmentCommand.showWorldTypes(sender); + return; + } + Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'..."); - if (this.worldManager.addWorld(worldName, environment, seed, generator, useSpawnAdjust)) { + if (this.worldManager.addWorld(worldName, environment, seed, type, generator, useSpawnAdjust)) { Command.broadcastCommandMessage(sender, "Complete!"); } else { Command.broadcastCommandMessage(sender, "FAILED."); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java index 5612340c..4531b39e 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java @@ -9,6 +9,8 @@ package com.onarandombox.MultiverseCore.commands; import com.onarandombox.MultiverseCore.MultiverseCore; import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.WorldType; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; @@ -26,10 +28,11 @@ public class EnvironmentCommand extends MultiverseCommand { this.setArgRange(0, 0); this.addKey("mvenv"); this.addKey("mv env"); + this.addKey("mv type"); this.addKey("mv environment"); this.addKey("mv environments"); this.addCommandExample("/mv env"); - this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP); + this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP); } /** @@ -43,9 +46,67 @@ public class EnvironmentCommand extends MultiverseCommand { sender.sendMessage(ChatColor.RED + "NETHER"); sender.sendMessage(ChatColor.AQUA + "END"); } + /** + * Shows all valid known world types to a {@link CommandSender}. + * + * @param sender The {@link CommandSender}. + */ + public static void showWorldTypes(CommandSender sender) { + sender.sendMessage(ChatColor.YELLOW + "Valid World Types are:"); + sender.sendMessage(String.format("%sNORMAL %sor %sFLAT", + ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA)); + } @Override public void runCommand(CommandSender sender, List args) { EnvironmentCommand.showEnvironments(sender); + EnvironmentCommand.showWorldTypes(sender); + } + + /** + * Converts a {@link String} into a {@link WorldType}. + * + * @param type The WorldType as a {@link String} + * @return The WorldType as a {@link WorldType} + */ + public static WorldType getWorldTypeFromString(String type) { + // Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way + if (type.equalsIgnoreCase("normal")) + type = "NORMAL"; + if (type.equalsIgnoreCase("flat")) + type = "FLAT"; + try { + // Now that we've converted a potentially unfriendly value + // to a friendly one, get it from the ENUM! + return WorldType.valueOf(type); + } catch (IllegalArgumentException e) { + return null; + } + } + + /** + * Converts a {@link String} into an {@link org.bukkit.World.Environment}. + * + * @param env The environment as {@link String} + * @return The environment as {@link org.bukkit.World.Environment} + */ + public static World.Environment getEnvFromString(String env) { + // Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way + if (env.equalsIgnoreCase("HELL") || env.equalsIgnoreCase("NETHER")) + env = "NETHER"; + + if (env.equalsIgnoreCase("END") || env.equalsIgnoreCase("THEEND") || env.equalsIgnoreCase("STARWARS")) + env = "THE_END"; + + if (env.equalsIgnoreCase("NORMAL") || env.equalsIgnoreCase("WORLD")) + env = "NORMAL"; + + try { + // Now that we've converted a potentially unfriendly value + // to a friendly one, get it from the ENUM! + return World.Environment.valueOf(env); + } catch (IllegalArgumentException e) { + return null; + } } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 4c197a0c..a3adcdfe 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -13,6 +13,7 @@ import com.onarandombox.MultiverseCore.api.MultiverseWorld; import com.pneumaticraft.commandhandler.CommandHandler; import org.bukkit.ChatColor; import org.bukkit.World.Environment; +import org.bukkit.WorldType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; @@ -126,6 +127,7 @@ public class ImportCommand extends MultiverseCommand { File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName); String generator = CommandHandler.getFlag("-g", args); + String typeString = CommandHandler.getFlag("-t", args); boolean useSpawnAdjust = true; for (String s : args) { if (s.equalsIgnoreCase("-n")) { @@ -134,16 +136,27 @@ public class ImportCommand extends MultiverseCommand { } String env = args.get(1); - Environment environment = this.plugin.getEnvFromString(env); + Environment environment = EnvironmentCommand.getEnvFromString(env); if (environment == null) { sender.sendMessage(ChatColor.RED + "That is not a valid environment."); EnvironmentCommand.showEnvironments(sender); return; } + // If they didn't specify a type, default to NORMAL + if (typeString == null) { + typeString = "NORMAL"; + } + WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString); + if (type == null) { + sender.sendMessage(ChatColor.RED + "That is not a valid World Type."); + EnvironmentCommand.showWorldTypes(sender); + return; + } + if (worldFile.exists() && env != null) { - Command.broadcastCommandMessage(sender, "Starting import of world '" + worldName + "'..."); - if (this.worldManager.addWorld(worldName, environment, null, generator, useSpawnAdjust)) + Command.broadcastCommandMessage(sender, String.format("Starting import of world '%s'...", worldName)); + if (this.worldManager.addWorld(worldName, environment, null, type, generator, useSpawnAdjust)) Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Complete!"); else Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!"); diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 71390cd8..b8bc41fb 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -11,10 +11,12 @@ import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.api.MVWorldManager; import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import com.onarandombox.MultiverseCore.commands.EnvironmentCommand; import com.onarandombox.MultiverseCore.event.MVWorldDeleteEvent; import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.WorldCreator; +import org.bukkit.WorldType; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -80,16 +82,16 @@ public class WorldManager implements MVWorldManager { * {@inheritDoc} */ @Override - public boolean addWorld(String name, Environment env, String seedString, String generator) { - return this.addWorld(name, env, seedString, generator, true); + public boolean addWorld(String name, Environment env, String seedString, WorldType type, String generator) { + return this.addWorld(name, env, seedString, type, generator, true); } /** * {@inheritDoc} */ @Override - public boolean addWorld(String name, Environment env, String seedString, String generator, boolean useSpawnAdjust) { - plugin.log(Level.FINE, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator); + public boolean addWorld(String name, Environment env, String seedString, WorldType type, String generator, boolean useSpawnAdjust) { + plugin.log(Level.FINE, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + type.toString() + ", " + generator); Long seed = null; WorldCreator c = new WorldCreator(name); if (seedString != null && seedString.length() > 0) { @@ -101,27 +103,26 @@ public class WorldManager implements MVWorldManager { c.seed(seed); } - // TODO: Use the fancy kind with the commandSender if (generator != null && generator.length() != 0) { c.generator(generator); } c.environment(env); + c.type(type); - World world = null; + World world; + StringBuilder builder = new StringBuilder(); + builder.append("Loading World & Settings - '").append(name).append("'"); + builder.append(" - Env: ").append(env); + builder.append(" - Type: ").append(type); if (seed != null) { - if (generator != null) { - this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " with seed: " + seed + " & Custom Generator: " + generator); - } else { - this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " with seed: " + seed); - } - } else { - if (generator != null) { - this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " & Custom Generator: " + generator); - } else { - this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env); - } + builder.append(" & seed: ").append(seed); } + if (generator != null) { + builder.append(" & generator: ").append(generator); + } + this.plugin.log(Level.INFO, builder.toString()); + try { world = c.createWorld(); } catch (Exception e) { @@ -275,10 +276,12 @@ public class WorldManager implements MVWorldManager { if ((worldKeys != null) && (worldKeys.contains(name))) { // Grab the initial values from the config file. String environment = this.configWorlds.getString("worlds." + name + ".environment", "NORMAL"); // Grab the Environment as a String. + String type = this.configWorlds.getString("worlds." + name + ".type", "NORMAL"); String seedString = this.configWorlds.getString("worlds." + name + ".seed", ""); String generatorString = this.configWorlds.getString("worlds." + name + ".generator"); - addWorld(name, this.plugin.getEnvFromString(environment), seedString, generatorString); + addWorld(name, EnvironmentCommand.getEnvFromString(environment), seedString, + EnvironmentCommand.getWorldTypeFromString(type), generatorString); if (this.unloadedWorlds.contains(name)) { this.unloadedWorlds.remove(name); } @@ -464,9 +467,9 @@ public class WorldManager implements MVWorldManager { String name = w.getName(); if (!worldStrings.contains(name)) { if (this.defaultGens.containsKey(name)) { - this.addWorld(name, w.getEnvironment(), w.getSeed() + "", this.defaultGens.get(name)); + this.addWorld(name, w.getEnvironment(), w.getSeed() + "", w.getWorldType(), this.defaultGens.get(name)); } else { - this.addWorld(name, w.getEnvironment(), w.getSeed() + "", null); + this.addWorld(name, w.getEnvironment(), w.getSeed() + "", w.getWorldType(), null); } } @@ -537,7 +540,8 @@ public class WorldManager implements MVWorldManager { continue; } // Grab the initial values from the config file. - String environment = this.configWorlds.getString("worlds." + worldKey + ".environment", "NORMAL"); // Grab the Environment as a String. + String environment = this.configWorlds.getString("worlds." + worldKey + ".environment", "NORMAL"); + String type = this.configWorlds.getString("worlds." + worldKey + ".type", "NORMAL"); String seedString = this.configWorlds.getString("worlds." + worldKey + ".seed", null); if (seedString == null) { seedString = this.configWorlds.getLong("worlds." + worldKey + ".seed") + ""; @@ -548,7 +552,9 @@ public class WorldManager implements MVWorldManager { this.plugin.log(Level.WARNING, "Found SKYLANDS world. Not importing automatically, as it won't work atm :("); continue; } - addWorld(worldKey, this.plugin.getEnvFromString(environment), seedString, generatorString); + // TODO: UNCOMMENT BEFORE RELEASE + addWorld(worldKey, EnvironmentCommand.getEnvFromString(environment), seedString, + EnvironmentCommand.getWorldTypeFromString(type), generatorString); // Increment the world count count++; diff --git a/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockWorldFactory.java b/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockWorldFactory.java index 1df477ae..1528e073 100644 --- a/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockWorldFactory.java +++ b/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockWorldFactory.java @@ -19,6 +19,7 @@ import java.util.Map; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.WorldType; import org.bukkit.generator.ChunkGenerator; import org.mockito.ArgumentMatcher; import org.mockito.Matchers; @@ -81,10 +82,11 @@ public class MockWorldFactory { createdWorlds.put(world.getName(), world); } - private static World basics(String world, World.Environment env) { + private static World basics(String world, World.Environment env, WorldType type) { World mockWorld = mock(World.class); when(mockWorld.getName()).thenReturn(world); when(mockWorld.getEnvironment()).thenReturn(env); + when(mockWorld.getWorldType()).thenReturn(type); when(mockWorld.getSpawnLocation()).thenReturn(new Location(mockWorld, 0, 0, 0)); when(mockWorld.getWorldFolder()).thenAnswer(new Answer() { public File answer(InvocationOnMock invocation) throws Throwable { @@ -101,15 +103,15 @@ public class MockWorldFactory { return mockWorld; } - public static World makeNewMockWorld(String world, World.Environment env) { - World w = basics(world, env); + public static World makeNewMockWorld(String world, World.Environment env, WorldType type) { + World w = basics(world, env, type); registerWorld(w); return w; } - public static World makeNewMockWorld(String world, World.Environment env, long seed, + public static World makeNewMockWorld(String world, World.Environment env, WorldType type, long seed, ChunkGenerator generator) { - World mockWorld = basics(world, env); + World mockWorld = basics(world, env, type); when(mockWorld.getGenerator()).thenReturn(generator); when(mockWorld.getSeed()).thenReturn(seed); registerWorld(mockWorld); diff --git a/src/test/java/com/onarandombox/MultiverseCore/test/utils/TestInstanceCreator.java b/src/test/java/com/onarandombox/MultiverseCore/test/utils/TestInstanceCreator.java index ce6471ef..195eaff4 100644 --- a/src/test/java/com/onarandombox/MultiverseCore/test/utils/TestInstanceCreator.java +++ b/src/test/java/com/onarandombox/MultiverseCore/test/utils/TestInstanceCreator.java @@ -122,7 +122,7 @@ public class TestInstanceCreator { } catch (Exception e) { return null; } - return MockWorldFactory.makeNewMockWorld(arg.name(), arg.environment()); + return MockWorldFactory.makeNewMockWorld(arg.name(), arg.environment(), arg.type()); } });