Fix massive NPEs for real, Don't comment out tests, use @Ignore, Thanks @main--

This commit is contained in:
Eric Stokes 2011-11-21 22:44:36 -07:00
parent af428a236d
commit 29bc8bfbfc
4 changed files with 12 additions and 16 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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.*");

View File

@ -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!");
}
}