Class SimpleBlockSafety
- java.lang.Object
-
- com.onarandombox.MultiverseCore.utils.SimpleBlockSafety
-
- All Implemented Interfaces:
BlockSafety
public class SimpleBlockSafety extends java.lang.Object implements BlockSafety
The default-implementation ofBlockSafety
.
-
-
Constructor Summary
Constructors Constructor Description SimpleBlockSafety(Core plugin)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canSpawnCartSafely(org.bukkit.entity.Minecart cart)
Checks if the specifiedMinecart
can spawn safely.boolean
canSpawnVehicleSafely(org.bukkit.entity.Vehicle vehicle)
Checks if the specifiedVehicle
can spawn safely.org.bukkit.Location
getBottomBlock(org.bukkit.Location l)
Gets the location of the top block at the specifiedLocation
.org.bukkit.Location
getSafeBedSpawn(org.bukkit.Location l)
Gets a safe bed spawn location OR null if the bed is invalid.org.bukkit.Location
getTopBlock(org.bukkit.Location l)
Gets the location of the top block at the specifiedLocation
.boolean
isBlockAboveAir(org.bukkit.Location l)
This function checks whether the block at the given coordinates are above air or not.boolean
isEntitiyOnTrack(org.bukkit.Location l)
Checks if an entity would be on track at the specifiedLocation
.static boolean
isSolidBlock(org.bukkit.Material type)
boolean
playerCanSpawnHereSafely(org.bukkit.Location l)
This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air etc.boolean
playerCanSpawnHereSafely(org.bukkit.World world, double x, double y, double z)
Checks if a player can spawn safely at the given coordinates.
-
-
-
Constructor Detail
-
SimpleBlockSafety
public SimpleBlockSafety(Core plugin)
-
-
Method Detail
-
isBlockAboveAir
public boolean isBlockAboveAir(org.bukkit.Location l)
This function checks whether the block at the given coordinates are above air or not.- Specified by:
isBlockAboveAir
in interfaceBlockSafety
- Parameters:
l
- TheLocation
of the block.- Returns:
- True if the block at that
Location
is above air.
-
playerCanSpawnHereSafely
public boolean playerCanSpawnHereSafely(org.bukkit.World world, double x, double y, double z)
Checks if a player can spawn safely at the given coordinates.- Specified by:
playerCanSpawnHereSafely
in interfaceBlockSafety
- Parameters:
world
- TheWorld
.x
- The x-coordinate.y
- The y-coordinate.z
- The z-coordinate.- Returns:
- True if a player can spawn safely at the given coordinates.
-
playerCanSpawnHereSafely
public boolean playerCanSpawnHereSafely(org.bukkit.Location l)
This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air etc. This also ensures there is enough space for a player to spawn!- Specified by:
playerCanSpawnHereSafely
in interfaceBlockSafety
- Parameters:
l
- TheLocation
- Returns:
- Whether the player can spawn safely at the given
Location
-
getSafeBedSpawn
public org.bukkit.Location getSafeBedSpawn(org.bukkit.Location l)
Gets a safe bed spawn location OR null if the bed is invalid.- Specified by:
getSafeBedSpawn
in interfaceBlockSafety
- Parameters:
l
- The location of the bead head (block with the pillow on it).- Returns:
- Safe location around the bed or null if no location was found.
-
getTopBlock
public org.bukkit.Location getTopBlock(org.bukkit.Location l)
Gets the location of the top block at the specifiedLocation
.- Specified by:
getTopBlock
in interfaceBlockSafety
- Parameters:
l
- AnyLocation
.- Returns:
- The
Location
of the top-block.
-
getBottomBlock
public org.bukkit.Location getBottomBlock(org.bukkit.Location l)
Gets the location of the top block at the specifiedLocation
.- Specified by:
getBottomBlock
in interfaceBlockSafety
- Parameters:
l
- AnyLocation
.- Returns:
- The
Location
of the top-block.
-
isSolidBlock
public static boolean isSolidBlock(org.bukkit.Material type)
-
isEntitiyOnTrack
public boolean isEntitiyOnTrack(org.bukkit.Location l)
Checks if an entity would be on track at the specifiedLocation
.- Specified by:
isEntitiyOnTrack
in interfaceBlockSafety
- Parameters:
l
- TheLocation
.- Returns:
- True if an entity would be on tracks at the specified
Location
.
-
canSpawnCartSafely
public boolean canSpawnCartSafely(org.bukkit.entity.Minecart cart)
Checks if the specifiedMinecart
can spawn safely.- Specified by:
canSpawnCartSafely
in interfaceBlockSafety
- Parameters:
cart
- TheMinecart
.- Returns:
- True if the minecart can spawn safely.
-
canSpawnVehicleSafely
public boolean canSpawnVehicleSafely(org.bukkit.entity.Vehicle vehicle)
Checks if the specifiedVehicle
can spawn safely.- Specified by:
canSpawnVehicleSafely
in interfaceBlockSafety
- Parameters:
vehicle
- TheVehicle
.- Returns:
- True if the vehicle can spawn safely.
-
-