Package net.aufdemrand.denizen.tags

Examples of net.aufdemrand.denizen.tags.Attribute


            // Returning a dList will help with things like: <skills.for[player_name].size>
            // which can tell how many items are in the list, all without any additional
            // code to handle each situation. A full list of attributes can be found
            // in Denizen's documentation. First you need to turn the tag into an
            // attribute object.
            Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());

            // Now to catch up, 2 attributes have been handled already...
            // Fulfilling 2 attributes, skills and .for, in <skills.for[player].get[1]>
            // will leave the .get[1] to be handled by the dList.
            attribute.fulfill(2);

            List<String> skills = new ArrayList<String>();

         // skills = Skills.getForPlayer(aH.getPlayerFrom(type_context)).list()
View Full Code Here


    @EventHandler
    public void foreignCharacterTags(ReplaceableTagEvent event) {


        if (!event.getName().startsWith("&")) return;
        Attribute attribute =
                new Attribute(event.raw_tag, event.getScriptEntry());

        // <--[tag]
        // @attribute <&auml>
        // @returns Element
        // @description
        // Returns an umlaut-a symbol: ä
        // -->
        if (event.getName().equals("&auml"))
            event.setReplaced(new Element("ä").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&Auml>
            // @returns Element
            // @description
            // Returns a capital umlaut-A symbol: Ä
            // -->
        else if (event.getName().equals("&Auml"))
            event.setReplaced(new Element("Ä").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&ouml>
            // @returns Element
            // @description
            // Returns an umlaut-o symbol: ö
            // -->
        else if (event.getName().equals("&ouml"))
            event.setReplaced(new Element("ö").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&Iuml>
            // @returns Element
            // @description
            // Returns a capital umlaut-O symbol: Ö
            // -->
        else if (event.getName().equals("&Ouml"))
            event.setReplaced(new Element("Ö").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&uuml>
            // @returns Element
            // @description
            // Returns an umlaut-u symbol: ü
            // -->
        else if (event.getName().equals("&uuml"))
            event.setReplaced(new Element("ü").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&Uuml>
            // @returns Element
            // @description
            // Returns a capital umlaut-U symbol: Ü
            // -->
        else if (event.getName().equals("&Uuml"))
            event.setReplaced(new Element("Ü").getAttribute(attribute.fulfill(1)));

    }
View Full Code Here

    // -->


    @EventHandler
    public void colorTags(ReplaceableTagEvent event) {
        Attribute attribute = event.getAttributes();
        int i = 0;
        for (ChatColor color : ChatColor.values()) {
            if (i > 22) break;
            if (event.matches(color.name()))
                event.setReplaced(new Element(color.toString()).getAttribute(attribute.fulfill(1)));
            else if (event.matches("&" + code[i]))
                event.setReplaced(new Element(ChatColor.getByChar(code[i]).toString()).getAttribute(attribute.fulfill(1)));
            i++;
        }
    }
View Full Code Here


    @EventHandler
    public void specialCharacterTags(ReplaceableTagEvent event) {
        if (!event.getName().startsWith("&")) return;
        Attribute attribute =
                new Attribute(event.raw_tag, event.getScriptEntry());

        // <--[tag]
        // @attribute <&nl>
        // @returns Element
        // @description
        // Returns a newline symbol.
        // -->
        if (event.getName().equalsIgnoreCase("&nl"))
            event.setReplaced(new Element("\n").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&amp>
            // @returns Element
            // @description
            // Returns an ampersand symbol: &
            // -->
        else if (event.getName().equalsIgnoreCase("&amp"))
            event.setReplaced(new Element("&").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&cm>
            // @returns Element
            // @description
            // Returns a comma symbol: ,
            // -->
        else if (event.getName().equalsIgnoreCase("&cm"))
            event.setReplaced(new Element(",").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&ss>
            // @returns Element
            // @description
            // Returns an internal coloring symbol: §
            // -->
        else if (event.getName().equalsIgnoreCase("&ss"))
            event.setReplaced(new Element("§").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&sq>
            // @returns Element
            // @description
            // Returns a single-quote symbol: '
            // -->
        else if (event.getName().equalsIgnoreCase("&sq"))
            event.setReplaced(new Element("'").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&sp>
            // @returns Element
            // @description
            // Returns a non-breaking space symbol.
            // -->
        else if (event.getName().equalsIgnoreCase("&sp"))
            event.setReplaced(new Element(String.valueOf((char)0x00A0)).getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&dq>
            // @returns Element
            // @description
            // Returns a double-quote symbol: "
            // -->
        else if (event.getName().equalsIgnoreCase("&dq"))
            event.setReplaced(new Element("\"").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&co>
            // @returns Element
            // @description
            // Returns a colon symbol: :
            // -->
        else if (event.getName().equalsIgnoreCase("&co"))
            event.setReplaced(new Element(":").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&sc>
            // @returns Element
            // @description
            // Returns a semicolon symbol: ;
            // -->
        else if (event.getName().equalsIgnoreCase("&sc"))
            event.setReplaced(new Element(String.valueOf((char)0x2011)).getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&rb>
            // @returns Element
            // @description
            // Returns a right-bracket symbol: ]
            // -->
        else if (event.getName().equalsIgnoreCase("&rb"))
            event.setReplaced(new Element("]").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&lb>
            // @returns Element
            // @description
            // Returns a left-bracket symbol: [
            // -->
        else if (event.getName().equalsIgnoreCase("&lb"))
            event.setReplaced(new Element("[").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&rc>
            // @returns Element
            // @description
            // Returns a right-brace symbol: }
            // -->
        else if (event.getName().equalsIgnoreCase("&rc"))
            event.setReplaced(new Element("}").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&lc>
            // @returns Element
            // @description
            // Returns a left-brace symbol: {
            // -->
        else if (event.getName().equalsIgnoreCase("&lc"))
            event.setReplaced(new Element("{").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&ns>
            // @returns Element
            // @description
            // Returns a hash symbol: #
            // -->
        else if (event.getName().equalsIgnoreCase("&ns"))
            event.setReplaced(new Element("#").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&pc>
            // @returns Element
            // @description
            // Returns a percent symbol: %
            // -->
        else if (event.getName().equalsIgnoreCase("&pc"))
            event.setReplaced(new Element("%").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&pipe>
            // @returns Element
            // @description
            // Returns a pipe symbol: |
            // -->
        else if (event.getName().equalsIgnoreCase("&pipe"))
            event.setReplaced(new Element("|").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&ds>
            // @returns Element
            // @description
            // Returns a dollar sign: $
            // -->
        else if (event.getName().equalsIgnoreCase("&ds"))
            event.setReplaced(new Element("$").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&lt>
            // @returns Element
            // @description
            // Returns a less than symbol: <
            // -->
        else if (event.getName().equalsIgnoreCase("&lt"))
            event.setReplaced(new Element(String.valueOf((char)0x01)).getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&gt>
            // @returns Element
            // @description
            // Returns a greater than symbol: >
            // -->
        else if (event.getName().equalsIgnoreCase("&gt"))
            event.setReplaced(new Element(String.valueOf((char)0x02)).getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&bs>
            // @returns Element
            // @description
            // Returns a backslash symbol: \
            // -->
        else if (event.getName().equalsIgnoreCase("&bs"))
            event.setReplaced(new Element("\\").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&at>
            // @returns Element
            // @description
            // Returns an at symbol: @
            // -->
        else if (event.getName().equalsIgnoreCase("&at"))
            event.setReplaced(new Element("@").getAttribute(attribute.fulfill(1)));

            // <--[tag]
            // @attribute <&dot>
            // @returns Element
            // @description
            // Returns a dot symbol: .
            // -->
        else if (event.getName().equalsIgnoreCase("&dot"))
            event.setReplaced(new Element(".").getAttribute(attribute.fulfill(1)));

        // <--[tag]
        // @attribute <&hrt>
        // @returns Element
        // @description
        // Returns a heart symbol: ♥
        // -->
        else if (event.getName().equalsIgnoreCase("&hrt"))
            event.setReplaced(new Element("\u2665").getAttribute(attribute.fulfill(1)));

        // <--[tag]
        // @attribute <&chr[<character>]>
        // @returns Element
        // @description
        // Returns the character specified.
        // -->
        if (attribute.startsWith("&chr") && attribute.hasContext(1))
            event.setReplaced(String.valueOf((char)Integer.parseInt(attribute.getContext(1), 16)));

    }
View Full Code Here

        // Returns the 'determine' result of a procedure script.
        // See <@link example Using Procedure Scripts>.
        // -->
        if (!event.matches("proc", "pr")) return;

        Attribute attr = event.getAttributes();
        int attribs = 1;

        dScript script = null;
        String path = null;

        if (event.hasNameContext()) {
            if (event.getNameContext().indexOf('.') > 0) {
                String[] split = event.getNameContext().split("\\.", 2);
                path = split[1];
                script = dScript.valueOf(split[0]);

            } else script = dScript.valueOf(event.getNameContext());

        } else if (event.getValue() != null) {
            script = dScript.valueOf(event.getValue());

        } else {
            dB.echoError("Invalid procedure script tag '" + event.getValue() + "'!");
            return;
        }

        if (script == null) {
            dB.echoError("Missing script for procedure script tag '" + event.getValue() + "'!");
            return;
        }

        // Build script entries
        List<ScriptEntry> entries;
        if (path != null)
            entries = script.getContainer().getEntries(new BukkitScriptEntryData(event.getPlayer(), event.getNPC()), path);
        else
            entries = script.getContainer().getBaseEntries(new BukkitScriptEntryData(event.getPlayer(), event.getNPC()));

        // Return if no entries built
        if (entries.isEmpty()) return;

        // Create new ID -- this is what we will look for when determining an outcome
        long id = DetermineCommand.getNewId();

        // Add the reqId to each of the entries for referencing
        ScriptBuilder.addObjectToEntries(entries, "ReqId", id);

        InstantQueue queue = InstantQueue.getQueue(ScriptQueue.getNextId(script.getContainer().getName()));
        queue.addEntries(entries);
        queue.setReqId(id);
        if (event.hasType() &&
                event.getType().equalsIgnoreCase("context") &&
                event.hasTypeContext()) {
            attribs = 2;
            int x = 1;
            dList definitions = new dList(event.getTypeContext());
            String[] definition_names = null;

            try { definition_names = script.getContainer().getString("definitions").split("\\|");
            } catch (Exception e) { }

            for (String definition : definitions) {
                String name = definition_names != null && definition_names.length >= x ?
                        definition_names[x - 1].trim() : String.valueOf(x);
                queue.addDefinition(name, definition);
                dB.echoDebug(event.getScriptEntry(), "Adding definition %" + name + "% as " + definition);
                x++;
            }
        }

        queue.start();

        if (DetermineCommand.hasOutcome(id)) {
            event.setReplaced(ObjectFetcher.pickObjectFor(DetermineCommand.getOutcome(id))
                    .getAttribute(attr.fulfill(attribs)));
        }
    }
View Full Code Here

                    "Has the NPC been removed, or is there no NPC list available? " +
                    "Replacement has been aborted...");
            return;
        }

        Attribute attribute = event.getAttributes();

        if (npc.hasTrait(ConstantsTrait.class)
                && npc.getTrait(ConstantsTrait.class).getConstant(event.getValue()) != null) {
            event.setReplaced(new Element(npc.getTrait(ConstantsTrait.class)
                    .getConstant(event.getValue())).getAttribute(attribute.fulfill(1)));
        }

    }
View Full Code Here

            dB.echoError("Notable tag '" + event.raw_tag + "': id was not found.");
        }

        dLocation location = (dLocation) NotableManager.getSavedObject(id);

        Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
        attribute.fulfill(1);
        tag = location.getAttribute(attribute);

        event.setReplaced(tag);

    }
View Full Code Here

        if (loc == null) {
            return;
        }

        // Build and fill attributes
        Attribute attribute = event.getAttributes();
        event.setReplaced(loc.getAttribute(attribute.fulfill(1)));

    }
View Full Code Here

        if (list == null) {
            return;
        }

        // Build and fill attributes
        Attribute attribute = event.getAttributes();
        event.setReplaced(list.getAttribute(attribute.fulfill(1)));

    }
View Full Code Here

        String typeContext = event.getTypeContext() != null ? event.getTypeContext() : "";
        String subType = event.getSubType() != null ? event.getSubType() : "";
        String subTypeContext = event.getSubTypeContext() != null ? event.getSubTypeContext().toUpperCase() : "";
        String specifier = event.getSpecifier() != null ? event.getSpecifier() : "";
        String specifierContext = event.getSpecifierContext() != null ? event.getSpecifierContext().toUpperCase() : "";
        Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry()).fulfill(1);

        if (type.equalsIgnoreCase("RANDOM")) {

            // <--[tag]
            // @attribute <util.random.int[<#>].to[<#>]>
            // @returns Element(Number)
            // @description
            // Returns a random number between the 2 specified numbers, inclusive.
            // EG, random.int[1].to[3] could return 1, 2, or 3.
            // -->
            if (subType.equalsIgnoreCase("INT")) {
                if (specifier.equalsIgnoreCase("TO")) {
                    if (aH.matchesInteger(subTypeContext) && aH.matchesInteger(specifierContext)) {
                        int min = aH.getIntegerFrom(subTypeContext);
                        int max = aH.getIntegerFrom(specifierContext);

                        // in case the first number is larger than the second, reverse them
                        if (min > max) {
                            int store = min;
                            min = max;
                            max = store;
                        }

                        event.setReplaced(new Element(
                                String.valueOf(CoreUtilities.getRandom().nextInt(max - min + 1) + min))
                                .getAttribute(attribute.fulfill(3)));
                    }
                }
            }

            // <--[tag]
            // @attribute <util.random.decimal>
            // @returns Element
            // @description
            // Returns a random decimal number from 0 to 1
            // -->
            else if (subType.equalsIgnoreCase("DECIMAL"))
                event.setReplaced(new Element(CoreUtilities.getRandom().nextDouble())
                        .getAttribute(attribute.fulfill(2)));

                // <--[tag]
                // @attribute <util.random.gauss>
                // @returns Element
                // @description
                // Returns a random decimal number with a gaussian distribution.
                // 70% of all results will be within the range of -1 to 1.
                // -->
            else if (subType.equalsIgnoreCase("GAUSS"))
                event.setReplaced(new Element(CoreUtilities.getRandom().nextGaussian())
                        .getAttribute(attribute.fulfill(2)));

            // TODO: Delete (Deprecated in favor of li@list.random)
            else if (subType.equalsIgnoreCase("ELEMENT")) {
                dList list = dList.valueOf(subTypeContext);
                event.setReplaced(new Element(list.get(new Random().nextInt(list.size())))
                        .getAttribute(attribute.fulfill(2)));
            }

            // <--[tag]
            // @attribute <util.random.uuid>
            // @returns Element
            // @description
            // Returns a random unique ID.
            // -->
            else if (subType.equalsIgnoreCase("UUID"))
                event.setReplaced(new Element(UUID.randomUUID().toString())
                        .getAttribute(attribute.fulfill(2)));

            // <--[tag]
            // @attribute <util.random.duuid>
            // @returns Element
            // @description
            // Returns a random 'denizen' unique ID, which is made of a randomly generated sentence.
            // -->
            else if (subType.equalsIgnoreCase("DUUID"))
                event.setReplaced(new Element(ScriptQueue
                        .getNextId(event.hasSubTypeContext() ? event.getSubTypeContext(): "DUUID"))
                        .getAttribute(attribute.fulfill(2)));
        }


        else if (type.equalsIgnoreCase("SUBSTR")
                || type.equalsIgnoreCase("TRIM")
                || type.equalsIgnoreCase("SUBSTRING")) {
            String text = event.getTypeContext();
            int from = 1;
            int to = text.length() + 1;
            int tags = 2;

            // TODO: Delete (Deprecated in favor of el@element.after)
            if (subType.equalsIgnoreCase("AFTER")) {
                from = text.toUpperCase().indexOf(subTypeContext) + subTypeContext.length() + 1;
            }

            // TODO: Delete (Deprecated in favor of el@element.before)
            if (subType.equalsIgnoreCase("BEFORE")) {
                to = text.toUpperCase().indexOf(subTypeContext) + 1;
            }

            // TODO: Delete (Deprecated in favor of el@element.substring)
            try {
                if (subType.equalsIgnoreCase("FROM"))
                    from = Integer.valueOf(subTypeContext);
            } catch (NumberFormatException e) { }

            try {
                if (specifier.equalsIgnoreCase("TO")) {
                    to = Integer.valueOf(specifierContext);
                    tags = 3;
                }
            } catch (NumberFormatException e) { }

            if (to > text.length())
                to = text.length() + 1;

            event.setReplaced(new Element(text.substring(from - 1, to - 1))
                    .getAttribute(attribute.fulfill(tags)));
        }


        // TODO: Delete (Deprecated in favor of el@element.replace)
        else if (type.equalsIgnoreCase("REPLACE")) {
            String item_to_replace = event.getTypeContext();
            String replace = event.getSubTypeContext();
            String replacement = event.getSpecifierContext();
            event.setReplaced(new Element(item_to_replace.replace(replace, replacement))
                    .getAttribute(attribute.fulfill(3)));
        }

        // <--[tag]
        // @attribute <util.entity_is_spawned[<entity>]>
        // @returns Element(Boolean)
        // @description
        // Returns whether an entity is spawned and valid.
        // -->
        else if (type.equalsIgnoreCase("ENTITY_IS_SPAWNED")
                && event.hasTypeContext()) {
            dEntity ent = dEntity.valueOf(event.getTypeContext());
            event.setReplaced(new Element((ent != null && ent.isUnique() && ent.isSpawned()) ? "true" : "false")
                    .getAttribute(attribute.fulfill(1)));
        }

        // <--[tag]
        // @attribute <util.player_is_valid[<player name>]>
        // @returns Element(Boolean)
        // @description
        // Returns whether a player exists under the specified name.
        // -->
        else if (type.equalsIgnoreCase("PLAYER_IS_VALID")
                && event.hasTypeContext()) {
            event.setReplaced(new Element(dPlayer.playerNameIsValid(event.getTypeContext()))
                    .getAttribute(attribute.fulfill(1)));
        }

        // <--[tag]
        // @attribute <util.npc_is_valid[<npc>]>
        // @returns Element(Boolean)
        // @description
        // Returns whether an NPC exists and is usable.
        // -->
        else if (type.equalsIgnoreCase("NPC_IS_VALID")
                && event.hasTypeContext()) {
            dNPC npc = dNPC.valueOf(event.getTypeContext());
            event.setReplaced(new Element((npc != null && npc.isValid()))
                    .getAttribute(attribute.fulfill(1)));
        }


        // TODO: Delete (Deprecated in favor of el@element.to_uppercase)
        else if (type.equalsIgnoreCase("UPPERCASE")) {
            String item_to_uppercase = event.getTypeContext();
            event.setReplaced(new Element(item_to_uppercase.toUpperCase())
                    .getAttribute(attribute.fulfill(1)));
        }

        // TODO: Delete (Deprecated in favor of el@element.to_lowercase)
        else if (type.equalsIgnoreCase("LOWERCASE")) {
            String item_to_uppercase = event.getTypeContext();
            event.setReplaced(new Element(item_to_uppercase.toLowerCase())
                    .getAttribute(attribute.fulfill(1)));
        }

        // <--[tag]
        // @attribute <util.date>
        // @returns Element
        // @description
        // Returns the current system date.
        // -->
        else if (type.equalsIgnoreCase("DATE")) {
            Calendar calendar = Calendar.getInstance();
            Date currentDate = new Date();
            SimpleDateFormat format = new SimpleDateFormat();

            // <--[tag]
            // @attribute <util.date.time>
            // @returns Element
            // @description
            // Returns the current system time.
            // -->
            if (subType.equalsIgnoreCase("TIME")) {

                // <--[tag]
                // @attribute <util.date.time.twentyfour_hour>
                // @returns Element
                // @description
                // Returns the current system time in 24-hour format.
                // -->
                if (specifier.equalsIgnoreCase("TWENTYFOUR_HOUR")) {
                    format.applyPattern("k:mm");
                    event.setReplaced(new Element(format.format(currentDate))
                            .getAttribute(attribute.fulfill(3)));
                }
                // <--[tag]
                // @attribute <util.date.time.year>
                // @returns Element(Number)
                // @description
                // Returns the current year of the system time.
                // -->
                else if (specifier.equalsIgnoreCase("year"))
                    event.setReplaced(new Element(calendar.get(Calendar.YEAR)).getAttribute(attribute.fulfill(3)));
                    // <--[tag]
                    // @attribute <util.date.time.month>
                    // @returns Element(Number)
                    // @description
                    // Returns the current month of the system time.
                    // -->
                else if (specifier.equalsIgnoreCase("month"))
                    event.setReplaced(new Element(calendar.get(Calendar.MONTH) + 1).getAttribute(attribute.fulfill(3)));
                    // <--[tag]
                    // @attribute <util.date.time.day>
                    // @returns Element(Number)
                    // @description
                    // Returns the current day of the system time.
                    // -->
                else if (specifier.equalsIgnoreCase("day"))
                    event.setReplaced(new Element(calendar.get(Calendar.DAY_OF_MONTH)).getAttribute(attribute.fulfill(3)));
                    // <--[tag]
                    // @attribute <util.date.time.hour>
                    // @returns Element(Number)
                    // @description
                    // Returns the current hour of the system time.
                    // -->
                else if (specifier.equalsIgnoreCase("hour"))
                    event.setReplaced(new Element(calendar.get(Calendar.HOUR_OF_DAY)).getAttribute(attribute.fulfill(3)));
                    // <--[tag]
                    // @attribute <util.date.time.minute>
                    // @returns Element(Number)
                    // @description
                    // Returns the current minute of the system time.
                    // -->
                else if (specifier.equalsIgnoreCase("minute"))
                    event.setReplaced(new Element(calendar.get(Calendar.MINUTE)).getAttribute(attribute.fulfill(3)));
                    // <--[tag]
                    // @attribute <util.date.time.second>
                    // @returns Element(Number)
                    // @description
                    // Returns the current second of the system time.
                    // -->
                else if (specifier.equalsIgnoreCase("second"))
                    event.setReplaced(new Element(calendar.get(Calendar.SECOND)).getAttribute(attribute.fulfill(3)));
                    // <--[tag]
                    // @attribute <util.date.time.duration>
                    // @returns Duration
                    // @description
                    // Returns the current system time as a duration.
                    // To get the exact millisecond count, use <@link tag server.current_time_millis>.
                    // -->
                else if (specifier.equalsIgnoreCase("duration"))
                    event.setReplaced(new Duration(System.currentTimeMillis() / 50).getAttribute(attribute.fulfill(3)));
                else {
                    format.applyPattern("K:mm a");
                    event.setReplaced(format.format(currentDate));
                }

            }
            // <--[tag]
            // @attribute <util.date.format[<format>]>
            // @returns Element
            // @description
            // Returns the current system time, formatted as specified
            // Example format: [EEE, MMM d, yyyy K:mm a] will become "Mon, Jan 1, 2112 0:01 AM"
            // -->
            else if (subType.equalsIgnoreCase("FORMAT") && !subTypeContext.equalsIgnoreCase("")) {
                try {
                    format.applyPattern(event.getSubTypeContext());
                    event.setReplaced(format.format(currentDate));
                }
                catch (Exception ex) {
                    dB.echoError("Error: invalid pattern '" + event.getSubTypeContext() + "'");
                    dB.echoError(ex);
                }
            }
            else {
                format.applyPattern("EEE, MMM d, yyyy");
                event.setReplaced(format.format(currentDate));
            }

        }

        // <--[tag]
        // @attribute <util.as_element[<text>]>
        // @returns Element
        // @description
        // Returns the text as an Element.
        // -->
        else if (type.equalsIgnoreCase("AS_ELEMENT")) {
            event.setReplaced(new Element(typeContext).getAttribute(attribute.fulfill(1)));
        }

    }
View Full Code Here

TOP

Related Classes of net.aufdemrand.denizen.tags.Attribute

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.