Package com.sk89q.craftbook.mechanics.ic

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


            boolean lo;

            try {
                String set = sign.getLine(2).toUpperCase(Locale.ENGLISH);

                if (!set.contains(":")) throw new ICVerificationException("Invalid syntax");

                String[] settings = RegexUtil.COLON_PATTERN.split(set);

                if (settings.length != 2) throw new ICVerificationException("Invalid syntax");

                ticks = Integer.parseInt(settings[0]);

                hi = settings[1].contains("H");
                lo = settings[1].contains("L");
                if (!(hi || lo)) throw new ICVerificationException("Missing trigger levels");

            } catch (NumberFormatException e) {
                throw new ICVerificationException("Invalid number format");
            }

            ticks = Math.max(ticks, 2);
            ticks = Math.min(ticks, 150);
View Full Code Here


        @Override
        public void checkPlayer(ChangedSign sign, LocalPlayer player) throws ICVerificationException {

            if (!sign.getLine(2).equalsIgnoreCase(player.getName()))
                if (!ICMechanic.hasRestrictedPermissions(player, this, "mc1510"))
                    throw new ICVerificationException("You don't have permission to use other players!");
        }
View Full Code Here

        @Override
        public void checkPlayer(ChangedSign sign, LocalPlayer player) throws ICVerificationException {

            if (sign.getLine(3).trim().isEmpty())
                if (!ICMechanic.hasRestrictedPermissions(player, this, "mc1270"))
                    throw new ICVerificationException("You don't have permission to globally broadcast!");
        }
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

            String[] onIds = RegexUtil.COLON_PATTERN.split(ids[0]);
            try {
                Integer.parseInt(onIds[0]);
            }
            catch(Exception e){
                throw new ICVerificationException("Must provide an on ID!");
            }
            try {
                if(onIds.length > 1)
                    Byte.parseByte(onIds[1]);
            }
            catch(Exception e){
                throw new ICVerificationException("Invalid on Data!");
            }

            String[] offIds = RegexUtil.COLON_PATTERN.split(ids[1]);
            try {
                Integer.parseInt(offIds[0]);
            }
            catch(Exception e){
                throw new ICVerificationException("Must provide an off ID!");
            }
            try {
                if(offIds.length > 1)
                    Byte.parseByte(offIds[1]);
            }
            catch(Exception e){
                throw new ICVerificationException("Invalid off Data!");
            }

            String[] data = RegexUtil.COLON_PATTERN.split(sign.getLine(3));
            try {
                Integer.parseInt(data[0]);
            }
            catch(Exception e){
                throw new ICVerificationException("Must provide a delay!");
            }
            try {
                if(data.length > 1)
                    Integer.parseInt(data[1]);
            }
            catch(Exception e) {
                throw new ICVerificationException("Invalid mode!");
            }
        }
View Full Code Here

            EntityType type = EntityType.fromName(sign.getLine(2).trim().toLowerCase(Locale.ENGLISH));
            if(type == null)
                type = EntityType.valueOf(sign.getLine(2).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

                try {
                    String[] split = RegexUtil.COLON_PATTERN.split(line2, 2);
                    Integer.parseInt(split[0]);
                    if (split.length > 1) Integer.parseInt(split[1]);
                } catch (Exception e) {
                    throw new ICVerificationException("You can only write numbers in line 3. See /icdocs for help");
                }
            }
            if (!(line3 == null) && !line3.isEmpty()) {
                try {
                    String[] split = RegexUtil.COLON_PATTERN.split(line3, 2);
                    Integer.parseInt(split[0]);
                    if (split.length > 1) Integer.parseInt(split[1]);
                } catch (Exception e) {
                    throw new ICVerificationException("You can only write numbers in line 4. See /icdocs for help");
                }
            }
        }
View Full Code Here

        public void verify(ChangedSign sign) throws ICVerificationException {
            try {
                Integer.parseInt(RegexUtil.COLON_PATTERN.split(sign.getLine(2))[0]);
                Integer.parseInt(RegexUtil.COLON_PATTERN.split(sign.getLine(2))[1]);
            } catch(ArrayIndexOutOfBoundsException e) {
                throw new ICVerificationException("You need to specify both left and right quantities!");
            } catch(NumberFormatException e) {
                throw new ICVerificationException("Invalid quantities!");
            }
        }
View Full Code Here

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

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

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

            if (sign.getLine(2).trim().isEmpty() || !new File(ICManager.inst().getFireworkFolder(), sign.getLine(2).trim() + ".txt").exists() && !new File(ICManager.inst().getFireworkFolder(), sign.getLine(2).trim() + ".fwk").exists())
                throw new ICVerificationException("A valid firework show is required on line 3!");
        }
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.