Fix LevelTest

This commit is contained in:
tastybento 2020-02-01 19:56:28 -08:00
parent dad302a5fe
commit 82cbb487de
2 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
@ -201,7 +202,7 @@ public class Level extends Addon {
registerRequestHandler(new TopTenRequestHandler(this)); registerRequestHandler(new TopTenRequestHandler(this));
// Check if WildStackers is enabled on the server // 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 // I only added support for counting blocks into the island level
// Someone else can PR if they want spawners added to the Leveling system :) // Someone else can PR if they want spawners added to the Leveling system :)
CalcIslandLevel.stackersEnabled = true; CalcIslandLevel.stackersEnabled = true;

View File

@ -111,6 +111,9 @@ public class LevelTest {
private World world; private World world;
private UUID uuid; private UUID uuid;
@Mock
private PluginManager pim;
@BeforeClass @BeforeClass
public static void beforeClass() throws IOException { public static void beforeClass() throws IOException {
jFile = new File("addon.jar"); jFile = new File("addon.jar");
@ -135,7 +138,6 @@ public class LevelTest {
/** /**
* @throws java.lang.Exception * @throws java.lang.Exception
*/ */
@SuppressWarnings("deprecation")
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
// Set up plugin // Set up plugin
@ -217,6 +219,7 @@ public class LevelTest {
UnsafeValues unsafe = mock(UnsafeValues.class); UnsafeValues unsafe = mock(UnsafeValues.class);
when(unsafe.getDataVersion()).thenReturn(777); when(unsafe.getDataVersion()).thenReturn(777);
when(Bukkit.getUnsafe()).thenReturn(unsafe); when(Bukkit.getUnsafe()).thenReturn(unsafe);
when(Bukkit.getPluginManager()).thenReturn(pim);
// placeholders // placeholders
when(plugin.getPlaceholdersManager()).thenReturn(phm); when(plugin.getPlaceholdersManager()).thenReturn(phm);