diff --git a/pom.xml b/pom.xml index ec66fe4..8827a80 100644 --- a/pom.xml +++ b/pom.xml @@ -77,30 +77,37 @@ junit junit - 4.8.2 + 4.11 org.powermock powermock-module-junit4 - 1.4.9 - jar + 1.5.5 + test org.powermock powermock-api-easymock - 1.4.9 - jar + 1.5.5 + test org.powermock powermock-api-mockito - 1.4.9 - jar + 1.5.5 + test org.easymock easymock - 3.0 + 3.2 + test + + + com.carrotsearch + junit-benchmarks + 0.7.2 + test diff --git a/src/main/java/com/graywolf336/jail/JailIO.java b/src/main/java/com/graywolf336/jail/JailIO.java index 02d3bbb..a567718 100644 --- a/src/main/java/com/graywolf336/jail/JailIO.java +++ b/src/main/java/com/graywolf336/jail/JailIO.java @@ -357,10 +357,10 @@ public class JailIO { j.setWorld(set.getString("world")); j.setMaxPoint(new int[] { set.getInt("top.x"), set.getInt("top.y"), set.getInt("top.z") }); j.setMinPoint(new int[] { set.getInt("bottom.x"), set.getInt("bottom.y"), set.getInt("bottom.z") }); - j.setTeleportIn(new SimpleLocation(j.getWorldName(), set.getDouble("tps.in.x"), + j.setTeleportIn(new Location(pl.getServer().getWorld(j.getWorldName()), set.getDouble("tps.in.x"), set.getDouble("tps.in.y"), set.getDouble("tps.in.z"), set.getFloat("tps.in.yaw"), set.getFloat("tps.in.pitch"))); - j.setTeleportFree(new SimpleLocation(set.getString("tps.free.world"), set.getDouble("tps.free.x"), + j.setTeleportFree(new Location(pl.getServer().getWorld(j.getWorldName()), set.getDouble("tps.free.x"), set.getDouble("tps.free.y"), set.getDouble("tps.free.z"), set.getFloat("tps.free.yaw"), set.getFloat("tps.free.pitch"))); pl.getJailManager().addJail(j, false); @@ -551,15 +551,15 @@ public class JailIO { j.setMaxPoint(new int[] {flat.getInt(node + "top.x"), flat.getInt(node + "top.y"), flat.getInt(node + "top.z")}); j.setMinPoint(new int[] {flat.getInt(node + "bottom.x"), flat.getInt(node + "bottom.y"), flat.getInt(node + "bottom.z")}); - j.setTeleportIn(new SimpleLocation( - flat.getString(node + "world"), + j.setTeleportIn(new Location( + pl.getServer().getWorld(flat.getString(node + "world")), flat.getDouble(node + "tps.in.x"), flat.getDouble(node + "tps.in.y"), flat.getDouble(node + "tps.in.z"), (float) flat.getDouble(node + "tps.in.yaw"), (float) flat.getDouble(node + "tps.in.pitch"))); - j.setTeleportFree(new SimpleLocation( - flat.getString(node + "tps.free.world"), + j.setTeleportFree(new Location( + pl.getServer().getWorld(flat.getString(node + "world")), flat.getDouble(node + "tps.free.x"), flat.getDouble(node + "tps.free.y"), flat.getDouble(node + "tps.free.z"), diff --git a/src/main/java/com/graywolf336/jail/JailMain.java b/src/main/java/com/graywolf336/jail/JailMain.java index eebdec0..8ee024d 100644 --- a/src/main/java/com/graywolf336/jail/JailMain.java +++ b/src/main/java/com/graywolf336/jail/JailMain.java @@ -38,6 +38,7 @@ public class JailMain extends JavaPlugin { private JailTimer jt; private PrisonerManager pm; private ScoreBoardManager sbm; + private MoveProtectionListener mpl; private boolean debug = false; public void onEnable() { @@ -94,7 +95,8 @@ public class JailMain extends JavaPlugin { //But doing this also forces people to restart their server if they to //enable it after disabling it. if(getConfig().getBoolean(Settings.MOVEPROTECTION.getPath())) { - plm.registerEvents(new MoveProtectionListener(this), this); + this.mpl = new MoveProtectionListener(this); + plm.registerEvents(this.mpl, this); } jt = new JailTimer(this); @@ -262,4 +264,8 @@ public class JailMain extends JavaPlugin { public void debug(String message) { if(inDebug()) getLogger().info("[Debug]: " + message); } + + public MoveProtectionListener getPlayerMoveListener() { + return this.mpl; + } } diff --git a/src/main/java/com/graywolf336/jail/PrisonerManager.java b/src/main/java/com/graywolf336/jail/PrisonerManager.java index a2b71c1..55b27e5 100644 --- a/src/main/java/com/graywolf336/jail/PrisonerManager.java +++ b/src/main/java/com/graywolf336/jail/PrisonerManager.java @@ -74,9 +74,6 @@ public class PrisonerManager { cell.setPrisoner(prisoner); } - //Save the jail after adding them to the jail - pl.getJailIO().saveJail(jail); - //If they are NOT offline, jail them if(!prisoner.isOfflinePending()) { jailPrisoner(jail, cell, player, prisoner); diff --git a/src/main/java/com/graywolf336/jail/beans/Jail.java b/src/main/java/com/graywolf336/jail/beans/Jail.java index 8870d10..16f3fb3 100644 --- a/src/main/java/com/graywolf336/jail/beans/Jail.java +++ b/src/main/java/com/graywolf336/jail/beans/Jail.java @@ -25,7 +25,7 @@ public class Jail { private HashMap nocellPrisoners;//prisoners who aren't in a cell private String name = "", world = ""; private int minX, minY, minZ, maxX, maxY, maxZ; - private SimpleLocation in, free; + private Location in, free; public Jail(JailMain plugin, String name) { this.plugin = plugin; @@ -110,26 +110,26 @@ public class Jail { return plugin.getServer().getWorld(world); } - /** Sets the {@link SimpleLocation location} of the teleport in. */ - public void setTeleportIn(SimpleLocation location) { - if(this.world.isEmpty()) this.world = location.getWorldName(); + /** Sets the {@link Location location} of the teleport in. */ + public void setTeleportIn(Location location) { + if(this.world.isEmpty()) this.world = location.getWorld().getName(); this.in = location; } /** Gets the {@link Location location} of the teleport in. */ public Location getTeleportIn() { - return this.in.getLocation(); + return this.in; } - /** Sets the {@link SimpleLocation location} of the teleport for the free spot. */ - public void setTeleportFree(SimpleLocation location) { + /** Sets the {@link Location location} of the teleport for the free spot. */ + public void setTeleportFree(Location location) { this.free = location; } /** Gets the {@link Location location} of the teleport free spot.*/ public Location getTeleportFree() { - return this.free.getLocation(); + return this.free; } /** Add a prisoner to this jail. */ diff --git a/src/main/java/com/graywolf336/jail/legacy/OldInputOutput.java b/src/main/java/com/graywolf336/jail/legacy/OldInputOutput.java index 25db076..6283cda 100644 --- a/src/main/java/com/graywolf336/jail/legacy/OldInputOutput.java +++ b/src/main/java/com/graywolf336/jail/legacy/OldInputOutput.java @@ -92,8 +92,8 @@ public class OldInputOutput { j.setWorld(teleWorld); j.setMaxPoint(new Location(pl.getServer().getWorld(teleWorld), X1, Y1, Z1)); j.setMinPoint(new Location(pl.getServer().getWorld(teleWorld), X2, Y2, Z2)); - j.setTeleportIn(new SimpleLocation(teleWorld, teleX, teleY, teleZ)); - j.setTeleportFree(new SimpleLocation(freeWorld, freeX, freeY, freeZ)); + j.setTeleportIn(new Location(pl.getServer().getWorld(teleWorld), teleX, teleY, teleZ)); + j.setTeleportFree(new Location(pl.getServer().getWorld(freeWorld), freeX, freeY, freeZ)); pl.getJailManager().addJail(j, false); } diff --git a/src/main/java/com/graywolf336/jail/listeners/MoveProtectionListener.java b/src/main/java/com/graywolf336/jail/listeners/MoveProtectionListener.java index 2f3fd35..c14103c 100644 --- a/src/main/java/com/graywolf336/jail/listeners/MoveProtectionListener.java +++ b/src/main/java/com/graywolf336/jail/listeners/MoveProtectionListener.java @@ -46,7 +46,7 @@ public class MoveProtectionListener implements Listener { if (!j.isInside(event.getTo())) { try { long add = Util.getTime(pl.getConfig().getString(Settings.MOVEPENALTY.getPath())); - pl.getJailManager().getPrisoner(event.getPlayer().getUniqueId()).addTime(add); + p.addTime(add); String msg = ""; if(add == 0L) { diff --git a/src/main/java/com/graywolf336/jail/steps/JailCreationSteps.java b/src/main/java/com/graywolf336/jail/steps/JailCreationSteps.java index 616ff4b..e13c507 100644 --- a/src/main/java/com/graywolf336/jail/steps/JailCreationSteps.java +++ b/src/main/java/com/graywolf336/jail/steps/JailCreationSteps.java @@ -134,8 +134,8 @@ public class JailCreationSteps { jail.setMinPoint(cp.getCornerOne()); jail.setMaxPoint(cp.getCornerTwo()); - jail.setTeleportIn(cp.getTeleportInSL()); - jail.setTeleportFree(cp.getTeleportFreeSL()); + jail.setTeleportIn(cp.getTeleportInSL().getLocation()); + jail.setTeleportFree(cp.getTeleportFreeSL().getLocation()); jm.addJail(jail, true); diff --git a/src/test/java/test/java/com/graywolf336/jail/BenchmarkTest.java b/src/test/java/test/java/com/graywolf336/jail/BenchmarkTest.java new file mode 100644 index 0000000..d657d09 --- /dev/null +++ b/src/test/java/test/java/com/graywolf336/jail/BenchmarkTest.java @@ -0,0 +1,95 @@ +package test.java.com.graywolf336.jail; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Matchers.any; + +import java.util.Random; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.plugin.PluginDescriptionFile; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import com.carrotsearch.junitbenchmarks.AbstractBenchmark; +import com.carrotsearch.junitbenchmarks.BenchmarkOptions; +import com.graywolf336.jail.JailMain; +import com.graywolf336.jail.beans.Jail; +import com.graywolf336.jail.beans.Prisoner; + +import test.java.com.graywolf336.jail.util.TestInstanceCreator; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ JailMain.class, PluginDescriptionFile.class }) +public class BenchmarkTest extends AbstractBenchmark { + private static TestInstanceCreator creator; + private static JailMain main; + private static UUID use; + private static Random r; + + @BeforeClass + public static void setUp() throws Exception { + creator = new TestInstanceCreator(); + assertNotNull("The instance creator is null.", creator); + assertTrue(creator.setup()); + main = creator.getMain(); + assertNotNull("The JailMain class is null.", main); + + Jail j = new Jail(main, "testingJail"); + j.setWorld("world"); + j.setMaxPoint(new int[] { 9, 63, -238 }); + j.setMinPoint(new int[] { 23, 70, -242 }); + j.setTeleportIn(new Location(main.getServer().getWorld("world"), 11.469868464778077, 65.0, -239.27944647045672, Float.valueOf("38.499817"), Float.valueOf("2.0000453"))); + j.setTeleportFree(new Location(main.getServer().getWorld("world"), 27.947015843504765, 65.0, -218.8108042076112, Float.valueOf("90.54981"), Float.valueOf("12.500043"))); + main.getJailManager().addJail(j, false); + + assertEquals("There is no jail.", 1, main.getJailManager().getJails().size()); + + for(int i = 0; i < 1000; i++) { + if(i == 555) + use = UUID.randomUUID(); + main.getPrisonerManager().prepareJail(main.getJailManager().getJail("testingJail"), null, null, new Prisoner(i == 555 ? use.toString() : UUID.randomUUID().toString(), "mockPlayer" + i, true, 100000L, "testJailer", "Test jailing " + i)); + } + + r = new Random(); + } + + @AfterClass + public static void tearDown() throws Exception { + creator.tearDown(); + main = null; + } + + @BenchmarkOptions(benchmarkRounds = 1000, warmupRounds = 0) + @Test + public void testPrisonerSizeAndJailed() { + assertEquals("Prisoners not jailed?", 1000, main.getJailManager().getAllPrisoners().size()); + assertTrue("Prisoner 555 is not jailed", main.getJailManager().isPlayerJailed(use)); + } + + @BenchmarkOptions(benchmarkRounds = 5000, warmupRounds = 0) + @Test + public void testPlayerMoveEvent() { + Player p = mock(Player.class); + when(p.getUniqueId()).thenReturn(use); + when(p.getName()).thenReturn("mockPlayer555"); + when(p.teleport(any(Location.class))).thenReturn(true); + + Location from = new Location(main.getServer().getWorld("world"), 15, 64, -239); + + Location to = new Location(main.getServer().getWorld("world"), r.nextInt(), r.nextInt(), r.nextInt()); + PlayerMoveEvent e = new PlayerMoveEvent(p, from, to); + + main.getPlayerMoveListener().moveProtection(e); + } +} diff --git a/src/test/java/test/java/com/graywolf336/jail/TestJailCommandInfo.java b/src/test/java/test/java/com/graywolf336/jail/TestJailCommandInfo.java index c737bcf..741007f 100644 --- a/src/test/java/test/java/com/graywolf336/jail/TestJailCommandInfo.java +++ b/src/test/java/test/java/com/graywolf336/jail/TestJailCommandInfo.java @@ -1,6 +1,7 @@ package test.java.com.graywolf336.jail; import static org.junit.Assert.*; +import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -9,8 +10,8 @@ import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.plugin.PluginDescriptionFile; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -23,19 +24,22 @@ import com.graywolf336.jail.JailMain; @RunWith(PowerMockRunner.class) @PrepareForTest({ JailMain.class, PluginDescriptionFile.class }) public class TestJailCommandInfo { - private TestInstanceCreator creator; - private JailMain main; + private static TestInstanceCreator creator; + private static JailMain main; - @Before - public void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { creator = new TestInstanceCreator(); + assertNotNull("The instance creator is null.", creator); assertTrue(creator.setup()); main = creator.getMain(); + assertNotNull("The JailMain class is null.", main); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { creator.tearDown(); + main = null; } @Test @@ -71,7 +75,7 @@ public class TestJailCommandInfo { CommandSender sender = creator.getPlayerCommandSender(); assertTrue(main.onCommand(sender, command, "jail", args)); - verify(sender).sendMessage("/jail create [name]"); // If you change which command we test against, then change this + verify(sender, atLeast(1)).sendMessage("/jail create [name]"); // If you change which command we test against, then change this } @Test @@ -83,7 +87,7 @@ public class TestJailCommandInfo { CommandSender sender = creator.getPlayerCommandSender(); assertTrue(main.onCommand(sender, command, "jail", args)); - verify(sender).sendMessage("/jail create [name]"); // If you change which command we test against, then change this + verify(sender, atLeast(1)).sendMessage("/jail create [name]"); // If you change which command we test against, then change this } @Test diff --git a/src/test/java/test/java/com/graywolf336/jail/TestJailStuff.java b/src/test/java/test/java/com/graywolf336/jail/TestJailStuff.java index 585fc02..8cb9281 100644 --- a/src/test/java/test/java/com/graywolf336/jail/TestJailStuff.java +++ b/src/test/java/test/java/com/graywolf336/jail/TestJailStuff.java @@ -4,8 +4,8 @@ import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.is; import org.bukkit.plugin.PluginDescriptionFile; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -18,19 +18,22 @@ import com.graywolf336.jail.JailMain; @RunWith(PowerMockRunner.class) @PrepareForTest({ JailMain.class, PluginDescriptionFile.class }) public class TestJailStuff { - private TestInstanceCreator creator; - private JailMain main; + private static TestInstanceCreator creator; + private static JailMain main; - @Before - public void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { creator = new TestInstanceCreator(); - creator.setup(); + assertNotNull("The instance creator is null.", creator); + assertTrue(creator.setup()); main = creator.getMain(); + assertNotNull("The JailMain class is null.", main); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { creator.tearDown(); + main = null; } @Test @@ -45,7 +48,8 @@ public class TestJailStuff { @Test public void testDefaultConfig() { assertEquals("The config version is not 3.", 3, main.getConfig().getInt("system.configVersion")); - assertFalse("Default debugging is on.", main.getConfig().getBoolean("system.debug")); + //This is enabled by default in testing. + //assertFalse("Default debugging is on.", main.getConfig().getBoolean("system.debug")); assertTrue("Default updating notifications is false.", main.getConfig().getBoolean("system.updateNotifications")); //Storage system diff --git a/src/test/java/test/java/com/graywolf336/jail/TestJewelCommands.java b/src/test/java/test/java/com/graywolf336/jail/TestJewelCommands.java index 67039bb..b4be1e4 100644 --- a/src/test/java/test/java/com/graywolf336/jail/TestJewelCommands.java +++ b/src/test/java/test/java/com/graywolf336/jail/TestJewelCommands.java @@ -1,6 +1,7 @@ package test.java.com.graywolf336.jail; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,8 +15,8 @@ public class TestJewelCommands { String[] args = { "--player", "graywolf336", "-c", "testing", "-r", "This", "is", "a", "reason" }; Jailing j = CliFactory.parseArguments(Jailing.class, args); - Assert.assertEquals("graywolf336", j.getPlayer()); - Assert.assertEquals("testing", j.getCell()); + assertEquals("graywolf336", j.getPlayer()); + assertEquals("testing", j.getCell()); StringBuilder sb = new StringBuilder(); for(String s : j.getReason()) { @@ -24,7 +25,7 @@ public class TestJewelCommands { sb.deleteCharAt(sb.length() - 1); - Assert.assertEquals("This is a reason", sb.toString()); + assertEquals("This is a reason", sb.toString()); } @Test @@ -32,9 +33,9 @@ public class TestJewelCommands { String[] args = { "-p", "graywolf336", "-j", "hardcore", "-c", "cell_n01" }; Transfer t = CliFactory.parseArguments(Transfer.class, args); - Assert.assertEquals("The player parsed is not what we expected.", "graywolf336", t.getPlayer()); - Assert.assertEquals("The jail parsed is not what we expected.", "hardcore", t.getJail()); - Assert.assertEquals("The cell parsed is not what we expected.", "cell_n01", t.getCell()); + assertEquals("The player parsed is not what we expected.", "graywolf336", t.getPlayer()); + assertEquals("The jail parsed is not what we expected.", "hardcore", t.getJail()); + assertEquals("The cell parsed is not what we expected.", "cell_n01", t.getCell()); } @Test @@ -42,8 +43,8 @@ public class TestJewelCommands { String[] args = { "-p", "graywolf336", "-j", "hardcore" }; Transfer t = CliFactory.parseArguments(Transfer.class, args); - Assert.assertEquals("The player parsed is not what we expected.", "graywolf336", t.getPlayer()); - Assert.assertEquals("The jail parsed is not what we expected.", "hardcore", t.getJail()); - Assert.assertNull("The cell is not null?", t.getCell()); + assertEquals("The player parsed is not what we expected.", "graywolf336", t.getPlayer()); + assertEquals("The jail parsed is not what we expected.", "hardcore", t.getJail()); + assertNull("The cell is not null?", t.getCell()); } } \ No newline at end of file diff --git a/src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java b/src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java index f1e7a84..f6786e4 100644 --- a/src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java +++ b/src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java @@ -7,19 +7,19 @@ import java.util.List; import org.bukkit.Material; import org.bukkit.util.Vector; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import com.graywolf336.jail.Util; public class TestUtilClass { - private List list; - private Vector bottomCorner; - private Vector topCorner; + private static List list; + private static Vector bottomCorner; + private static Vector topCorner; - @Before - public void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { list = new ArrayList(); list.add(Material.SEEDS.toString()); list.add("coal_ore"); @@ -28,8 +28,8 @@ public class TestUtilClass { topCorner = new Vector(50, 100, 250); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { bottomCorner = null; topCorner = null; list = null; diff --git a/src/test/java/test/java/com/graywolf336/jail/util/TestInstanceCreator.java b/src/test/java/test/java/com/graywolf336/jail/util/TestInstanceCreator.java index e9cf84b..2524ec9 100644 --- a/src/test/java/test/java/com/graywolf336/jail/util/TestInstanceCreator.java +++ b/src/test/java/test/java/com/graywolf336/jail/util/TestInstanceCreator.java @@ -12,6 +12,8 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.WorldType; +import org.bukkit.World.Environment; import org.bukkit.WorldCreator; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; @@ -24,10 +26,13 @@ import org.bukkit.plugin.PluginLogger; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitScheduler; + import org.junit.Assert; + import org.mockito.Matchers; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; + import org.powermock.api.mockito.PowerMockito; import org.powermock.core.MockGateway; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -68,6 +73,8 @@ public class TestInstanceCreator { when(mockServer.getWorldContainer()).thenReturn(worldsDirectory); when(mockServer.getItemFactory()).thenReturn(CraftItemFactory.instance()); + MockWorldFactory.makeNewMockWorld("world", Environment.NORMAL, WorldType.NORMAL); + suppress(constructor(JailMain.class)); main = PowerMockito.spy(new JailMain()); @@ -231,6 +238,7 @@ public class TestInstanceCreator { // Init our player, who is op and who has all permissions (with name of graywolf336) mockPlayer = mock(Player.class); + when(mockPlayer.getUniqueId()).thenReturn(UUID.fromString("062c14ba-4c47-4757-911b-bbf9a60dab7b")); when(mockPlayer.getName()).thenReturn("graywolf336"); when(mockPlayer.getDisplayName()).thenReturn("TheGrayWolf"); when(mockPlayer.isPermissionSet(anyString())).thenReturn(true); @@ -256,8 +264,9 @@ public class TestInstanceCreator { // Load Jail main.onLoad(); - // Enable it + // Enable it and turn on debugging main.onEnable(); + main.setDebugging(true); return true; } catch (Exception e) { @@ -281,6 +290,8 @@ public class TestInstanceCreator { main.onDisable(); + MockWorldFactory.clearWorlds(); + deleteFolder(pluginDirectory); deleteFolder(worldsDirectory); deleteFolder(serverDirectory);