Package net.aufdemrand.denizen.tags

Examples of net.aufdemrand.denizen.tags.Attribute


            script = event.getScriptEntry().getScript();
        else if (event.getScriptEntry().hasObject("script"))
            script = (dScript) event.getScriptEntry().getObject("script");

        // Build and fill attributes
        Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());

        // Check if location is null, return null if it is
        if (script == null) { return; }

        // Else, get the attribute from the script
        event.setReplaced(script.getAttribute(attribute.fulfill(1)));

    }
View Full Code Here


    public void playerTags(ReplaceableTagEvent event) {

        if (!event.matches("player", "pl") || event.replaced()) return;

        // Build a new attribute out of the raw_tag supplied in the script to be fulfilled
        Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());

        // PlayerTags require a... dPlayer!
        dPlayer p = event.getPlayer();

        // Player tag may specify a new player in the <player[context]...> portion of the tag.
        if (attribute.hasContext(1))
            // Check if this is a valid player and update the dPlayer object reference.
            if (dPlayer.matches(attribute.getContext(1)))
                p = dPlayer.valueOf(attribute.getContext(1));
            else {
                if (!event.hasAlternative()) dB.echoError("Could not match '" + attribute.getContext(1) + "' to a valid player!");
                return;
            }

        if (p == null || !p.isValid()) {
            if (!event.hasAlternative()) dB.echoError("Invalid or missing player for tag <" + event.raw_tag + ">!");
            return;
        }

        event.setReplaced(p.getAttribute(attribute.fulfill(1)));
    }
View Full Code Here

    public void npcTags(ReplaceableTagEvent event) {

        if (!event.matches("npc") || event.replaced()) return;

        // Build a new attribute out of the raw_tag supplied in the script to be fulfilled
        Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());

        // PlayerTags require a... dPlayer!
        dNPC n = event.getNPC();

        // Player tag may specify a new player in the <player[context]...> portion of the tag.
        if (attribute.hasContext(1))
            // Check if this is a valid player and update the dPlayer object reference.
            if (dNPC.matches(attribute.getContext(1)))
                n = dNPC.valueOf(attribute.getContext(1));
            else {
                if (!event.hasAlternative()) dB.echoError("Could not match '" + attribute.getContext(1) + "' to a valid NPC!");
                return;
            }


        if (n == null || !n.isValid()) {
            if (!event.hasAlternative()) dB.echoError("Invalid or missing NPC for tag <" + event.raw_tag + ">!");
            return;
        }

        event.setReplaced(n.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.