Package com.sk89q.craftbook.mechanics.ic

Examples of com.sk89q.craftbook.mechanics.ic.ICVerificationException


        @Override
        public void verify(ChangedSign sign) throws ICVerificationException {

            if(!SearchArea.isValidArea(BukkitUtil.toSign(sign).getBlock(), sign.getLine(2)))
                throw new ICVerificationException("Invalid SearchArea on 3rd line!");
        }
View Full Code Here


        @Override
        public void verify(ChangedSign sign) throws ICVerificationException {

            try {
                int distance = Integer.parseInt(sign.getLine(2));
                if (distance > maxRange) throw new ICVerificationException("Distance too great!");

            } catch (Exception ignored) {
                throw new ICVerificationException("Invalid distance!");
            }
        }
View Full Code Here

        public void verify(ChangedSign sign) throws ICVerificationException {

            try {
                Integer.parseInt(sign.getLine(2));
            } catch (Exception ignored) {
                throw new ICVerificationException("The third line needs to be a number.");
            }
        }
View Full Code Here

                        case '[':
                            bracketCount++;
                            break;
                        case ']':
                            if (bracketCount == 0)
                                throw new ICVerificationException("Too many closing braces " + "on line " + li[i]
                                        .line + " at column " + li[i].col);
                            bracketCount--;
                            break;
                        case '+':
                        case '-':
                        case 'A':
                        case 'B':
                        case 'C':
                        case 'd':
                        case 'p':
                        case 'x':
                        case '!':
                        case '|':
                        case '=':
                        case '&':
                        case '^':
                        case 's':
                        case 'r':
                            break;

                        case '<':
                        case '>':
                        case 'e':
                        case 'S':
                        case 'L':
                            switch (chars[++i]) {
                                case 'p':
                                case 'r':
                                case 'l':
                                case 'P':
                                case 'R':
                                case 'L':
                                    break;
                                default:
                                    throw new ICVerificationException("Unknown modifier " + chars[i] + " to opcode "
                                            + c + " " + "on line "
                                            + li[i].line + " at column " + li[i].col);
                            }
                            if (c == 'S' || c == 'L') {
                                char p = chars[++i];
                                if (!(p >= '0' || p <= '9') && !(p >= 'a' || p <= 'v'))
                                    throw new ICVerificationException("Bad table index " + chars[i] + " for opcode "
                                            + c + " " + "on line "
                                            + li[i].line + " at column " + li[i].col);
                            }
                            break;

                        case 'v': {
                            char n = chars[++i];
                            if (!(n >= '0' || n <= '9'))
                                throw new ICVerificationException("Bad peek depth " + chars[i] + " " + "on line " +
                                        li[i].line + " at column "
                                        + li[i].col);
                        }
                        break;

                        case '.':
                            for (int j = 0; j < 4; j++) {
                                switch (chars[++i]) {
                                    case '+':
                                    case '-':
                                    case '1':
                                    case '0':
                                        break;

                                    default:
                                        throw new ICVerificationException("Bad logic table value " + chars[i] + " " +
                                                "on line " + li[i].line
                                                + " at column " + li[i].col);
                                }
                            }
                            break;

                        case 'c':
                        case 't':
                            for (int j = 0; j < 2; j++) {
                                char n = chars[++i];
                                if (!(n >= '0' || n <= '9'))
                                    throw new ICVerificationException("Invalid character " + chars[i] + " in function" +
                                            " number " + "on line "
                                            + li[i].line + " at column " + li[i].col);
                            }
                            {
                                char n = chars[++i];
                                if (!(n >= '0' || n <= '9'))
                                    throw new ICVerificationException("Invalid character " + chars[i] + " in argument " +
                                            "count " + "on line "
                                            + li[i].line + " at column " + li[i].col);
                            }
                            break;

                        default:
                            throw new ICVerificationException("Unknown opcode " + c + " " + "on line " + li[i].line +
                                    " at column " + li[i].col);
                    }
                } catch (ArrayIndexOutOfBoundsException e) {
                    BukkitUtil.printStacktrace(e);
                    i = li.length - 1;
                    throw new ICVerificationException("Unexpected function end " + "around line " + li[i].line);
                }
            }
            if (bracketCount != 0)
                throw new ICVerificationException("Missing closing braces in function #" + l + " " + "               " +
                        "           starting on line "
                        + li[0].line + " and ending on line " + li[li.length - 1].line);
        }
        return functions;
    }
View Full Code Here

            int interval;
            try {
                interval = Integer.parseInt(sign.getLine(2));
            } catch (NumberFormatException e) {
                throw new ICVerificationException("The third line must be a number between 5 and 500.");
            }

            interval = Math.max(Math.min(interval, 500), 5);

            sign.setLine(2, Integer.toString(interval));
View Full Code Here

            try {
                String[] bits = RegexUtil.COLON_PATTERN.split(sign.getLine(2), 3);
                int effectId = Integer.parseInt(bits[0]);

                if (PotionEffectType.getById(effectId) == null)
                    throw new ICVerificationException("The third line must be a valid potion effect id.");
            } catch (NumberFormatException e) {
                throw new ICVerificationException("The third line must be a valid potion effect id.");
            }
        }
View Full Code Here

        @Override
        public void verify(ChangedSign sign) throws ICVerificationException {

            if (sign.getLine(2) == null && sign.getLine(2).isEmpty())
                throw new ICVerificationException("Line three needs to be a combination");
        }
View Full Code Here

        sign = s;
        try {
            codeString = getCode();
        } catch (CodeNotFoundException e) {
            throw new ICVerificationException("Error retrieving code: " + e.getMessage());
        }
        l.compile(codeString);
    }
View Full Code Here

            String[] splitLine3 = RegexUtil.ASTERISK_PATTERN.split(sign.getLine(3).trim());
            EntityType type = EntityType.fromName(splitLine3[0].trim().toLowerCase(Locale.ENGLISH));
            if(type == null)
                type = EntityType.valueOf(splitLine3[0].trim().toUpperCase(Locale.ENGLISH));
            if (type == null)
                throw new ICVerificationException("Invalid Entity! See bukkit EntityType list!");
            else if (!type.isSpawnable())
                throw new ICVerificationException("Entity is not spawnable!");
        }
View Full Code Here

                        break;
                    }
                }
            }
            if(sound == null)
                throw new ICVerificationException("Unknown Sound!");
        }
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.mechanics.ic.ICVerificationException

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.