Search in sources :

Example 11 with WallSign

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;
}
Also used : WallSign(org.bukkit.block.data.type.WallSign) BlockState(org.bukkit.block.BlockState) Sign(org.bukkit.block.data.type.Sign) WallSign(org.bukkit.block.data.type.WallSign) BlockData(org.bukkit.block.data.BlockData)

Example 12 with WallSign

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;
}
Also used : WallSign(org.bukkit.block.data.type.WallSign) BlockState(org.bukkit.block.BlockState) Sign(org.bukkit.block.data.type.Sign) WallSign(org.bukkit.block.data.type.WallSign) BlockData(org.bukkit.block.data.BlockData)

Example 13 with WallSign

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;
}
Also used : WallSign(org.bukkit.block.data.type.WallSign) BlockState(org.bukkit.block.BlockState) BlockData(org.bukkit.block.data.BlockData) Sign(org.bukkit.block.data.type.Sign) WallSign(org.bukkit.block.data.type.WallSign)

Example 14 with WallSign

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();
}
Also used : WallSign(org.bukkit.block.data.type.WallSign) BlockData(org.bukkit.block.data.BlockData)

Example 15 with WallSign

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();
}
Also used : WallSign(org.bukkit.block.data.type.WallSign) BlockData(org.bukkit.block.data.BlockData)

Aggregations

WallSign (org.bukkit.block.data.type.WallSign)22 Block (org.bukkit.block.Block)11 EventHandler (org.bukkit.event.EventHandler)11 BlockData (org.bukkit.block.data.BlockData)10 Player (org.bukkit.entity.Player)9 Sign (org.bukkit.block.Sign)7 BlockState (org.bukkit.block.BlockState)6 Sign (org.bukkit.block.data.type.Sign)5 Location (org.bukkit.Location)4 BlockFace (org.bukkit.block.BlockFace)3 ArrayList (java.util.ArrayList)2 Craft (net.countercraft.movecraft.craft.Craft)2 Material (org.bukkit.Material)2 TownBlock (com.palmergames.bukkit.towny.object.TownBlock)1 Structure (eelfloat.replcraft.Structure)1 InvalidStructure (eelfloat.replcraft.exceptions.InvalidStructure)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Knocker (me.gameisntover.kbffa.api.Knocker)1 DataBlock (me.gameisntover.kbffa.arena.regions.DataBlock)1