From 29bc8bfbfc663b2b7359256f3c08a35348af5e38 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Mon, 21 Nov 2011 22:44:36 -0700 Subject: [PATCH] Fix massive NPEs for real, Don't comment out tests, use @Ignore, Thanks @main-- --- .../onarandombox/MultiverseCore/MultiverseCore.java | 7 +------ .../MultiverseCore/listeners/MVEntityListener.java | 6 ++++-- .../MultiverseCore/utils/WorldManager.java | 4 ---- .../MultiverseCore/test/TestWorldImport.java | 11 +++++++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index d5873fae..8557f469 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -98,7 +98,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { // Configurations private FileConfiguration multiverseConfig = null; - private WorldManager worldManager; + private WorldManager worldManager = new WorldManager(this); // Setup the block/player/entity listener. private MVPlayerListener playerListener = new MVPlayerListener(this); @@ -632,11 +632,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { return this.worldManager; } - @Deprecated - public com.onarandombox.utils.WorldManager getWorldManager() { - return new com.onarandombox.utils.WorldManager(this); - } - public MVPlayerListener getPlayerListener() { return this.playerListener; } diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java index 223a5698..1d8182f8 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java @@ -10,12 +10,14 @@ package com.onarandombox.MultiverseCore.listeners; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.api.MultiverseWorld; import com.onarandombox.MultiverseCore.utils.WorldManager; -import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.entity.*; -import org.bukkit.event.entity.*; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.event.entity.EntityListener; +import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.FoodLevelChangeEvent; import java.util.List; import java.util.logging.Level; diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 3874daf9..5bfa7d90 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -351,10 +351,6 @@ public class WorldManager implements MVWorldManager { // Force the worlds to be loaded, ie don't just load new worlds. if (forceLoad) { // Remove all world permissions. - System.out.println(this.plugin); - System.out.println("Server2: " + this.plugin.getServer()); - System.out.println(this.plugin.getServer().getPluginManager()); - System.out.println(this.plugin.getServer().getPluginManager().getPermission("multiverse.access.*")); Permission allAccess = this.plugin.getServer().getPluginManager().getPermission("multiverse.access.*"); Permission allExempt = this.plugin.getServer().getPluginManager().getPermission("multiverse.exempt.*"); diff --git a/src/test/java/com/onarandombox/MultiverseCore/test/TestWorldImport.java b/src/test/java/com/onarandombox/MultiverseCore/test/TestWorldImport.java index 9547814c..c1f48163 100644 --- a/src/test/java/com/onarandombox/MultiverseCore/test/TestWorldImport.java +++ b/src/test/java/com/onarandombox/MultiverseCore/test/TestWorldImport.java @@ -14,6 +14,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.internal.verification.VerificationModeFactory; @@ -89,8 +90,9 @@ public class TestWorldImport { } @Test + @Ignore public void testWorldImport() { - /*TestInstanceCreator creator = new TestInstanceCreator(); + TestInstanceCreator creator = new TestInstanceCreator(); Server mockServer = creator.setupDefaultServerInstance(); CommandSender mockCommandSender = creator.getCommandSender(); // Start actual testing. @@ -133,12 +135,13 @@ public class TestWorldImport { // Verify that the commandSender has been called 3 times. verify(mockCommandSender, VerificationModeFactory.times(3)).sendMessage(ChatColor.AQUA + "Starting world import..."); - verify(mockCommandSender, VerificationModeFactory.times(3)).sendMessage(ChatColor.GREEN + "Complete!");*/ + verify(mockCommandSender, VerificationModeFactory.times(3)).sendMessage(ChatColor.GREEN + "Complete!"); } @Test + @Ignore public void testWorldImportWithSeed() { - /*TestInstanceCreator creator = new TestInstanceCreator(); + TestInstanceCreator creator = new TestInstanceCreator(); Server mockServer = creator.setupDefaultServerInstance(); CommandSender mockCommandSender = creator.getCommandSender(); // Start actual testing. @@ -177,6 +180,6 @@ public class TestWorldImport { // Verify that the commandSender has been called 1 time. verify(mockCommandSender, VerificationModeFactory.times(1)).sendMessage(ChatColor.AQUA + "Starting world import..."); - verify(mockCommandSender, VerificationModeFactory.times(1)).sendMessage(ChatColor.GREEN + "Complete!");*/ + verify(mockCommandSender, VerificationModeFactory.times(1)).sendMessage(ChatColor.GREEN + "Complete!"); } }