本文整理汇总了Java中org.bukkit.material.SimpleAttachableMaterialData类的典型用法代码示例。如果您正苦于以下问题:Java SimpleAttachableMaterialData类的具体用法?Java SimpleAttachableMaterialData怎么用?Java SimpleAttachableMaterialData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleAttachableMaterialData类属于org.bukkit.material包,在下文中一共展示了SimpleAttachableMaterialData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isSafeLocation
import org.bukkit.material.SimpleAttachableMaterialData; //导入依赖的package包/类
/**
* Checks if this location is safe for a player to teleport to. Used by
* warps and boat exits Unsafe is any liquid or air and also if there's no
* space
*
* @param l
* - Location to be checked
* @return true if safe, otherwise false
*/
public static boolean isSafeLocation(final Location l) {
if (l == null) {
return false;
}
// TODO: improve the safe location finding.
//Bukkit.getLogger().info("DEBUG: " + l.toString());
final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
final Block space1 = l.getBlock();
final Block space2 = l.getBlock().getRelative(BlockFace.UP);
//Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
//Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
//Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
// Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
|| space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
return false;
}
// If ground is AIR, then this is either not good, or they are on slab,
// stair, etc.
if (ground.getType() == Material.AIR) {
// Bukkit.getLogger().info("DEBUG: air");
return false;
}
// In BSkyBlock, liquid may be unsafe
if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
// Check if acid has no damage
if (Settings.acidDamage > 0D) {
// Bukkit.getLogger().info("DEBUG: acid");
return false;
} else if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
|| space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
|| space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
// Lava check only
// Bukkit.getLogger().info("DEBUG: lava");
return false;
}
}
MaterialData md = ground.getState().getData();
if (md instanceof SimpleAttachableMaterialData) {
//Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
if (md instanceof TrapDoor) {
TrapDoor trapDoor = (TrapDoor)md;
if (trapDoor.isOpen()) {
//Bukkit.getLogger().info("DEBUG: trapdoor open");
return false;
}
} else {
return false;
}
//Bukkit.getLogger().info("DEBUG: trapdoor closed");
}
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
|| ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
// Bukkit.getLogger().info("DEBUG: cactus");
return false;
}
// Check that the space is not solid
// The isSolid function is not fully accurate (yet) so we have to
// check
// a few other items
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
return false;
}
if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
return false;
}
// Safe
//Bukkit.getLogger().info("DEBUG: safe!");
return true;
}
开发者ID:tastybento,项目名称:bskyblock,代码行数:81,代码来源:IslandsManager.java
示例2: isSafeLocation
import org.bukkit.material.SimpleAttachableMaterialData; //导入依赖的package包/类
/**
* Checks if this location is safe for a player to teleport to. Used by
* warps and boat exits Unsafe is any liquid or air and also if there's no
* space
*
* @param l
* - Location to be checked
* @return true if safe, otherwise false
*/
public static boolean isSafeLocation(final Location l) {
if (l == null) {
return false;
}
// TODO: improve the safe location finding.
//Bukkit.getLogger().info("DEBUG: " + l.toString());
final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
final Block space1 = l.getBlock();
final Block space2 = l.getBlock().getRelative(BlockFace.UP);
//Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
//Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
//Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
// Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
|| space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
return false;
}
// If ground is AIR, then this is either not good, or they are on slab,
// stair, etc.
if (ground.getType() == Material.AIR) {
// Bukkit.getLogger().info("DEBUG: air");
return false;
}
// In ASkyBlock, liquid may be unsafe
if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
// Check if acid has no damage
if (Settings.acidDamage > 0D) {
// Bukkit.getLogger().info("DEBUG: acid");
return false;
} else if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
|| space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
|| space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
// Lava check only
// Bukkit.getLogger().info("DEBUG: lava");
return false;
}
}
MaterialData md = ground.getState().getData();
if (md instanceof SimpleAttachableMaterialData) {
//Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
if (md instanceof TrapDoor) {
TrapDoor trapDoor = (TrapDoor)md;
if (trapDoor.isOpen()) {
//Bukkit.getLogger().info("DEBUG: trapdoor open");
return false;
}
} else {
return false;
}
//Bukkit.getLogger().info("DEBUG: trapdoor closed");
}
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
|| ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
// Bukkit.getLogger().info("DEBUG: cactus");
return false;
}
// Check that the space is not solid
// The isSolid function is not fully accurate (yet) so we have to
// check
// a few other items
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
return false;
}
if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
return false;
}
// Safe
//Bukkit.getLogger().info("DEBUG: safe!");
return true;
}
开发者ID:tastybento,项目名称:bskyblock,代码行数:81,代码来源:Util.java
示例3: isLocationSafe
import org.bukkit.material.SimpleAttachableMaterialData; //导入依赖的package包/类
/**
* Checks if this location is safe for a player to teleport to.
* Unsafe is any liquid or air and also if there's no space
*
* @param location
* - Location to be checked
* @return true if safe, otherwise false
*/
public Boolean isLocationSafe(Location location) {
// TODO: improve the safe location finding.
// note: water lilies should not be safe
if (location == null) {
return false;
}
final Block ground = location.getBlock().getRelative(BlockFace.DOWN);
final Block space1 = location.getBlock();
final Block space2 = location.getBlock().getRelative(BlockFace.UP);
// If ground is AIR, then this is either not good, or they are on slab,
// stair, etc.
if (ground.getType() == Material.AIR) {
//Bukkit.getLogger().info("DEBUG: air");
return false;
}
// Liquid is unsafe
if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
return false;
}
// Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
|| space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
return false;
}
MaterialData materialData = ground.getState().getData();
if (materialData instanceof SimpleAttachableMaterialData) {
//Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
if (materialData instanceof TrapDoor) {
TrapDoor trapDoor = (TrapDoor)materialData;
if (trapDoor.isOpen()) {
//Bukkit.getLogger().info("DEBUG: trapdoor open");
return false;
}
} else {
return false;
}
//Bukkit.getLogger().info("DEBUG: trapdoor closed");
}
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
|| ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
// Bukkit.getLogger().info("DEBUG: cactus");
return false;
}
// We don't want to be standing on leaves either
if (ground.getType().equals(Material.LEAVES)) {
return false;
}
// Check that the space is not solid
// The isSolid function is not fully accurate (yet) so we have to
// check a few other items
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
return false;
}
if (space2.getType().isSolid() && !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
return false;
}
// Safe
return true;
}
开发者ID:tastybento,项目名称:beaconz,代码行数:74,代码来源:Region.java
示例4: isSafeLocation
import org.bukkit.material.SimpleAttachableMaterialData; //导入依赖的package包/类
/**
* Checks if this location is safe for a player to teleport to. Used by
* warps and boat exits Unsafe is any liquid or air and also if there's no
* space
*
* @param l
* - Location to be checked
* @return true if safe, otherwise false
*/
public static boolean isSafeLocation(final Location l) {
if (l == null) {
return false;
}
// TODO: improve the safe location finding.
//Bukkit.getLogger().info("DEBUG: " + l.toString());
final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
final Block space1 = l.getBlock();
final Block space2 = l.getBlock().getRelative(BlockFace.UP);
//Bukkit.getLogger().info("DEBUG: ground = " + ground.getType());
//Bukkit.getLogger().info("DEBUG: space 1 = " + space1.getType());
//Bukkit.getLogger().info("DEBUG: space 2 = " + space2.getType());
// Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
|| space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) {
return false;
}
// If ground is AIR, then this is either not good, or they are on slab,
// stair, etc.
if (ground.getType() == Material.AIR) {
// Bukkit.getLogger().info("DEBUG: air");
return false;
}
// In aSkyblock, liquid may be unsafe
if (ground.isLiquid() || space1.isLiquid() || space2.isLiquid()) {
// Check if acid has no damage
if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA)
|| space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA)
|| space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) {
// Lava check only
// Bukkit.getLogger().info("DEBUG: lava");
return false;
}
}
MaterialData md = ground.getState().getData();
if (md instanceof SimpleAttachableMaterialData) {
//Bukkit.getLogger().info("DEBUG: trapdoor/button/tripwire hook etc.");
if (md instanceof TrapDoor) {
TrapDoor trapDoor = (TrapDoor)md;
if (trapDoor.isOpen()) {
//Bukkit.getLogger().info("DEBUG: trapdoor open");
return false;
}
} else {
return false;
}
//Bukkit.getLogger().info("DEBUG: trapdoor closed");
}
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().equals(Material.FENCE)
|| ground.getType().equals(Material.NETHER_FENCE) || ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
// Bukkit.getLogger().info("DEBUG: cactus");
return false;
}
// Check that the space is not solid
// The isSolid function is not fully accurate (yet) so we have to
// check
// a few other items
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
if (space1.getType().isSolid() && !space1.getType().equals(Material.SIGN_POST) && !space1.getType().equals(Material.WALL_SIGN)) {
return false;
}
if (space2.getType().isSolid()&& !space2.getType().equals(Material.SIGN_POST) && !space2.getType().equals(Material.WALL_SIGN)) {
return false;
}
// Safe
//Bukkit.getLogger().info("DEBUG: safe!");
return true;
}
开发者ID:tastybento,项目名称:askygrid,代码行数:78,代码来源:GridManager.java
示例5: SimpleAttachableMaterialData
import org.bukkit.material.SimpleAttachableMaterialData; //导入依赖的package包/类
public SimpleAttachableMaterialData() {
// TODO
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:SimpleAttachableMaterialData.java
示例6: clone
import org.bukkit.material.SimpleAttachableMaterialData; //导入依赖的package包/类
public SimpleAttachableMaterialData clone() {
return null;
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:SimpleAttachableMaterialData.java
注:本文中的org.bukkit.material.SimpleAttachableMaterialData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论