Package com.sk89q.craftbook.access

Examples of com.sk89q.craftbook.access.SignInterface


                if (((SignInterface) w.getBlockEntity(x, y, z)).getLine2()
                        .equalsIgnoreCase("[CODE BLOCK]"))
                    for (y--; y >= 0; y--) {
                        if (!(x == x0 && y == y0 && z == z0)
                                && w.getId(x, y, z) == BlockType.WALL_SIGN) {
                            SignInterface n = (SignInterface) w.getBlockEntity(x, y, z);
                            b.append(n.getLine1() + "\n");
                            b.append(n.getLine2() + "\n");
                            b.append(n.getLine3() + "\n");
                            b.append(n.getLine4() + "\n");
                        } else
                            return b.toString();
                    }
            }
        }
View Full Code Here


    private static boolean checkLift(PlayerInterface player, WorldInterface w, Vector pt, boolean up) {
        //int x = pt.getBlockX();
        int y1 = pt.getBlockY();
        //int z = pt.getBlockZ();

        SignInterface sign = getSign(w, pt, up);

        // Found our stop?
        if (sign != null) {
            // We are going to be teleporting to the same place as the player
            // is currently, except with a shifted Y
            int plyX = (int) Math.floor(player.getPosition().getX());
            //int plyY = (int)Math.floor(player.getY());
            int plyZ = (int) Math.floor(player.getPosition().getZ());

            int y2;

            int foundFree = 0;
            boolean foundGround = false;

            int startingY = BlockType.canPassThrough(w.getId(plyX, y1 + 1, plyZ))
                            ? y1 + 1 : y1;

            // Step downwards until we find a spot to stand
            for (y2 = startingY; y2 >= y1 - 5; y2--) {
                int id = w.getId(plyX, y2, plyZ);

                // We have to find a block that the player won't fall through
                if (!BlockType.canPassThrough(id)) {
                    foundGround = true;
                    break;
                }

                foundFree++;
            }

            if (foundFree < 2) {
                player.sendMessage(Colors.GOLD + "Uh oh! You would be obstructed!");
                return false;
            }

            if (!foundGround) {
                player.sendMessage(Colors.GOLD + "Uh oh! You would have nothing to stand on!");
                return false;
            }

            // Teleport!
            player.setPosition(new Vector(player.getPosition().getX(), y2 + 1, player.getPosition().getZ()),
                    (float) player.getYaw(), (float) player.getPitch());


            // Now, we want to read the sign so we can tell the player
            // his or her floor, but as that may not be avilable, we can
            // just print a generic message
            String title = sign.getLine1();

            if (title.length() != 0) {
                player.sendMessage(Colors.GOLD + "Floor: " + title);
            } else {
                player.sendMessage(Colors.GOLD + "You went "
View Full Code Here

        // Find the other side
        for (int i = 0; i < maxLength + 2; i++) {
            int id = world.getId(cur);

            if (id == BlockType.SIGN_POST) {
                SignInterface otherSignText = (SignInterface) world.getBlockEntity(cur);

                if (otherSignText != null) {
                    String line2 = otherSignText.getLine2();

                    if (line2.equalsIgnoreCase("[Door Up]")
                            || line2.equalsIgnoreCase("[Door Down]")
                            || line2.equalsIgnoreCase("[Door End]")) {
                        found = true;
View Full Code Here

        // Find the other side
        for (int i = 0; i < maxLength + 2; i++) {
            int id = world.getId(current);

            if (id == BlockType.SIGN_POST) {
                SignInterface otherSignText =
                        (SignInterface) world.getBlockEntity(current);

                if (otherSignText != null) {
                    String line2 = otherSignText.getLine2();

                    if (line2.equalsIgnoreCase("[Bridge]")
                            || line2.equalsIgnoreCase("[Bridge End]")) {
                        found = true;
                        dist = i;
View Full Code Here

        // This should not happen, but we need to check regardless
        if (!(cBlock instanceof SignInterface)) {
            return null;
        }

        SignInterface sign = (SignInterface) cBlock;

        // Found our stop?
        if (sign.getLine2().equalsIgnoreCase("[Lift Up]")
                || sign.getLine2().equalsIgnoreCase("[Lift Down]")
                || sign.getLine2().equalsIgnoreCase("[Lift]")) {
            return sign;
        }

        return null;
    }
View Full Code Here

    public boolean onSignChange(Player p, Sign sp) {

        PlayerInterface player = new HmodPlayerImpl(p, w);
        BlockVector signPosition = new BlockVector(sp.getX(), sp.getY(), sp.getZ());
        SignInterface s = new HmodSignImpl(w, signPosition, sp);
        for (CraftBookDelegateListener l : main.signChangeListeners) {
            if (l.onSignChange(player, w, signPosition, s)) return true;
        }
        return false;
    }
View Full Code Here

     */
    public void addSingleSourcePosition(WorldInterface w, Vector pos) {

        BlockEntity e = w.getBlockEntity(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
        if (e instanceof SignInterface) {
            SignInterface s = (SignInterface) e;

            if (store && s.getLine2().equalsIgnoreCase("[Black Hole]")) {
                canStore = true;
            }

            if (fetch && s.getLine2().equalsIgnoreCase("[Block Source]")) {
                canFetch = true;
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.access.SignInterface

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.