use of org.bukkit.block.data.type.WallSign in project AreaShop by NLthijs48.
the class BukkitHandler1_13 method getSignFacing.
// Uses BlockData, which does not yet exist in 1.12-
@Override
public BlockFace getSignFacing(Block block) {
if (block == null) {
return null;
}
BlockState blockState = block.getState();
if (blockState == null) {
return null;
}
BlockData blockData = blockState.getBlockData();
if (blockData == null) {
return null;
}
if (blockData instanceof WallSign) {
return ((WallSign) blockData).getFacing();
} else if (blockData instanceof Sign) {
return ((Sign) blockData).getRotation();
}
return null;
}
use of org.bukkit.block.data.type.WallSign in project AreaShop by NLthijs48.
the class BukkitHandler1_13 method setSignFacing.
// Uses BlockData, WallSign and Sign which don't exist in 1.12-
@Override
public boolean setSignFacing(Block block, BlockFace facing) {
if (block == null || facing == null) {
return false;
}
BlockState blockState = block.getState();
if (blockState == null) {
return false;
}
BlockData blockData = blockState.getBlockData();
if (blockData == null) {
return false;
}
if (blockData instanceof WallSign) {
((WallSign) blockData).setFacing(facing);
} else if (blockData instanceof Sign) {
((Sign) blockData).setRotation(facing);
} else {
return false;
}
block.setBlockData(blockData);
return true;
}
use of org.bukkit.block.data.type.WallSign in project AreaShop by NLthijs48.
the class BukkitHandler1_13 method getSignAttachedTo.
@Override
public Block getSignAttachedTo(Block block) {
if (block == null) {
return null;
}
BlockState blockState = block.getState();
if (blockState == null) {
return null;
}
org.bukkit.block.data.BlockData blockData = blockState.getBlockData();
if (blockData == null) {
return null;
}
if (blockData instanceof WallSign) {
return block.getRelative(((WallSign) blockData).getFacing().getOppositeFace());
} else if (blockData instanceof Sign) {
return block.getRelative(BlockFace.DOWN);
}
return null;
}
use of org.bukkit.block.data.type.WallSign in project MagicPlugin by elBukkit.
the class CompatibilityUtils method getSignFacing.
@Override
public BlockFace getSignFacing(Block signBlock) {
BlockData blockData = signBlock.getBlockData();
if (!(blockData instanceof WallSign)) {
return null;
}
WallSign sign = (WallSign) blockData;
return sign.getFacing();
}
use of org.bukkit.block.data.type.WallSign in project MagicPlugin by elBukkit.
the class CompatibilityUtils method getSignFacing.
@Override
public BlockFace getSignFacing(Block signBlock) {
BlockData blockData = signBlock.getBlockData();
if (!(blockData instanceof WallSign)) {
return null;
}
WallSign sign = (WallSign) blockData;
return sign.getFacing();
}
Aggregations