From 82cbb487de28fad5870e6e9c3ff019cf2eb12610 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 1 Feb 2020 19:56:28 -0800 Subject: [PATCH] Fix LevelTest --- src/main/java/world/bentobox/level/Level.java | 3 ++- src/test/java/world/bentobox/level/LevelTest.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/world/bentobox/level/Level.java b/src/main/java/world/bentobox/level/Level.java index c2ef35e..0dca7d9 100644 --- a/src/main/java/world/bentobox/level/Level.java +++ b/src/main/java/world/bentobox/level/Level.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.World; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; @@ -201,7 +202,7 @@ public class Level extends Addon { registerRequestHandler(new TopTenRequestHandler(this)); // Check if WildStackers is enabled on the server - if (getPlugin().getServer().getPluginManager().getPlugin("WildStacker") != null) { + if (Bukkit.getPluginManager().getPlugin("WildStacker") != null) { // I only added support for counting blocks into the island level // Someone else can PR if they want spawners added to the Leveling system :) CalcIslandLevel.stackersEnabled = true; diff --git a/src/test/java/world/bentobox/level/LevelTest.java b/src/test/java/world/bentobox/level/LevelTest.java index d2d9353..10a6f3a 100644 --- a/src/test/java/world/bentobox/level/LevelTest.java +++ b/src/test/java/world/bentobox/level/LevelTest.java @@ -111,6 +111,9 @@ public class LevelTest { private World world; private UUID uuid; + @Mock + private PluginManager pim; + @BeforeClass public static void beforeClass() throws IOException { jFile = new File("addon.jar"); @@ -135,7 +138,6 @@ public class LevelTest { /** * @throws java.lang.Exception */ - @SuppressWarnings("deprecation") @Before public void setUp() throws Exception { // Set up plugin @@ -217,6 +219,7 @@ public class LevelTest { UnsafeValues unsafe = mock(UnsafeValues.class); when(unsafe.getDataVersion()).thenReturn(777); when(Bukkit.getUnsafe()).thenReturn(unsafe); + when(Bukkit.getPluginManager()).thenReturn(pim); // placeholders when(plugin.getPlaceholdersManager()).thenReturn(phm);