diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index f7bf1039..794ead36 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -59,6 +59,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { public static boolean PrefixChat; public static boolean DisplayPermErrors; public static boolean TeleportIntercept; + public static boolean FirstSpawnOverride; public static Map teleportQueue = new HashMap(); private AnchorManager anchorManager = new AnchorManager(this); @@ -222,6 +223,19 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse."); } this.anchorManager.loadAnchors(); + + // Now set the firstspawnworld (after the worlds are loaded): + // Default as the server.props world. + this.worldManager.setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld", getDefaultWorldName())); + // We have to set this one here, if it's not present, we don't know the name of the default world. + // and this one won't be in the defaults yml file. + this.multiverseConfig.set("firstspawnworld", this.worldManager.getFirstSpawnWorld().getName()); + // A test that had no worlds loaded was being run. This should never happen in production + this.saveMVConfig(); + // Check to see if spout was already loaded (most likely): + if (this.getServer().getPluginManager().getPlugin("Spout") != null) { + this.log(Level.INFO, "Spout integration enabled."); + } } private boolean validateAllpay() { @@ -325,10 +339,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { EnforceAccess = this.multiverseConfig.getBoolean("enforceaccess", false); EnforceGameModes = this.multiverseConfig.getBoolean("enforcegamemodes", true); PrefixChat = this.multiverseConfig.getBoolean("worldnameprefix", true); - DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true); TeleportIntercept = this.multiverseConfig.getBoolean("teleportintercept", true); - // Default as the server.props world. - this.worldManager.setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld", getDefaultWorldName())); + // Should MV do the first spawn stuff? + FirstSpawnOverride = this.multiverseConfig.getBoolean("firstspawnoverride", true); + // Should permissions errors display to users? DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true); this.messaging = new MVMessaging(this); this.messaging.setCooldown(this.multiverseConfig.getInt("messagecooldown", 5000)); @@ -657,6 +671,12 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { public void setSpout() { this.spoutInterface = new SpoutInterface(); this.commandHandler.registerCommand(new SpoutCommand(this)); + if (FirstSpawnOverride) { + this.log(Level.WARNING, "the config value 'firstspawnworld' will have NO effect!!!"); + this.log(Level.WARNING, " --FernFerret"); + FirstSpawnOverride = false; + this.multiverseConfig.set("firstspawnoverride", false); + } } public SpoutInterface getSpout() { diff --git a/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java b/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java index 1b7c7cf4..49b88a74 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java +++ b/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java @@ -8,7 +8,7 @@ package com.onarandombox.MultiverseCore.enums; public enum ConfigProperty { - messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstworldspawn, teleportintercept; + messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstspawnworld, teleportintercept, firstspawnoverride; public static String getAllValues() { String buffer = ""; diff --git a/src/main/java/com/onarandombox/MultiverseCore/event/MVRespawnEvent.java b/src/main/java/com/onarandombox/MultiverseCore/event/MVRespawnEvent.java index 6ae43147..930b7055 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/event/MVRespawnEvent.java +++ b/src/main/java/com/onarandombox/MultiverseCore/event/MVRespawnEvent.java @@ -12,7 +12,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; public class MVRespawnEvent extends Event { - private static final long serialVersionUID = -2991894063331856687L; private Player player; private Location location; private String respawnMethod; diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java index 471b3b4e..ff546cc0 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java @@ -107,9 +107,10 @@ public class MVPlayerListener extends PlayerListener { Player p = event.getPlayer(); if (!p.hasPlayedBefore()) { this.plugin.log(Level.FINE, "Player joined first!"); - this.plugin.log(Level.FINE, "Loc: " + worldManager.getFirstSpawnWorld().getSpawnLocation()); - // This will override other spawn plugins atm :( - this.spawnNewPlayer(p); + if(MultiverseCore.FirstSpawnOverride) { + this.plugin.log(Level.FINE, "Moving NEW player to(firstspawnoverride): " + worldManager.getFirstSpawnWorld().getSpawnLocation()); + this.spawnNewPlayer(p); + } return; } else { this.plugin.log(Level.FINE, "Player joined AGAIN!"); diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index e3cba16e..472703d9 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -214,7 +214,12 @@ public class WorldManager implements MVWorldManager { if (world == null) { // If the spawn world was unloaded, get the default world this.plugin.log(Level.WARNING, "The world specified as the spawn world (" + this.firstSpawn + ") did not exist!!"); - return this.getMVWorld(this.plugin.getServer().getWorlds().get(0)); + try { + return this.getMVWorld(this.plugin.getServer().getWorlds().get(0)); + } catch (IndexOutOfBoundsException e) { + // This should only happen in tests. + return null; + } } return world; } diff --git a/src/main/resources/defaults/config.yml b/src/main/resources/defaults/config.yml index aec58797..49a7d135 100644 --- a/src/main/resources/defaults/config.yml +++ b/src/main/resources/defaults/config.yml @@ -8,6 +8,7 @@ worldnameprefix: true enforceaccess: true enforcegamemodes: true bedrespawn: true -version: 2.4 +version: 2.5 displaypermerrors: true teleportintercept: true +firstspawnoverride: true