From 865434d1b1a2ec7dde230d24eaa7aaf240107cfe Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Thu, 4 Feb 2016 09:39:30 -0500 Subject: [PATCH] Don't accept null worlds from the server. Addresses #1649. --- .../MultiverseCore/utils/WorldManager.java | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 8a5e2014..5fe7d9ab 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -7,6 +7,30 @@ package com.onarandombox.MultiverseCore.utils; +import com.dumptruckman.minecraft.util.Logging; +import com.onarandombox.MultiverseCore.MVWorld; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.WorldProperties; +import com.onarandombox.MultiverseCore.api.MVWorldManager; +import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import com.onarandombox.MultiverseCore.api.SafeTTeleporter; +import com.onarandombox.MultiverseCore.api.WorldPurger; +import com.onarandombox.MultiverseCore.event.MVWorldDeleteEvent; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.bukkit.WorldCreator; +import org.bukkit.WorldType; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; +import org.bukkit.plugin.Plugin; + import java.io.File; import java.io.FilenameFilter; import java.io.IOException; @@ -22,30 +46,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.World.Environment; -import org.bukkit.WorldCreator; -import org.bukkit.WorldType; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; -import org.bukkit.plugin.Plugin; - -import com.dumptruckman.minecraft.util.Logging; -import com.onarandombox.MultiverseCore.MVWorld; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.MultiverseCore.WorldProperties; -import com.onarandombox.MultiverseCore.api.MVWorldManager; -import com.onarandombox.MultiverseCore.api.MultiverseWorld; -import com.onarandombox.MultiverseCore.api.SafeTTeleporter; -import com.onarandombox.MultiverseCore.api.WorldPurger; -import com.onarandombox.MultiverseCore.event.MVWorldDeleteEvent; - /** * Public facing API to add/remove Multiverse worlds. */ @@ -409,6 +409,12 @@ public class WorldManager implements MVWorldManager { this.plugin.log(Level.SEVERE, "https://github.com/Fenixin/Minecraft-Region-Fixer"); } + private void nullWorld(String name) { + this.plugin.log(Level.SEVERE, "The world '" + name + "' could NOT be loaded because the server didn't like it!"); + this.plugin.log(Level.SEVERE, "We don't really know why this is. Contact the developer of your server software!"); + this.plugin.log(Level.SEVERE, "Server version info: " + Bukkit.getServer().getVersion()); + } + private boolean doLoad(String name) { return doLoad(name, false, null); } @@ -460,6 +466,10 @@ public class WorldManager implements MVWorldManager { brokenWorld(worldName); return false; } + if (cbworld == null) { + nullWorld(worldName); + return false; + } MVWorld world = new MVWorld(plugin, cbworld, mvworld); this.worldPurger.purgeWorld(world); this.worlds.put(worldName, world);