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