Search in sources :

Example 1 with Attachable

use of org.bukkit.material.Attachable in project BKCommonLib by bergerhealer.

the class BlockData method newMaterialData.

/**
     * Creates a new MaterialData instance appropriate for this Block
     * 
     * @return Block Material Data
     */
@SuppressWarnings("deprecation")
public final MaterialData newMaterialData() {
    Material type = this.getType();
    // Null: return AIR
    if (type == null) {
        return new MaterialData(0, (byte) 0);
    }
    // Create new MaterialData + some fixes.
    final MaterialData mdata;
    if (type == Material.GOLD_PLATE || type == Material.IRON_PLATE) {
        // Bukkit bugfix.
        mdata = new org.bukkit.material.PressurePlate(type, (byte) this.getRawData());
    } else {
        mdata = type.getNewData((byte) this.getRawData());
    }
    // Fix attachable face returning NULL sometimes
    if (mdata instanceof Attachable) {
        Attachable att = (Attachable) mdata;
        if (att.getAttachedFace() == null) {
            att.setFacingDirection(BlockFace.NORTH);
        }
    }
    return mdata;
}
Also used : Material(org.bukkit.Material) MaterialData(org.bukkit.material.MaterialData) Attachable(org.bukkit.material.Attachable)

Example 2 with Attachable

use of org.bukkit.material.Attachable in project modules-extra by CubeEngine.

the class ActionBlock method setBlock.

protected boolean setBlock(BlockSection blockData, Location loc, LogAttachment attachment, boolean force, boolean preview, boolean rollback) {
    Block block = loc.getBlock();
    BlockState state = loc.getBlock().getState();
    state.setType(blockData.material);
    if (blockData.material == IRON_DOOR_BLOCK || blockData.material == WOODEN_DOOR) {
        // TODO correct?
        byte data = (byte) (blockData.data & ~8);
        state.setRawData(data);
    } else {
        state.setRawData(blockData.data);
    }
    if (!force && (// TODO correct?
    state.getData() instanceof Attachable || BlockUtil.isDetachableFromBelow(blockData.material))) {
        return false;
    }
    if (state.getData() instanceof Bed) {
        Bed bed = (Bed) state.getData();
        Block headBed = block.getRelative(bed.getFacing());
        BlockState headState = headBed.getState();
        headState.setType(AIR);
        if (preview) {
            attachment.addToPreview(headState);
        } else {
            headState.update(true, false);
        }
    } else if (state.getType() == WOOD_DOOR || state.getType() == IRON_DOOR_BLOCK) {
        Block topDoor = block.getRelative(UP);
        if (topDoor.getType() == state.getType()) {
            BlockState topState = topDoor.getState();
            topState.setType(AIR);
            if (preview) {
                attachment.addToPreview(topState);
            } else {
                topState.update(true, false);
            }
        }
    }
    if (preview) {
        attachment.addToPreview(state);
    } else {
        state.update(true, false);
    }
    if (rollback) {
        if (this instanceof SignBreak || this instanceof PlayerSignBreak) {
            String[] lines = this instanceof SignBreak ? ((SignBreak) this).oldLines : ((PlayerSignBreak) this).oldLines;
            if (preview) {
                attachment.addToPreview(state.getLocation(), lines);
            } else {
                Sign sign = (Sign) state.getBlock().getState();
                int i = 0;
                for (String line : lines) {
                    sign.setLine(i++, line);
                }
                sign.update();
            }
        } else if (blockData.is(BED_BLOCK)) {
            Bed bed = (Bed) state.getData();
            BlockState headBed = block.getRelative(bed.getFacing()).getState();
            headBed.setType(BED_BLOCK);
            Bed bedhead = (Bed) headBed.getData();
            bedhead.setHeadOfBed(true);
            bedhead.setFacingDirection(bed.getFacing());
            if (preview) {
                attachment.addToPreview(headBed);
            } else {
                headBed.update(true);
            }
        } else if (blockData.is(WOOD_DOOR, IRON_DOOR_BLOCK)) {
            byte data = (byte) (((blockData.data & 8) == 8) ? 9 : 8);
            BlockState topDoor = block.getRelative(UP).getState();
            topDoor.setType(state.getType());
            topDoor.setRawData(data);
            if (preview) {
                attachment.addToPreview(topDoor);
            } else {
                topDoor.update(true);
            }
        } else if (!preview) {
            if (this instanceof PlayerNoteBlockBreak) {
                NoteBlock noteblock = (NoteBlock) state.getBlock().getState();
                noteblock.setNote(((PlayerNoteBlockBreak) this).note);
                noteblock.update();
            } else if (this instanceof PlayerJukeboxBreak) {
                Jukebox jukebox = (Jukebox) state.getBlock().getState();
                jukebox.setPlaying(((PlayerJukeboxBreak) this).disc);
                jukebox.update();
            } else if (this instanceof PlayerContainerBreak) {
                InventoryHolder inventoryHolder = (InventoryHolder) state.getBlock().getState();
                inventoryHolder.getInventory().setContents(((PlayerContainerBreak) this).contents);
                ((BlockState) inventoryHolder).update();
            }
        }
    }
    return true;
}
Also used : Bed(org.bukkit.material.Bed) Jukebox(org.bukkit.block.Jukebox) PlayerSignBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerSignBreak) NoteBlock(org.bukkit.block.NoteBlock) PlayerContainerBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerContainerBreak) PlayerNoteBlockBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerNoteBlockBreak) BlockState(org.bukkit.block.BlockState) PlayerJukeboxBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerJukeboxBreak) Block(org.bukkit.block.Block) NoteBlock(org.bukkit.block.NoteBlock) Sign(org.bukkit.block.Sign) PlayerSignBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerSignBreak) Attachable(org.bukkit.material.Attachable) InventoryHolder(org.bukkit.inventory.InventoryHolder)

Example 3 with Attachable

use of org.bukkit.material.Attachable in project Towny by ElgarL.

the class ProtectionRegenTask method replaceProtections.

public void replaceProtections() {
    try {
        Block block = state.getBlock();
        if (state.getData() instanceof Door) {
            Door door = (Door) state.getData();
            Block topHalf;
            Block bottomHalf;
            if (door.isTopHalf()) {
                topHalf = block;
                bottomHalf = block.getRelative(BlockFace.DOWN);
            } else {
                bottomHalf = block;
                topHalf = block.getRelative(BlockFace.UP);
            }
            door.setTopHalf(true);
            topHalf.setTypeIdAndData(state.getTypeId(), state.getData().getData(), false);
            door.setTopHalf(false);
            bottomHalf.setTypeIdAndData(state.getTypeId(), state.getData().getData(), false);
        } else if (state instanceof Sign) {
            block.setTypeIdAndData(state.getTypeId(), state.getData().getData(), false);
            Sign sign = (Sign) block.getState();
            int i = 0;
            for (String line : ((Sign) state).getLines()) sign.setLine(i++, line);
            sign.update(true);
        } else if (state instanceof CreatureSpawner) {
            block.setTypeIdAndData(state.getTypeId(), state.getData().getData(), false);
            ((CreatureSpawner) block.getState()).setSpawnedType(((CreatureSpawner) state).getSpawnedType());
        } else if (state instanceof InventoryHolder) {
            block.setTypeId(state.getTypeId(), false);
            // Container to receive the inventory
            Inventory container = ((InventoryHolder) block.getState()).getInventory();
            container.setContents(contents.toArray(new ItemStack[0]));
            block.setData(state.getData().getData(), false);
        } else if (state.getData() instanceof PistonExtensionMaterial) {
            PistonExtensionMaterial extension = (PistonExtensionMaterial) state.getData();
            Block piston = block.getRelative(extension.getAttachedFace());
            block.setTypeIdAndData(state.getTypeId(), state.getData().getData(), false);
            if (altState != null) {
                piston.setTypeIdAndData(altState.getTypeId(), altState.getData().getData(), false);
            }
        } else if (state.getData() instanceof Attachable) {
            Block attachedBlock = block.getRelative(((Attachable) state.getData()).getAttachedFace());
            if (attachedBlock.getTypeId() == 0) {
                attachedBlock.setTypeId(placeholder.getId(), false);
                TownyRegenAPI.addPlaceholder(attachedBlock);
            }
            block.setTypeIdAndData(state.getTypeId(), state.getData().getData(), false);
        } else {
            if (NeedsPlaceholder.contains(state.getType())) {
                Block blockBelow = block.getRelative(BlockFace.DOWN);
                if (blockBelow.getTypeId() == 0) {
                    if (state.getType().equals(Material.CROPS)) {
                        blockBelow.setTypeId(Material.SOIL.getId(), true);
                    } else {
                        blockBelow.setTypeId(placeholder.getId(), true);
                    }
                    TownyRegenAPI.addPlaceholder(blockBelow);
                }
            }
            block.setTypeIdAndData(state.getTypeId(), state.getData().getData(), !NeedsPlaceholder.contains(state.getType()));
        }
        TownyRegenAPI.removePlaceholder(block);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : PistonExtensionMaterial(org.bukkit.material.PistonExtensionMaterial) Block(org.bukkit.block.Block) Sign(org.bukkit.block.Sign) Attachable(org.bukkit.material.Attachable) InventoryHolder(org.bukkit.inventory.InventoryHolder) Door(org.bukkit.material.Door) Inventory(org.bukkit.inventory.Inventory) CreatureSpawner(org.bukkit.block.CreatureSpawner)

Example 4 with Attachable

use of org.bukkit.material.Attachable in project Denizen-For-Bukkit by DenizenScript.

the class dLocation method getAttribute.

@Override
public String getAttribute(Attribute attribute) {
    if (attribute == null) {
        return null;
    }
    // -->
    if (attribute.startsWith("above")) {
        return new dLocation(this.clone().add(0, 1, 0)).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("below")) {
        return new dLocation(this.clone().add(0, -1, 0)).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("block")) {
        return new dLocation(getWorld(), getBlockX(), getBlockY(), getBlockZ()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("center")) {
        return new dLocation(getWorld(), getBlockX() + 0.5, getBlockY() + 0.5, getBlockZ() + 0.5).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("highest")) {
        return new dLocation(getWorld().getHighestBlockAt(this).getLocation().add(0, -1, 0)).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("base_color")) {
        DyeColor color = ((Banner) getBlock().getState()).getBaseColor();
        return new Element(color != null ? color.name() : "BLACK").getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("has_inventory")) {
        return new Element(getBlock().getState() instanceof InventoryHolder).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("inventory")) {
        dObject obj = Element.handleNull(identify() + ".inventory", getInventory(), "dInventory", attribute.hasAlternative());
        return obj == null ? null : obj.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("material")) {
        return dMaterial.getMaterialFrom(getBlock().getType(), getBlock().getData()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("patterns")) {
        dList list = new dList();
        for (org.bukkit.block.banner.Pattern pattern : ((Banner) getBlock().getState()).getPatterns()) {
            list.add(pattern.getColor().name() + "/" + pattern.getPattern().name());
        }
        return list.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("head_rotation")) {
        return new Element(getSkullRotation(((Skull) getBlock().getState()).getRotation()) + 1).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("switched")) {
        Material type = getBlock().getType();
        if (type == Material.IRON_DOOR_BLOCK || type == Material.WOODEN_DOOR || type == Material.DARK_OAK_DOOR || type == Material.BIRCH_DOOR || type == Material.ACACIA_DOOR || type == Material.JUNGLE_DOOR || type == Material.SPRUCE_DOOR) {
            Location location = this;
            int data = getBlock().getData();
            if (data >= 8) {
                location = clone().add(0, -1, 0);
            }
            return new Element((location.getBlock().getData() & 0x4) > 0).getAttribute(attribute.fulfill(1));
        } else if (type == Material.TRAP_DOOR || type == Material.IRON_TRAPDOOR) {
            return new Element((getBlock().getData() & 0x4) > 0).getAttribute(attribute.fulfill(1));
        } else {
            return new Element((getBlock().getData() & 0x8) > 0).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("sign_contents")) {
        if (getBlock().getState() instanceof Sign) {
            return new dList(Arrays.asList(((Sign) getBlock().getState()).getLines())).getAttribute(attribute.fulfill(1));
        } else {
            return null;
        }
    }
    // -->
    if (attribute.startsWith("spawner_type")) {
        if (getBlock().getState() instanceof CreatureSpawner) {
            return new dEntity(DenizenEntityType.getByName(((CreatureSpawner) getBlock().getState()).getSpawnedType().name())).getAttribute(attribute.fulfill(1));
        } else {
            return null;
        }
    }
    // -->
    if (attribute.startsWith("drops")) {
        Collection<ItemStack> its = getBlock().getDrops();
        dList list = new dList();
        for (ItemStack it : its) {
            list.add(new dItem(it).identify());
        }
        return list.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("skull_type")) {
        BlockState blockState = getBlock().getState();
        if (blockState instanceof Skull) {
            String t = ((Skull) blockState).getSkullType().name();
            return new Element(t).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("skull_name")) {
        BlockState blockState = getBlock().getState();
        if (blockState instanceof Skull) {
            PlayerProfile profile = NMSHandler.getInstance().getBlockHelper().getPlayerProfile((Skull) blockState);
            String n = profile.getName();
            if (n == null) {
                n = ((Skull) blockState).getOwningPlayer().getName();
            }
            return new Element(n).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("skull_skin")) {
        BlockState blockState = getBlock().getState();
        if (blockState instanceof Skull) {
            PlayerProfile profile = NMSHandler.getInstance().getBlockHelper().getPlayerProfile((Skull) blockState);
            String name = profile.getName();
            UUID uuid = profile.getUniqueId();
            String texture = profile.getTexture();
            attribute = attribute.fulfill(1);
            // -->
            if (attribute.startsWith("full")) {
                return new Element((uuid != null ? uuid : name != null ? name : null) + (texture != null ? "|" + texture : "")).getAttribute(attribute.fulfill(1));
            }
            return new Element(uuid != null ? uuid.toString() : name != null ? name : null).getAttribute(attribute);
        } else {
            return null;
        }
    }
    // -->
    if (attribute.startsWith("simple.formatted")) {
        return new Element("X '" + getBlockX() + "', Y '" + getBlockY() + "', Z '" + getBlockZ() + "', in world '" + getWorld().getName() + "'").getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("simple")) {
        if (getWorld() == null) {
            return new Element(getBlockX() + "," + getBlockY() + "," + getBlockZ()).getAttribute(attribute.fulfill(1));
        } else {
            return new Element(getBlockX() + "," + getBlockY() + "," + getBlockZ() + "," + getWorld().getName()).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("precise_impact_normal")) {
        int range = attribute.getIntContext(1);
        if (range < 1) {
            range = 200;
        }
        double xzLen = Math.cos((getPitch() % 360) * (Math.PI / 180));
        double nx = xzLen * Math.sin(-getYaw() * (Math.PI / 180));
        double ny = Math.sin(getPitch() * (Math.PI / 180));
        double nz = xzLen * Math.cos(getYaw() * (Math.PI / 180));
        Location location = NMSHandler.getInstance().getEntityHelper().getImpactNormal(this, new org.bukkit.util.Vector(nx, -ny, nz), range);
        if (location != null) {
            return new dLocation(location).getAttribute(attribute.fulfill(1));
        } else {
            return null;
        }
    }
    // -->
    if (attribute.startsWith("precise_cursor_on")) {
        int range = attribute.getIntContext(1);
        if (range < 1) {
            range = 200;
        }
        double xzLen = Math.cos((getPitch() % 360) * (Math.PI / 180));
        double nx = xzLen * Math.sin(-getYaw() * (Math.PI / 180));
        double ny = Math.sin(getPitch() * (Math.PI / 180));
        double nz = xzLen * Math.cos(getYaw() * (Math.PI / 180));
        Location location = NMSHandler.getInstance().getEntityHelper().rayTrace(this, new org.bukkit.util.Vector(nx, -ny, nz), range);
        if (location != null) {
            return new dLocation(location).getAttribute(attribute.fulfill(1));
        } else {
            return null;
        }
    }
    // -->
    if (attribute.startsWith("points_between")) {
        dLocation target = dLocation.valueOf(attribute.getContext(1));
        if (target == null) {
            return null;
        }
        attribute = attribute.fulfill(1);
        // <--[tag]
        // @attribute <l@location.points_between[<location>].distance[<#.#>]>
        // @returns dList(dLocation)
        // @description
        // Finds all locations between this location and another, separated by the specified distance each.
        // -->
        double rad = 1d;
        if (attribute.startsWith("distance")) {
            rad = attribute.getDoubleContext(1);
            attribute = attribute.fulfill(1);
        }
        dList list = new dList();
        org.bukkit.util.Vector rel = target.toVector().subtract(this.toVector());
        double len = rel.length();
        rel = rel.multiply(1d / len);
        for (double i = 0d; i < len; i += rad) {
            list.add(new dLocation(this.clone().add(rel.clone().multiply(i))).identify());
        }
        return list.getAttribute(attribute);
    }
    // -->
    if (attribute.startsWith("facing_blocks")) {
        int range = attribute.getIntContext(1);
        if (range < 1) {
            range = 100;
        }
        dList list = new dList();
        BlockIterator iterator = new BlockIterator(this, 0, range);
        while (iterator.hasNext()) {
            list.add(new dLocation(iterator.next().getLocation()).identify());
        }
        return list.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("line_of_sight") && attribute.hasContext(1)) {
        dLocation location = dLocation.valueOf(attribute.getContext(1));
        if (location != null) {
            return new Element(NMSHandler.getInstance().getEntityHelper().canTrace(getWorld(), toVector(), location.toVector())).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("direction.vector")) {
        double xzLen = Math.cos((getPitch() % 360) * (Math.PI / 180));
        double nx = xzLen * Math.sin(-getYaw() * (Math.PI / 180));
        double ny = Math.sin(getPitch() * (Math.PI / 180));
        double nz = xzLen * Math.cos(getYaw() * (Math.PI / 180));
        return new dLocation(getWorld(), nx, -ny, nz).getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("direction")) {
        // Get the cardinal direction from this location to another
        if (attribute.hasContext(1) && dLocation.matches(attribute.getContext(1))) {
            // Subtract this location's vector from the other location's vector,
            // not the other way around
            dLocation target = dLocation.valueOf(attribute.getContext(1));
            attribute = attribute.fulfill(1);
            EntityHelper entityHelper = NMSHandler.getInstance().getEntityHelper();
            // -->
            if (attribute.startsWith("yaw")) {
                return new Element(entityHelper.normalizeYaw(entityHelper.getYaw(target.toVector().subtract(this.toVector()).normalize()))).getAttribute(attribute.fulfill(1));
            } else {
                return new Element(entityHelper.getCardinal(entityHelper.getYaw(target.toVector().subtract(this.toVector()).normalize()))).getAttribute(attribute);
            }
        } else // Get a cardinal direction from this location's yaw
        {
            return new Element(NMSHandler.getInstance().getEntityHelper().getCardinal(getYaw())).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("face") && attribute.hasContext(1)) {
        Location two = dLocation.valueOf(attribute.getContext(1));
        return new dLocation(NMSHandler.getInstance().getEntityHelper().faceLocation(this, two)).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("facing")) {
        if (attribute.hasContext(1)) {
            // The default number of degrees if there is no degrees attribute
            int degrees = 45;
            // The attribute to fulfill from
            int attributePos = 1;
            // -->
            if (attribute.getAttribute(2).startsWith("degrees") && attribute.hasContext(2) && aH.matchesInteger(attribute.getContext(2))) {
                degrees = attribute.getIntContext(2);
                attributePos++;
            }
            if (dLocation.matches(attribute.getContext(1))) {
                return new Element(NMSHandler.getInstance().getEntityHelper().isFacingLocation(this, dLocation.valueOf(attribute.getContext(1)), degrees)).getAttribute(attribute.fulfill(attributePos));
            } else if (dEntity.matches(attribute.getContext(1))) {
                return new Element(NMSHandler.getInstance().getEntityHelper().isFacingLocation(this, dEntity.valueOf(attribute.getContext(1)).getBukkitEntity().getLocation(), degrees)).getAttribute(attribute.fulfill(attributePos));
            }
        }
    }
    // -->
    if (attribute.startsWith("pitch")) {
        return new Element(getPitch()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("with_pose")) {
        String context = attribute.getContext(1);
        Float pitch = 0f;
        Float yaw = 0f;
        if (dEntity.matches(context)) {
            dEntity ent = dEntity.valueOf(context);
            if (ent.isSpawned()) {
                pitch = ent.getBukkitEntity().getLocation().getPitch();
                yaw = ent.getBukkitEntity().getLocation().getYaw();
            }
        } else if (context.split(",").length == 2) {
            String[] split = context.split(",");
            pitch = Float.valueOf(split[0]);
            yaw = Float.valueOf(split[1]);
        }
        dLocation loc = dLocation.valueOf(identify());
        loc.setPitch(pitch);
        loc.setYaw(yaw);
        return loc.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("yaw.simple")) {
        float yaw = NMSHandler.getInstance().getEntityHelper().normalizeYaw(getYaw());
        if (yaw < 45) {
            return new Element("South").getAttribute(attribute.fulfill(2));
        } else if (yaw < 135) {
            return new Element("West").getAttribute(attribute.fulfill(2));
        } else if (yaw < 225) {
            return new Element("North").getAttribute(attribute.fulfill(2));
        } else if (yaw < 315) {
            return new Element("East").getAttribute(attribute.fulfill(2));
        } else {
            return new Element("South").getAttribute(attribute.fulfill(2));
        }
    }
    // -->
    if (attribute.startsWith("yaw.raw")) {
        return new Element(getYaw()).getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("yaw")) {
        return new Element(NMSHandler.getInstance().getEntityHelper().normalizeYaw(getYaw())).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("rotate_around_x") && attribute.hasContext(1)) {
        double angle = attribute.getDoubleContext(1);
        double cos = Math.cos(angle);
        double sin = Math.sin(angle);
        double y = (getY() * cos) - (getZ() * sin);
        double z = (getY() * sin) + (getZ() * cos);
        Location location = clone();
        location.setY(y);
        location.setZ(z);
        return new dLocation(location).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("rotate_around_y") && attribute.hasContext(1)) {
        double angle = attribute.getDoubleContext(1);
        double cos = Math.cos(angle);
        double sin = Math.sin(angle);
        double x = (getX() * cos) + (getZ() * sin);
        double z = (getX() * -sin) + (getZ() * cos);
        Location location = clone();
        location.setX(x);
        location.setZ(z);
        return new dLocation(location).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("rotate_around_z") && attribute.hasContext(1)) {
        double angle = attribute.getDoubleContext(1);
        double cos = Math.cos(angle);
        double sin = Math.sin(angle);
        double x = (getX() * cos) - (getY() * sin);
        double y = (getZ() * sin) + (getY() * cos);
        Location location = clone();
        location.setX(x);
        location.setY(y);
        return new dLocation(location).getAttribute(attribute.fulfill(1));
    }
    if (attribute.matches("find") || attribute.startsWith("nearest")) {
        attribute.fulfill(1);
        // -->
        if (attribute.startsWith("blocks") && attribute.getAttribute(2).startsWith("within") && attribute.hasContext(2)) {
            ArrayList<dLocation> found = new ArrayList<dLocation>();
            int radius = aH.matchesInteger(attribute.getContext(2)) ? attribute.getIntContext(2) : 10;
            List<dMaterial> materials = new ArrayList<dMaterial>();
            if (attribute.hasContext(1)) {
                materials = dList.valueOf(attribute.getContext(1)).filter(dMaterial.class);
            }
            // Avoid NPE from invalid materials
            if (materials == null) {
                return null;
            }
            int max = Settings.blockTagsMaxBlocks();
            int index = 0;
            attribute.fulfill(2);
            Location tstart = getBlock().getLocation();
            double tstartY = tstart.getY();
            fullloop: for (int x = -(radius); x <= radius; x++) {
                for (int y = -(radius); y <= radius; y++) {
                    double newY = y + tstartY;
                    if (newY < 0 || newY > 255) {
                        continue;
                    }
                    for (int z = -(radius); z <= radius; z++) {
                        index++;
                        if (index > max) {
                            break fullloop;
                        }
                        if (Utilities.checkLocation(this, tstart.clone().add(x + 0.5, y + 0.5, z + 0.5), radius)) {
                            if (!materials.isEmpty()) {
                                for (dMaterial material : materials) {
                                    if (material.hasData() && material.getData() != 0) {
                                        // TODO: less arbitrary matching
                                        if (material.matchesMaterialData(tstart.clone().add(x, y, z).getBlock().getState().getData())) {
                                            found.add(new dLocation(tstart.clone().add(x, y, z)));
                                        }
                                    } else if (material.getMaterial() == tstart.clone().add(x, y, z).getBlock().getType()) {
                                        found.add(new dLocation(tstart.clone().add(x, y, z)));
                                    }
                                }
                            } else {
                                found.add(new dLocation(tstart.clone().add(x, y, z)));
                            }
                        }
                    }
                }
            }
            Collections.sort(found, new Comparator<dLocation>() {

                @Override
                public int compare(dLocation loc1, dLocation loc2) {
                    return dLocation.this.compare(loc1, loc2);
                }
            });
            return new dList(found).getAttribute(attribute);
        } else // -->
        if (attribute.startsWith("surface_blocks") && attribute.getAttribute(2).startsWith("within") && attribute.hasContext(2)) {
            ArrayList<dLocation> found = new ArrayList<dLocation>();
            double radius = aH.matchesDouble(attribute.getContext(2)) ? attribute.getDoubleContext(2) : 10;
            List<dMaterial> materials = new ArrayList<dMaterial>();
            if (attribute.hasContext(1)) {
                materials = dList.valueOf(attribute.getContext(1)).filter(dMaterial.class);
            }
            // Avoid NPE from invalid materials
            if (materials == null) {
                return null;
            }
            int max = Settings.blockTagsMaxBlocks();
            int index = 0;
            attribute.fulfill(2);
            Location loc = getBlock().getLocation().add(0.5f, 0.5f, 0.5f);
            fullloop: for (double x = -(radius); x <= radius; x++) {
                for (double y = -(radius); y <= radius; y++) {
                    for (double z = -(radius); z <= radius; z++) {
                        index++;
                        if (index > max) {
                            break fullloop;
                        }
                        if (Utilities.checkLocation(loc, getBlock().getLocation().add(x + 0.5, y + 0.5, z + 0.5), radius)) {
                            Location l = getBlock().getLocation().clone().add(x, y, z);
                            if (!materials.isEmpty()) {
                                for (dMaterial material : materials) {
                                    if (material.matchesMaterialData(getBlock().getLocation().clone().add(x, y, z).getBlock().getType().getNewData(getBlock().getLocation().clone().add(x, y, z).getBlock().getData()))) {
                                        if (l.clone().add(0, 1, 0).getBlock().getType() == Material.AIR && l.clone().add(0, 2, 0).getBlock().getType() == Material.AIR && l.getBlock().getType() != Material.AIR) {
                                            found.add(new dLocation(getBlock().getLocation().clone().add(x + 0.5, y, z + 0.5)));
                                        }
                                    }
                                }
                            } else {
                                if (l.clone().add(0, 1, 0).getBlock().getType() == Material.AIR && l.clone().add(0, 2, 0).getBlock().getType() == Material.AIR && l.getBlock().getType() != Material.AIR) {
                                    found.add(new dLocation(getBlock().getLocation().clone().add(x + 0.5, y, z + 0.5)));
                                }
                            }
                        }
                    }
                }
            }
            Collections.sort(found, new Comparator<dLocation>() {

                @Override
                public int compare(dLocation loc1, dLocation loc2) {
                    return dLocation.this.compare(loc1, loc2);
                }
            });
            return new dList(found).getAttribute(attribute);
        } else // -->
        if (attribute.startsWith("players") && attribute.getAttribute(2).startsWith("within") && attribute.hasContext(2)) {
            ArrayList<dPlayer> found = new ArrayList<dPlayer>();
            double radius = aH.matchesDouble(attribute.getContext(2)) ? attribute.getDoubleContext(2) : 10;
            attribute.fulfill(2);
            for (Player player : Bukkit.getOnlinePlayers()) {
                if (!player.isDead() && Utilities.checkLocation(this, player.getLocation(), radius)) {
                    found.add(new dPlayer(player));
                }
            }
            Collections.sort(found, new Comparator<dPlayer>() {

                @Override
                public int compare(dPlayer pl1, dPlayer pl2) {
                    return dLocation.this.compare(pl1.getLocation(), pl2.getLocation());
                }
            });
            return new dList(found).getAttribute(attribute);
        } else // -->
        if (attribute.startsWith("npcs") && attribute.getAttribute(2).startsWith("within") && attribute.hasContext(2)) {
            ArrayList<dNPC> found = new ArrayList<dNPC>();
            double radius = aH.matchesDouble(attribute.getContext(2)) ? attribute.getDoubleContext(2) : 10;
            attribute.fulfill(2);
            for (dNPC npc : DenizenAPI.getSpawnedNPCs()) {
                if (Utilities.checkLocation(this.getBlock().getLocation(), npc.getLocation(), radius)) {
                    found.add(npc);
                }
            }
            Collections.sort(found, new Comparator<dNPC>() {

                @Override
                public int compare(dNPC npc1, dNPC npc2) {
                    return dLocation.this.compare(npc1.getLocation(), npc2.getLocation());
                }
            });
            return new dList(found).getAttribute(attribute);
        } else // -->
        if (attribute.startsWith("entities") && attribute.getAttribute(2).startsWith("within") && attribute.hasContext(2)) {
            dList ent_list = new dList();
            if (attribute.hasContext(1)) {
                ent_list = dList.valueOf(attribute.getContext(1));
            }
            ArrayList<dEntity> found = new ArrayList<dEntity>();
            double radius = aH.matchesDouble(attribute.getContext(2)) ? attribute.getDoubleContext(2) : 10;
            attribute.fulfill(2);
            for (Entity entity : getWorld().getEntities()) {
                if (Utilities.checkLocation(this, entity.getLocation(), radius)) {
                    dEntity current = new dEntity(entity);
                    if (!ent_list.isEmpty()) {
                        for (String ent : ent_list) {
                            if (current.comparedTo(ent)) {
                                found.add(current);
                                break;
                            }
                        }
                    } else {
                        found.add(current);
                    }
                }
            }
            Collections.sort(found, new Comparator<dEntity>() {

                @Override
                public int compare(dEntity ent1, dEntity ent2) {
                    return dLocation.this.compare(ent1.getLocation(), ent2.getLocation());
                }
            });
            return new dList(found).getAttribute(attribute);
        } else // -->
        if (attribute.startsWith("living_entities") && attribute.getAttribute(2).startsWith("within") && attribute.hasContext(2)) {
            ArrayList<dEntity> found = new ArrayList<dEntity>();
            double radius = aH.matchesDouble(attribute.getContext(2)) ? attribute.getDoubleContext(2) : 10;
            attribute.fulfill(2);
            for (Entity entity : getWorld().getEntities()) {
                if (entity instanceof LivingEntity && Utilities.checkLocation(this, entity.getLocation(), radius)) {
                    found.add(new dEntity(entity));
                }
            }
            Collections.sort(found, new Comparator<dEntity>() {

                @Override
                public int compare(dEntity ent1, dEntity ent2) {
                    return dLocation.this.compare(ent1.getLocation(), ent2.getLocation());
                }
            });
            return new dList(found).getAttribute(attribute);
        }
    }
    // -->
    if (attribute.startsWith("find_path") && attribute.hasContext(1)) {
        dLocation two = dLocation.valueOf(attribute.getContext(1));
        if (two == null) {
            return null;
        }
        List<dLocation> locs = PathFinder.getPath(this, two);
        dList list = new dList();
        for (dLocation loc : locs) {
            list.add(loc.identify());
        }
        return list.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("formatted.citizens")) {
        return new Element(getX() + ":" + getY() + ":" + getZ() + ":" + getWorld().getName()).getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("formatted")) {
        return new Element("X '" + getX() + "', Y '" + getY() + "', Z '" + getZ() + "', in world '" + getWorld().getName() + "'").getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("chunk") || attribute.startsWith("get_chunk")) {
        return new dChunk(this).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("raw")) {
        dLocation rawLocation = new dLocation(this);
        rawLocation.setRaw(true);
        return rawLocation.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("world")) {
        return dWorld.mirrorBukkitWorld(getWorld()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("x")) {
        return new Element(getX()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("y")) {
        return new Element(getY()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("z")) {
        return new Element(getZ()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("notable_name")) {
        String notname = NotableManager.getSavedId(this);
        if (notname == null) {
            return null;
        }
        return new Element(notname).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("add") && attribute.hasContext(1)) {
        // TODO: Just dLocation.valueOf?
        String[] ints = attribute.getContext(1).replace("l@", "").split(",", 4);
        if (ints.length >= 3) {
            if ((aH.matchesDouble(ints[0]) || aH.matchesInteger(ints[0])) && (aH.matchesDouble(ints[1]) || aH.matchesInteger(ints[1])) && (aH.matchesDouble(ints[2]) || aH.matchesInteger(ints[2]))) {
                return new dLocation(this.clone().add(Double.valueOf(ints[0]), Double.valueOf(ints[1]), Double.valueOf(ints[2]))).getAttribute(attribute.fulfill(1));
            }
        } else if (dLocation.matches(attribute.getContext(1))) {
            return new dLocation(this.clone().add(dLocation.valueOf(attribute.getContext(1)))).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("sub") && attribute.hasContext(1)) {
        // TODO: Just dLocation.valueOf?
        String[] ints = attribute.getContext(1).replace("l@", "").split(",", 4);
        if (ints.length == 3 || ints.length == 4) {
            if ((aH.matchesDouble(ints[0]) || aH.matchesInteger(ints[0])) && (aH.matchesDouble(ints[1]) || aH.matchesInteger(ints[1])) && (aH.matchesDouble(ints[2]) || aH.matchesInteger(ints[2]))) {
                return new dLocation(this.clone().subtract(Double.valueOf(ints[0]), Double.valueOf(ints[1]), Double.valueOf(ints[2]))).getAttribute(attribute.fulfill(1));
            }
        } else if (dLocation.matches(attribute.getContext(1))) {
            return new dLocation(this.clone().subtract(dLocation.valueOf(attribute.getContext(1)))).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("mul") && attribute.hasContext(1)) {
        return new dLocation(this.clone().multiply(Double.parseDouble(attribute.getContext(1)))).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("div") && attribute.hasContext(1)) {
        return new dLocation(this.clone().multiply(1D / Double.parseDouble(attribute.getContext(1)))).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("normalize")) {
        double len = Math.sqrt(Math.pow(getX(), 2) + Math.pow(getY(), 2) + Math.pow(getZ(), 2));
        if (len == 0) {
            return this.getAttribute(attribute.fulfill(1));
        } else {
            return new dLocation(this.clone().multiply(1D / len)).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("vector_length")) {
        return new Element(Math.sqrt(Math.pow(getX(), 2) + Math.pow(getY(), 2) + Math.pow(getZ(), 2))).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("distance_squared") && attribute.hasContext(1)) {
        if (dLocation.matches(attribute.getContext(1))) {
            dLocation toLocation = dLocation.valueOf(attribute.getContext(1));
            if (!getWorld().getName().equalsIgnoreCase(toLocation.getWorld().getName())) {
                if (!attribute.hasAlternative()) {
                    dB.echoError("Can't measure distance between two different worlds!");
                }
                return null;
            }
            return new Element(this.distanceSquared(toLocation)).getAttribute(attribute.fulfill(1));
        }
    }
    // -->
    if (attribute.startsWith("distance") && attribute.hasContext(1)) {
        if (dLocation.matches(attribute.getContext(1))) {
            dLocation toLocation = dLocation.valueOf(attribute.getContext(1));
            // -->
            if (attribute.getAttribute(2).startsWith("horizontal")) {
                // -->
                if (attribute.getAttribute(3).startsWith("multiworld")) {
                    return new Element(Math.sqrt(Math.pow(this.getX() - toLocation.getX(), 2) + Math.pow(this.getZ() - toLocation.getZ(), 2))).getAttribute(attribute.fulfill(3));
                } else if (this.getWorld() == toLocation.getWorld()) {
                    return new Element(Math.sqrt(Math.pow(this.getX() - toLocation.getX(), 2) + Math.pow(this.getZ() - toLocation.getZ(), 2))).getAttribute(attribute.fulfill(2));
                }
            } else // -->
            if (attribute.getAttribute(2).startsWith("vertical")) {
                // -->
                if (attribute.getAttribute(3).startsWith("multiworld")) {
                    return new Element(Math.abs(this.getY() - toLocation.getY())).getAttribute(attribute.fulfill(3));
                } else if (this.getWorld() == toLocation.getWorld()) {
                    return new Element(Math.abs(this.getY() - toLocation.getY())).getAttribute(attribute.fulfill(2));
                }
            }
            if (!getWorld().getName().equalsIgnoreCase(toLocation.getWorld().getName())) {
                if (!attribute.hasAlternative()) {
                    dB.echoError("Can't measure distance between two different worlds!");
                }
                return null;
            } else {
                return new Element(this.distance(toLocation)).getAttribute(attribute.fulfill(1));
            }
        }
    }
    // -->
    if (attribute.startsWith("is_within") && attribute.hasContext(1)) {
        if (dEllipsoid.matches(attribute.getContext(1))) {
            dEllipsoid ellipsoid = dEllipsoid.valueOf(attribute.getContext(1));
            if (ellipsoid != null) {
                return new Element(ellipsoid.contains(this)).getAttribute(attribute.fulfill(1));
            }
        } else {
            dCuboid cuboid = dCuboid.valueOf(attribute.getContext(1));
            if (cuboid != null) {
                return new Element(cuboid.isInsideCuboid(this)).getAttribute(attribute.fulfill(1));
            }
        }
    }
    // -->
    if (attribute.startsWith("biome.formatted")) {
        return new Element(CoreUtilities.toLowerCase(getBlock().getBiome().name()).replace('_', ' ')).getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("biome")) {
        return new dBiome(getBlock().getBiome()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("cuboids")) {
        List<dCuboid> cuboids = dCuboid.getNotableCuboidsContaining(this);
        dList cuboid_list = new dList();
        for (dCuboid cuboid : cuboids) {
            cuboid_list.add(cuboid.identify());
        }
        return cuboid_list.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("ellipsoids")) {
        List<dEllipsoid> ellipsoids = dEllipsoid.getNotableEllipsoidsContaining(this);
        dList ellipsoid_list = new dList();
        for (dEllipsoid ellipsoid : ellipsoids) {
            ellipsoid_list.add(ellipsoid.identify());
        }
        return ellipsoid_list.getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("is_liquid")) {
        return new Element(getBlock().isLiquid()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("light.from_blocks") || attribute.startsWith("light.blocks")) {
        return new Element(getBlock().getLightFromBlocks()).getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("light.from_sky") || attribute.startsWith("light.sky")) {
        return new Element(getBlock().getLightFromSky()).getAttribute(attribute.fulfill(2));
    }
    // -->
    if (attribute.startsWith("light")) {
        return new Element(getBlock().getLightLevel()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("power")) {
        return new Element(getBlock().getBlockPower()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("type")) {
        return new Element("Location").getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("command_block_name") && getBlock().getType() == Material.COMMAND) {
        return new Element(((CommandBlock) getBlock().getState()).getName()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("command_block") && getBlock().getType() == Material.COMMAND) {
        return new Element(((CommandBlock) getBlock().getState()).getCommand()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("furnace_burn_time")) {
        return new Element(((Furnace) getBlock().getState()).getBurnTime()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("furnace_cook_time")) {
        return new Element(((Furnace) getBlock().getState()).getCookTime()).getAttribute(attribute.fulfill(1));
    }
    // -->
    if (attribute.startsWith("attached_to")) {
        BlockFace face = BlockFace.SELF;
        MaterialData data = getBlock().getState().getData();
        if (data instanceof Attachable) {
            face = ((Attachable) data).getAttachedFace();
        }
        if (face != BlockFace.SELF) {
            return new dLocation(getBlock().getRelative(face).getLocation()).getAttribute(attribute.fulfill(1));
        }
    }
    // Iterate through this object's properties' attributes
    for (Property property : PropertyParser.getProperties(this)) {
        String returned = property.getAttribute(attribute);
        if (returned != null) {
            return returned;
        }
    }
    return new Element(identify()).getAttribute(attribute);
}
Also used : Entity(org.bukkit.entity.Entity) LivingEntity(org.bukkit.entity.LivingEntity) Comparator(java.util.Comparator) Player(org.bukkit.entity.Player) PlayerProfile(net.aufdemrand.denizen.nms.util.PlayerProfile) DyeColor(org.bukkit.DyeColor) java.util(java.util) MaterialData(org.bukkit.material.MaterialData) ItemStack(org.bukkit.inventory.ItemStack) BlockIterator(org.bukkit.util.BlockIterator) LivingEntity(org.bukkit.entity.LivingEntity) InventoryHolder(org.bukkit.inventory.InventoryHolder) Property(net.aufdemrand.denizencore.objects.properties.Property) EntityHelper(net.aufdemrand.denizen.nms.interfaces.EntityHelper) Material(org.bukkit.Material) Vector(org.bukkit.util.Vector) Attachable(org.bukkit.material.Attachable) Location(org.bukkit.Location)

Example 5 with Attachable

use of org.bukkit.material.Attachable in project modules-extra by CubeEngine.

the class ListenerBlock method onBlockPhysicsBreak.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPhysicsBreak(final BlockPhysicsEvent event) {
    BlockState oldState = event.getBlock().getState();
    Block blockAttachedTo;
    if (oldState.getData() instanceof Attachable) {
        Attachable attachable = (Attachable) oldState.getData();
        if (attachable.getAttachedFace() == null) {
            // is not attached !?
            return;
        }
        blockAttachedTo = event.getBlock().getRelative(attachable.getAttachedFace());
    } else // block on bottom missing
    {
        if (!BlockUtil.isDetachableFromBelow(oldState.getType())) {
            return;
        }
        blockAttachedTo = event.getBlock().getRelative(BlockFace.DOWN);
    }
    if (blockAttachedTo == null) {
        return;
    }
    if (!blockAttachedTo.getType().isSolid()) {
        Location loc = oldState.getLocation();
        ActionBlock cause = this.plannedPyhsics.remove(loc);
        oldState = adjustBlockForDoubleBlocks(oldState);
        if (cause instanceof ActionPlayerBlock) {
            PlayerBlockBreak action;
            if (oldState instanceof Sign) {
                action = this.set(PlayerSignBreak.class, oldState, null);
                if (action != null) {
                    ((PlayerSignBreak) action).setLines(((Sign) oldState).getLines());
                }
            } else {
                action = this.set(PlayerBlockBreak.class, oldState, null);
            }
            if (action != null) {
                action.setNewBlock(AIR);
                action.player = ((ActionPlayerBlock) cause).player;
                action.reference = this.reference(cause);
                this.logAction(action);
            }
        } else {
            BlockBreak action;
            if (oldState instanceof Sign) {
                action = this.set(SignBreak.class, oldState, null);
                if (action != null) {
                    ((SignBreak) action).setLines(((Sign) oldState).getLines());
                }
            } else {
                action = this.set(BlockBreak.class, oldState, null);
            }
            if (action != null) {
                action.setNewBlock(AIR);
                this.logAction(action);
            }
        }
    }
}
Also used : PlayerBlockBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerBlockBreak) BlockState(org.bukkit.block.BlockState) ActionPlayerBlock(org.cubeengine.module.log.action.block.player.ActionPlayerBlock) PlayerBlockBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerBlockBreak) PlayerSignBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerSignBreak) Block(org.bukkit.block.Block) ActionPlayerBlock(org.cubeengine.module.log.action.block.player.ActionPlayerBlock) Sign(org.bukkit.block.Sign) PlayerSignBreak(org.cubeengine.module.log.action.block.player.destroy.PlayerSignBreak) Attachable(org.bukkit.material.Attachable) Location(org.spongepowered.api.world.Location) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Attachable (org.bukkit.material.Attachable)8 InventoryHolder (org.bukkit.inventory.InventoryHolder)5 Block (org.bukkit.block.Block)4 MaterialData (org.bukkit.material.MaterialData)3 java.util (java.util)2 Sign (org.bukkit.block.Sign)2 Player (org.bukkit.entity.Player)2 EventHandler (org.bukkit.event.EventHandler)2 ItemStack (org.bukkit.inventory.ItemStack)2 Vector (org.bukkit.util.Vector)2 BukkitScriptEvent (com.denizenscript.denizen.events.BukkitScriptEvent)1 NMSHandler (com.denizenscript.denizen.nms.NMSHandler)1 BiomeNMS (com.denizenscript.denizen.nms.abstracts.BiomeNMS)1 EntityHelper (com.denizenscript.denizen.nms.interfaces.EntityHelper)1 PlayerProfile (com.denizenscript.denizen.nms.util.PlayerProfile)1 MaterialDirectional (com.denizenscript.denizen.objects.properties.material.MaterialDirectional)1 MaterialHalf (com.denizenscript.denizen.objects.properties.material.MaterialHalf)1 MaterialPersistent (com.denizenscript.denizen.objects.properties.material.MaterialPersistent)1 MaterialSwitchFace (com.denizenscript.denizen.objects.properties.material.MaterialSwitchFace)1 SwitchCommand (com.denizenscript.denizen.scripts.commands.world.SwitchCommand)1