org.bukkit.block.data.type.Bed Java Examples

The following examples show how to use org.bukkit.block.data.type.Bed. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlatteningBedUtils.java    From BedWars with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Block getBedNeighbor(Block head) {
    if (!(head.getBlockData() instanceof Bed)) {
        return null;
    }

    if (isBedBlock(head.getRelative(BlockFace.EAST))) {
        return head.getRelative(BlockFace.EAST);
    } else if (isBedBlock(head.getRelative(BlockFace.WEST))) {
        return head.getRelative(BlockFace.WEST);
    } else if (isBedBlock(head.getRelative(BlockFace.SOUTH))) {
        return head.getRelative(BlockFace.SOUTH);
    } else {
        return head.getRelative(BlockFace.NORTH);
    }
}
 
Example #2
Source File: FlatteningBedUtils.java    From BedWars with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static boolean isBedBlock(Block block) {
    if (block == null) {
        return false;
    }

    return block.getBlockData() instanceof Bed;
}
 
Example #3
Source File: FlatteningBedUtils.java    From BedWars with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Block getBedNeighbor(Block head) {
    if (!(head.getBlockData() instanceof Bed)) {
        return null;
    }

    if (isBedBlock(head.getRelative(BlockFace.EAST))) {
        return head.getRelative(BlockFace.EAST);
    } else if (isBedBlock(head.getRelative(BlockFace.WEST))) {
        return head.getRelative(BlockFace.WEST);
    } else if (isBedBlock(head.getRelative(BlockFace.SOUTH))) {
        return head.getRelative(BlockFace.SOUTH);
    } else {
        return head.getRelative(BlockFace.NORTH);
    }
}
 
Example #4
Source File: FlatteningBedUtils.java    From BedWars with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static boolean isBedBlock(Block block) {
    if (block == null) {
        return false;
    }

    return block.getBlockData() instanceof Bed;
}
 
Example #5
Source File: BlockAdapterBlockData.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isBedHead(Block block) {
    if (!(block.getBlockData() instanceof Bed)) {
        throw new IllegalArgumentException("Block is not Bed");
    }
    return ((Bed) block.getBlockData()).getPart() == Bed.Part.HEAD;
}
 
Example #6
Source File: FlatteningRegion.java    From BedWars with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isBedBlock(BlockState block) {
    return block.getBlockData() instanceof Bed;
}
 
Example #7
Source File: FlatteningRegion.java    From BedWars with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isBedHead(BlockState block) {
    return isBedBlock(block) && ((Bed) block.getBlockData()).getPart() == Part.HEAD;
}
 
Example #8
Source File: FlatteningRegion.java    From BedWars with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isBedBlock(BlockState block) {
    return block.getBlockData() instanceof Bed;
}
 
Example #9
Source File: FlatteningRegion.java    From BedWars with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isBedHead(BlockState block) {
    return isBedBlock(block) && ((Bed) block.getBlockData()).getPart() == Part.HEAD;
}