Package org.bukkit.block

Examples of org.bukkit.block.Sign


        signMaterial.setFacingDirection(chestFace.getOppositeFace());

        signBlock.setType(Material.WALL_SIGN);
        signBlock.setData(signMaterial.getData());

        Sign sign = (Sign) signBlock.getState();

        for (int i = 0; i < lines.length; ++i) {
            sign.setLine(i, lines[i]);
        }

        sign.update(true);
    }
View Full Code Here


        if (!isSign(block) || player.getItemInHand().getType() == Material.SIGN) { // Blocking accidental sign edition
            return;
        }

        Sign sign = (Sign) block.getState();

        if (!ChestShopSign.isValid(sign)) {
            return;
        }
View Full Code Here

        if (Permission.has(player, Permission.ADMIN) || !canBeProtected(block)) {
            return true;
        }

        if (isSign(block)) {
            Sign sign = (Sign) block.getState();

            if (!ChestShopSign.isValid(sign)) {
                return true;
            }

            if (!isShopMember(player, sign)) {
                return false;
            }
        }

        if (isChest(block)) {
            Sign sign = uBlock.getConnectedSign((Chest) block.getState());

            if (sign != null && !isShopMember(player, sign)) {
                return false;
            }
        }
View Full Code Here

    private static final BlockFace[] SIGN_CONNECTION_FACES = {BlockFace.SELF, BlockFace.UP, BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH};

    @EventHandler(ignoreCancelled = true)
    public static void onBlockDestroy(BlockBreakEvent event) {
        Block destroyed = event.getBlock();
        Sign attachedRestrictedSign = getRestrictedSign(destroyed.getLocation());

        if (attachedRestrictedSign == null) {
            return;
        }
View Full Code Here

            if (!Permission.has(player, ADMIN) || !ChestShopSign.isValid(connectedSign)) {
                dropSignAndCancelEvent(event);
                return;
            }

            Sign sign = (Sign) connectedSign.getState();

            if (!ChestShopSign.canAccess(player, sign) && !Permission.has(player, ADMIN)) {
                dropSignAndCancelEvent(event);
            }
View Full Code Here

    }

    @EventHandler
    public static void onShopCreation(ShopCreatedEvent event) {
        Player player = event.getPlayer();
        Sign sign = event.getSign();
        Chest connectedChest = event.getChest();

        if (Properties.PROTECT_SIGN_WITH_LWC) {
            if (!Security.protect(player, sign.getBlock())) {
                player.sendMessage(Messages.prefix(Messages.NOT_ENOUGH_PROTECTIONS));
            }
        }

        if (Properties.PROTECT_CHEST_WITH_LWC && connectedChest != null && Security.protect(player, connectedChest.getBlock())) {
View Full Code Here

    public static void onPreTransaction(PreTransactionEvent event) {
        if (event.isCancelled()) {
            return;
        }

        Sign sign = event.getSign();

        if (isRestrictedShop(sign) && !canAccess(sign, event.getClient())) {
            event.setCancelled(SHOP_IS_RESTRICTED);
        }
    }
View Full Code Here

    public static Sign getRestrictedSign(Location location) {
        Block currentBlock = location.getBlock();

        if (BlockUtil.isSign(currentBlock)) {
            Sign sign = (Sign) currentBlock.getState();

            if (isRestricted(sign)) {
                return sign;
            } else {
                return null;
            }
        }

        for (BlockFace face : SIGN_CONNECTION_FACES) {
            Block relative = currentBlock.getRelative(face);

            if (!BlockUtil.isSign(relative)) {
                continue;
            }

            Sign sign = (Sign) relative.getState();

            if (!BlockUtil.getAttachedBlock(sign).equals(currentBlock)) {
                continue;
            }
View Full Code Here

    public static boolean canDestroy(Player player, Sign sign) {
        if (Permission.has(player, ADMIN)) {
            return true;
        }

        Sign shopSign = getAssociatedSign(sign);
        return ChestShopSign.canAccess(player, shopSign);
    }
View Full Code Here

        if (!BlockUtil.isSign(block)) {
            return;
        }

        Sign sign = (Sign) block.getState();
        Block attachedBlock = BlockUtil.getAttachedBlock(sign);

        if (attachedBlock.getType() == Material.AIR && ChestShopSign.isValid(sign)) {
            List <MetadataValue> values = block.getMetadata(METADATA_NAME);
View Full Code Here

TOP

Related Classes of org.bukkit.block.Sign

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.