From 6afbd1d13d998312b6afe575861a8398d9ab2e4c Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sat, 26 Nov 2011 12:33:12 -0700 Subject: [PATCH] Bump API version to 8, Remove junk, Update CommandHandler (Closes #267) --- lib/commandhandler | 2 +- .../onarandombox/MultiverseCore/MVWorld.java | 1 - .../MultiverseCore/MultiverseCore.java | 28 ++++++++++--------- .../MultiverseCore/commands/RegenCommand.java | 1 + .../MultiverseCore/utils/WorldManager.java | 2 -- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/commandhandler b/lib/commandhandler index 05cb1a3d..086a3e77 160000 --- a/lib/commandhandler +++ b/lib/commandhandler @@ -1 +1 @@ -Subproject commit 05cb1a3d6200e16869f4f36c697e431549bd5d18 +Subproject commit 086a3e7789b2dfc6f1078d18453931355c9ef877 diff --git a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java index ab6a9772..de20dfd1 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java @@ -60,7 +60,6 @@ public class MVWorld implements MultiverseWorld { // Set local values that CANNOT be changed by user this.world = world; this.name = world.getName(); - System.out.println("MVWorld recieved seed: " + seed); this.seed = seed; this.environment = world.getEnvironment(); diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index f8148638..c41ba265 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -36,15 +36,12 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import java.io.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Random; +import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { - private final static int Protocol = 7; + private final static int Protocol = 8; // Global Multiverse config variable, states whether or not // Multiverse should stop other plugins from teleporting players // to worlds. @@ -116,7 +113,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { private DestinationFactory destFactory; private SpoutInterface spoutInterface = null; private double allpayversion = 3; - private double chversion = 3; + private double chversion = 4; private MVMessaging messaging; private File serverFolder = new File(System.getProperty("user.dir")); @@ -628,24 +625,29 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { */ public Boolean regenWorld(String name, Boolean useNewSeed, Boolean randomSeed, String seed) { MultiverseWorld world = this.worldManager.getMVWorld(name); - if(world == null) { + if (world == null) { return false; } + + List ps = world.getCBWorld().getPlayers(); + if (useNewSeed) { - System.out.println("Using a new seed"); // Set the worldseed. - if(randomSeed) { - System.out.println("Using a random seed"); + if (randomSeed) { Random random = new Random(); Long newseed = random.nextLong(); seed = newseed.toString(); - } else { - System.out.println("Using " + seed); } - ((WorldManager)this.worldManager).getConfigWorlds().set("worlds." + name + "seed", seed); + ((WorldManager) this.worldManager).getConfigWorlds().set("worlds." + name + ".seed", seed); } if (this.worldManager.deleteWorld(name, false)) { this.worldManager.loadWorlds(false); + SafeTTeleporter teleporter = this.getTeleporter(); + Location newSpawn = this.getServer().getWorld(name).getSpawnLocation(); + // Send all players that were in the old world, BACK to it! + for (Player p : ps) { + teleporter.safelyTeleport(null, p, newSpawn, true); + } return true; } return false; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/RegenCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/RegenCommand.java index 849cd5f8..d7cc364a 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/RegenCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/RegenCommand.java @@ -36,6 +36,7 @@ public class RegenCommand extends MultiverseCommand { Boolean useseed = (!(args.size() == 1)); Boolean randomseed = (args.size() == 2 && args.get(1).equalsIgnoreCase("-s")); String seed = (args.size() == 3) ? args.get(2) : ""; + Class paramTypes[] = {String.class, Boolean.class, Boolean.class, String.class}; List objectArgs = new ArrayList(); objectArgs.add(args.get(0)); diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 8c7c2a7e..84a60136 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -485,8 +485,6 @@ public class WorldManager implements MVWorldManager { seedString = this.configWorlds.getLong("worlds." + worldKey + ".seed") + ""; } - System.out.println("SEEEEEEEED: " + seedString); - String generatorString = this.configWorlds.getString("worlds." + worldKey + ".generator"); if (environment.equalsIgnoreCase("skylands")) { this.plugin.log(Level.WARNING, "Found SKYLANDS world. Not importing automatically, as it won't work atm :(");