mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-21 16:47:39 +01:00
Removed deprecated calls from IslandsManager for trapdoor check
This commit is contained in:
parent
d3b5411b1b
commit
4a1dede795
@ -14,14 +14,13 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Openable;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.SimpleAttachableMaterialData;
|
||||
import org.bukkit.material.TrapDoor;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
@ -197,17 +196,12 @@ public class IslandsManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
MaterialData md = ground.getState().getData();
|
||||
if (md instanceof SimpleAttachableMaterialData) {
|
||||
if (md instanceof TrapDoor) {
|
||||
TrapDoor trapDoor = (TrapDoor) md;
|
||||
if (trapDoor.isOpen()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// Check for trapdoors
|
||||
BlockData bd = ground.getBlockData();
|
||||
if (bd instanceof Openable) {
|
||||
return !((Openable)bd).isOpen();
|
||||
}
|
||||
|
||||
if (ground.getType().equals(Material.CACTUS) || ground.getType().toString().contains("BOAT") || ground.getType().toString().contains("FENCE")
|
||||
|| ground.getType().equals(Material.SIGN) || ground.getType().equals(Material.WALL_SIGN)) {
|
||||
return false;
|
||||
|
@ -27,6 +27,8 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Openable;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -35,8 +37,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.TrapDoor;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -146,8 +146,8 @@ public class IslandsManagerTest {
|
||||
// Neutral BlockState
|
||||
blockState = mock(BlockState.class);
|
||||
when(ground.getState()).thenReturn(blockState);
|
||||
MaterialData md = mock(MaterialData.class);
|
||||
when(blockState.getData()).thenReturn(md);
|
||||
BlockData bd = mock(BlockData.class);
|
||||
when(blockState.getBlockData()).thenReturn(bd);
|
||||
|
||||
// Online players
|
||||
// Return a set of online players
|
||||
@ -271,9 +271,9 @@ public class IslandsManagerTest {
|
||||
when(ground.getType()).thenReturn(Material.OAK_TRAPDOOR);
|
||||
|
||||
// Open trapdoor
|
||||
TrapDoor trapDoor = mock(TrapDoor.class);
|
||||
Openable trapDoor = mock(Openable.class);
|
||||
when(trapDoor.isOpen()).thenReturn(true);
|
||||
when(blockState.getData()).thenReturn(trapDoor);
|
||||
when(ground.getBlockData()).thenReturn(trapDoor);
|
||||
|
||||
assertFalse("Open trapdoor", manager.isSafeLocation(location));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user