Package com.sk89q.craftbook.mechanics.ic

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


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

            if(sign.getLine(2) == null || sign.getLine(2).isEmpty())
                throw new ICVerificationException("A block must be provided on line 2!");
            ItemInfo item = new ItemInfo(sign.getLine(2));
            if(item.getType() == null)
                throw new ICVerificationException("An invalid block was provided on line 2!");
            if(blockBlacklist.contains(item))
                throw new ICVerificationException("A blacklisted block was provided on line 2!");
        }
View Full Code Here


        public void verify(ChangedSign sign) throws ICVerificationException {

            String line3 = sign.getLine(2).toUpperCase(Locale.ENGLISH);

            String[] params = RegexUtil.COLON_PATTERN.split(line3);
            if (params.length < 2) throw new ICVerificationException("Not enough parameters on second line!");
            if (params[0].length() < 2) throw new ICVerificationException("Invalid first parameter!");

            // Get and validate axis
            String axis = params[0].substring(0, 1);
            if (!axis.equals("X") && !axis.equals("Y") && !axis.equals("Z"))
                throw new ICVerificationException("Invalid axis!");

            // Get and validate operator (default +)
            String op = params[0].substring(1, 2);
            int distStart = 2;
            if (!op.equals("+") && !op.equals("-")) {
                op = "+";
                distStart = 1; // no op so distance starts after axis
            }

            // Get and validate distance
            String sdist = params[0].substring(distStart);
            try {
                Integer.parseInt(sdist);
            } catch (Exception e) {
                throw new ICVerificationException("Invalid distance!");
            }

            try {
                Integer.parseInt(params[1]);
            } catch (Exception e) {
                throw new ICVerificationException("Invalid block ID!");
            }

            if (params.length > 2) {
                try {
                    Byte.parseByte(params[2]);
                } catch (Exception e) {
                    throw new ICVerificationException("Invalid block data!");
                }
            }
        }
View Full Code Here

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

            if(sign.getLine(2) == null || sign.getLine(2).isEmpty())
                throw new ICVerificationException("A block must be provided on line 2!");
            ItemInfo item = new ItemInfo(sign.getLine(2));
            if(item.getType() == null)
                throw new ICVerificationException("An invalid block was provided on line 2!");
            if(blockBlacklist.contains(item))
                throw new ICVerificationException("A blacklisted block was provided on line 2!");
        }
View Full Code Here

            if(!sign.getLine(3).isEmpty()) {
                try {
                    String[] split2 = RegexUtil.COLON_PATTERN.split(sign.getLine(3));
                    new Vector(Double.parseDouble(split2[0]), Double.parseDouble(split2[1]), Double.parseDouble(split2[2]));
                } catch (Exception ignored) {
                    throw new ICVerificationException("Velocity must be in x:y:z format!");
                }
            }
        }
View Full Code Here

        }

        @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 {
            if(!SearchArea.isValidArea(BukkitUtil.toSign(sign).getBlock(), sign.getLine(2)))
                throw new ICVerificationException("Invalid SearchArea on 3rd line!");
        }
View Full Code Here

                Double.parseDouble(strings[1]);
                Double.parseDouble(strings[2]);
            }
            Double.parseDouble(strings[0]);
        } catch (Exception e) {
            throw new ICVerificationException("Wrong syntax! Needs to be: radius=x:y:z or radius=y or y");
        }
    }
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

        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

            try {
                String[] split = RegexUtil.COLON_PATTERN.split(sign.getLine(3), 2);
                Integer.parseInt(split[0]);
            } catch (Exception ignored) {
                throw new ICVerificationException("You need to specify a block in line four.");
            }
            ICUtil.verifySignSyntax(sign);
        }
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.