本文整理汇总了Java中org.bukkit.material.Door类的典型用法代码示例。如果您正苦于以下问题:Java Door类的具体用法?Java Door怎么用?Java Door使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Door类属于org.bukkit.material包,在下文中一共展示了Door类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFaceToRightDoor
import org.bukkit.material.Door; //导入依赖的package包/类
private static BlockFace getFaceToRightDoor(Block bottomHalfDoorBlock) {
Door door = asDoorMaterialOrNull(bottomHalfDoorBlock);
if (door == null) {
throw new RuntimeException("Block " + bottomHalfDoorBlock + " is not a door");
}
switch (door.getFacing()) {
case WEST:
return BlockFace.SOUTH;
case NORTH:
return BlockFace.WEST;
case EAST:
return BlockFace.NORTH;
case SOUTH:
return BlockFace.EAST;
default:
throw new RuntimeException("Invalid facing for door: " + door);
}
}
示例2: setOpen
import org.bukkit.material.Door; //导入依赖的package包/类
/**
* Opens or closes the door. If the door has been destroyed after creating
*
* @param open
* Whether the door must be opened (true) or closed (false).
* @param soundAction
* Whether a sound must be played.
*/
public void setOpen(boolean open, SoundCondition soundAction) {
Door leftDoor = asDoorMaterialOrNull(bottomLeftBlock);
if (leftDoor != null) {
// Sound effect
playSound(bottomLeftBlock, open, soundAction);
// Don't play sound for other half
soundAction = SoundCondition.NEVER;
// Door toggle
leftDoor.setOpen(open);
BlockData.set(bottomLeftBlock, leftDoor);
}
Door rightDoor = asDoorMaterialOrNull(bottomRightBlock);
if (rightDoor != null) {
// Sound effect
playSound(bottomRightBlock, open, soundAction);
// Door toggle
rightDoor.setOpen(open);
BlockData.set(bottomRightBlock, rightDoor);
}
}
示例3: translateAction
import org.bukkit.material.Door; //导入依赖的package包/类
@Override
public Text translateAction(User user)
{
// TODO plurals
@SuppressWarnings("deprecation") boolean open = this.newBlock.as(Door.class).isOpen();
if (open)
{
return user.getTranslation(POSITIVE, "{user} opened the {name#block}", this.player.name,
this.oldBlock.name());
}
else
{
return user.getTranslation(POSITIVE, "{user} closed the {name#block}", this.player.name,
this.oldBlock.name());
}
}
示例4: checkMove
import org.bukkit.material.Door; //导入依赖的package包/类
@Override
public void checkMove(MoveData inData)
{
if(inData.isValid())
return;
if(inData.getAboveBlock().getType() == Material.FENCE_GATE)
{
Gate g = (Gate)inData.getAboveBlock().getState().getData();
if(g.isOpen())
inData.setValid(true);
}
else if(inData.getAboveBlock().getType() == Material.WOOD_DOOR || (!this.m_ironDoor && inData.getAboveBlock().getType() == Material.IRON_DOOR_BLOCK))
{
Door d = (Door)inData.getAboveBlock().getState().getData();
if(d.isOpen())
inData.setValid(true);
}
}
示例5: isInteractiveBlock
import org.bukkit.material.Door; //导入依赖的package包/类
/**
* checks if this block would give a reaction if you click on it without
* shifting, e.g. opening a chest or switching a lever
*/
public static boolean isInteractiveBlock(Block b) {
if (b == null || b.getState() == null) {
return false;
}
if (b.getType() == Material.WORKBENCH || b.getType() == Material.ENCHANTMENT_TABLE || b.getType() == Material.ANVIL || b.getType() == Material.BREWING_STAND || b.getState() instanceof InventoryHolder || b.getState() instanceof NoteBlock) {
return true;
}
if (b.getState().getData() instanceof Button || b.getState().getData() instanceof Lever || b.getState().getData() instanceof Door || b.getState().getData() instanceof TrapDoor || b.getState().getData() instanceof Gate || b.getState().getData() instanceof Comparator) {
if (b.getType() != Material.IRON_DOOR && b.getType() != Material.IRON_DOOR_BLOCK && b.getType() != Material.IRON_TRAPDOOR) {
return true;
}
}
return false;
}
示例6: asDoorMaterialOrNull
import org.bukkit.material.Door; //导入依赖的package包/类
private static Door asDoorMaterialOrNull(Block nullableBlock) {
if (nullableBlock == null) {
return null;
}
MaterialData materialData = BlockData.get(nullableBlock);
if (materialData instanceof Door) {
return (Door) materialData;
}
return null;
}
示例7: getHinge
import org.bukkit.material.Door; //导入依赖的package包/类
private static Hinge getHinge(Block topHalfDoorBlock) {
Door door = asDoorMaterialOrNull(topHalfDoorBlock);
if (door != null) {
return door.getHinge() == false ? Hinge.LEFT : Hinge.RIGHT;
}
return Hinge.UNKNOWN;
}
示例8: isTopHalf
import org.bukkit.material.Door; //导入依赖的package包/类
private static boolean isTopHalf(Block doorBlock) {
Door door = asDoorMaterialOrNull(doorBlock);
if (door != null) {
return door.isTopHalf();
}
return false;
}
示例9: isOpen
import org.bukkit.material.Door; //导入依赖的package包/类
/**
* Gets whether the door is currently open. The result is undefined if the
* door is half-open, half-closed.
*
* @return True if the door is currently open, false otherwise.
*/
public boolean isOpen() {
MaterialData materialData = null;
if (bottomRightBlock != null) {
materialData = BlockData.get(bottomRightBlock);
}
if (bottomLeftBlock != null) {
materialData = BlockData.get(bottomLeftBlock);
}
return (materialData instanceof Door) && ((Door) materialData).isOpen();
}
示例10: Door
import org.bukkit.material.Door; //导入依赖的package包/类
public Door() {
}
示例11: clone
import org.bukkit.material.Door; //导入依赖的package包/类
public Door clone() {
return null;
}