Package org.bukkit.block

Examples of org.bukkit.block.Chest


        }

        String[] changes = data.split(";");
        Block block = currWorld.getBlockAt(x, y, z);
        if (block.getState() instanceof Chest) {
            Chest chest = (Chest) block.getState();
            Inventory inv = chest.getInventory();
            for (int i = 0; i < changes.length; i++) {
                String change = changes[i];
                try {
                    if (change.equals("")) {
                        continue;
View Full Code Here


                World world = pi.getOpenedChest().getWorld();
                int x = pi.getOpenedChest().getX();
                int y = pi.getOpenedChest().getY();
                int z = pi.getOpenedChest().getZ();
                if(world.getBlockAt(x, y, z).getState() instanceof Chest) {
                    Chest chest = (Chest)world.getBlockAt(x, y, z).getState();
                    ItemStack[] orig = pi.getOldChestContents();
                    ItemStack[] latest = chest.getInventory().getContents();
                    DeltaChest dc = new DeltaChest(pi.getName(), chest, orig, latest);
                    dc.send();
                }
            }
            BBUsersTable.getInstance().userOpenedChest(pi.getName(), null, null); // Chest closed.
View Full Code Here

                World world;
                Block block = event.getClickedBlock();
               
                plugin.closeChestIfOpen(pi);
                if(block.getState() instanceof Chest) {
                    Chest chest = ((Chest)block.getState());
                    // OH SHI-
                    BBUsersTable.getInstance().userOpenedChest(player.getName(),chest,chest.getInventory().getContents());
                    return;
                }
                switch (event.getMaterial()) {
                //TODO Door logging
                case LAVA_BUCKET:
View Full Code Here

        if (ChestShopSign.isAdminShop(nameLine)) {
            return;
        }

        Chest connectedChest = uBlock.findConnectedChest(event.getSign().getBlock());

        if (connectedChest == null) {
            event.setOutcome(NO_CHEST);
            return;
        }

        Player player = event.getPlayer();

        if (Permission.has(player, ADMIN)) {
            return;
        }

        if (!Security.canAccess(player, connectedChest.getBlock())) {
            event.setOutcome(NO_PERMISSION_FOR_CHEST);
        }
    }
View Full Code Here

        OfflinePlayer owner = Bukkit.getOfflinePlayer(uuid);

        Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
        double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));

        Chest chest = uBlock.findConnectedChest(sign);
        Inventory ownerInventory = (ChestShopSign.isAdminShop(sign) ? new AdminInventory() : chest != null ? chest.getInventory() : null);

        ItemStack item = MaterialUtil.getItem(material);

        if (item == null || !NumberUtil.isInteger(quantity)) {
            player.sendMessage(Messages.prefix(Messages.INVALID_SHOP_DETECTED));
View Full Code Here

    public static boolean canOpenOtherShops(Player player) {
        return Permission.has(player, Permission.ADMIN) || Permission.has(player, Permission.MOD);
    }

    private static void showChestGUI(Player player, Block signBlock) {
        Chest chest = uBlock.findConnectedChest(signBlock);

        if (chest == null) {
            player.sendMessage(Messages.prefix(Messages.NO_CHEST_DETECTED));
            return;
        }
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())) {
            player.sendMessage(Messages.prefix(Messages.PROTECTED_SHOP));
        }
    }
View Full Code Here

    private static boolean hasShopBreakingPermission(Player player) {
        return Permission.has(player, ADMIN) || Permission.has(player, MOD);
    }

    private static void sendShopDestroyedEvent(Sign sign, Player player) {
        Chest connectedChest = null;

        if (!ChestShopSign.isAdminShop(sign)) {
            connectedChest = uBlock.findConnectedChest(sign.getBlock());
        }
View Full Code Here

        if (!Security.canPlaceSign(player, event.getSign())) {
            event.setOutcome(NO_PERMISSION_FOR_TERRAIN);
            return;
        }

        Chest connectedChest = uBlock.findConnectedChest(event.getSign().getBlock());
        Location chestLocation = (connectedChest != null ? connectedChest.getLocation() : null);

        BuildPermissionEvent bEvent = new BuildPermissionEvent(player, chestLocation, event.getSign().getLocation());
        ChestShop.callEvent(bEvent);

        if (!bEvent.isAllowed()) {
View Full Code Here

            return;
        }

        Inventory ownerInventory = event.getOwnerInventory();
        Sign sign = event.getSign();
        Chest connectedChest = uBlock.findConnectedChest(sign);

        if (!shopShouldBeRemoved(ownerInventory, event.getStock())) {
            return;
        }

        ShopDestroyedEvent destroyedEvent = new ShopDestroyedEvent(null, event.getSign(), connectedChest);
        ChestShop.callEvent(destroyedEvent);

        sign.getBlock().setType(Material.AIR);

        if (Properties.REMOVE_EMPTY_CHESTS && !ChestShopSign.isAdminShop(ownerInventory) && InventoryUtil.isEmpty(ownerInventory)) {
            connectedChest.getBlock().setType(Material.AIR);
        } else {
            ownerInventory.addItem(new ItemStack(Material.SIGN, 1));
        }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.block.Chest

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.