Package org.bukkit.material

Examples of org.bukkit.material.PistonBaseMaterial


        if (block.getType() == Material.PISTON_STICKY_BASE) {

            List<ItemStack> leftovers = new ArrayList<ItemStack>();

            PistonBaseMaterial p = (PistonBaseMaterial) block.getState().getData();
            Block fac = block.getRelative(p.getFacing());

            if (fac.getType() == Material.CHEST || fac.getType() == Material.TRAPPED_CHEST || fac.getType() == Material.DROPPER || fac.getType() == Material.DISPENSER || fac.getType() == Material.HOPPER) {

                for (ItemStack stack : ((InventoryHolder) fac.getState()).getInventory().getContents()) {
View Full Code Here


            return;
        }

        if(ProtectionUtil.shouldUseProtection() && SignUtil.getBackBlock(event.getBlock()).getType() == Material.PISTON_STICKY_BASE) {

            PistonBaseMaterial pis = (PistonBaseMaterial) SignUtil.getBackBlock(event.getBlock()).getState().getData();
            Block off = SignUtil.getBackBlock(event.getBlock()).getRelative(pis.getFacing());
            if(InventoryUtil.doesBlockHaveInventory(off)) {
                if(!ProtectionUtil.canAccessInventory(event.getPlayer(), off)) {
                    if(CraftBookPlugin.inst().getConfiguration().showPermissionMessages)
                        player.printError("area.use-permission");
                    SignUtil.cancelSign(event);
View Full Code Here

        for(Block bl : searchQueue) {
            if (bl.getType() == Material.GLASS || bl.getType() == Material.STAINED_GLASS)
                searchNearbyPipes(bl, visitedPipes, items, filters, exceptions);
            else if (bl.getType() == Material.PISTON_BASE) {

                PistonBaseMaterial p = (PistonBaseMaterial) bl.getState().getData();

                ChangedSign sign = getSignOnPiston(bl);

                HashSet<ItemStack> pFilters = new HashSet<ItemStack>();
                HashSet<ItemStack> pExceptions = new HashSet<ItemStack>();

                if(sign != null) {

                    for(String line3 : RegexUtil.COMMA_PATTERN.split(sign.getLine(2))) {
                        pFilters.add(ItemSyntax.getItem(line3.trim()));
                    }
                    for(String line4 : RegexUtil.COMMA_PATTERN.split(sign.getLine(3))) {
                        pExceptions.add(ItemSyntax.getItem(line4.trim()));
                    }

                    pFilters.removeAll(Collections.singleton(null));
                    pExceptions.removeAll(Collections.singleton(null));
                }

                List<ItemStack> filteredItems = new ArrayList<ItemStack>(VerifyUtil.withoutNulls(ItemUtil.filterItems(items, pFilters, pExceptions)));

                if(filteredItems.isEmpty())
                    continue;

                List<ItemStack> newItems = new ArrayList<ItemStack>();

                Block fac = bl.getRelative(p.getFacing());
                if (InventoryUtil.doesBlockHaveInventory(fac)) {
                    newItems.addAll(InventoryUtil.addItemsToInventory((InventoryHolder) fac.getState(), filteredItems.toArray(new ItemStack[filteredItems.size()])));
                } else if(fac.getType() == Material.JUKEBOX) {
                    Jukebox juke = (Jukebox) fac.getState();
                    List<ItemStack> its = new ArrayList<ItemStack>(filteredItems);
View Full Code Here

        if (event.getBlock().getType() != Material.PISTON_BASE && event.getBlock().getType() != Material.PISTON_STICKY_BASE) return;

        Set<Tuple2<Types, Block>> types = new HashSet<Tuple2<Types, Block>>();

        // check if this looks at all like something we're interested in first
        PistonBaseMaterial piston = (PistonBaseMaterial) event.getBlock().getState().getData();
        Block sign = event.getBlock().getRelative(piston.getFacing().getOppositeFace());
        Types type = null;

        for (BlockFace face : LocationUtil.getDirectFaces()) {
            if (face == piston.getFacing())
                continue;
            sign = event.getBlock().getRelative(face);
            if(face != BlockFace.UP && face != BlockFace.DOWN && !SignUtil.getBackBlock(sign).getLocation().equals(event.getBlock().getLocation()))
                continue;
            type = checkSign(sign);
View Full Code Here

TOP

Related Classes of org.bukkit.material.PistonBaseMaterial

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.