Examples of dList


Examples of net.aufdemrand.denizen.objects.dList

                    && arg.matchesArgumentType(dCuboid.class))
                this.cuboid = arg.asType(dCuboid.class);
        }

        if (items == null)
            items = new dList("*");

        if (type == null) {
            dB.echoError("Missing TYPE argument! Valid: CRAFT, SMELT, FISH");
            cancel();
        }
View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

    @SuppressWarnings("unchecked")
    @Override
    public void onLoad() {
        try {
            type = ItemType.valueOf((String) get("Type"));
            items = new dList((List<String>) get("Items"));
            required = (Integer) get("Quantity Needed");
            items_so_far = (Integer) get("Quantity Done");
            region = (String) get("Region");
            cuboid = dCuboid.valueOf((String) get("Cuboid"));
        } catch (Exception e) {
View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

            dcs.clearOutput();
            dcs.silent = silent.asBoolean();
            ServerCommandEvent sce = new ServerCommandEvent(dcs, command);
            Bukkit.getPluginManager().callEvent(sce);
            DenizenAPI.getCurrentInstance().getServer().dispatchCommand(dcs, sce.getCommand());
            scriptEntry.addObject("output", new dList(dcs.getOutput()));
        }
    }
View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

    @Override
    public void execute(final ScriptEntry scriptEntry) throws CommandExecutionException {
        // Get objects

        List<dPlayer> viewers = (List<dPlayer>) scriptEntry.getObject("viewers");
        dList lines = scriptEntry.hasObject("lines") ?
                        dList.valueOf(scriptEntry.getElement("lines").asString()) :
                        new dList();

        Element action = scriptEntry.getElement("action");
        Element id = scriptEntry.getElement("id");
        Element objective = scriptEntry.getElement("objective");
        Element criteria = scriptEntry.getElement("criteria");
        Element score = scriptEntry.getElement("score");
        Element displaySlot = scriptEntry.getElement("displayslot");
        Action act = Action.valueOf(action.asString().toUpperCase());

        // Report to dB
        dB.report(scriptEntry, getName(), action.debug() +
                             id.debug() +
                             (viewers != null ? aH.debugObj("viewers", viewers.toString()) : "") +
                             (objective != null ? objective.debug() : "") +
                             (act.equals(Action.ADD) && objective!= null
                                 ? criteria.debug()
                                 : "") +
                             (!lines.isEmpty() ? lines.debug() : "") +
                             (act.equals(Action.ADD) && score != null
                                 ? score.debug()
                                 : "") +
                             (act.equals(Action.ADD) && objective != null
                                 ? displaySlot.debug()
                                 : ""));

        Scoreboard board = null;

        // Get the main scoreboard by default
        if (id.asString().equalsIgnoreCase("main")) {
            board = ScoreboardHelper.getMain();
        }
        else {
            // If this scoreboard already exists, get it
            if (ScoreboardHelper.hasScoreboard(id.asString())) {
                board = ScoreboardHelper.getScoreboard(id.asString());
            }
            // Else, create a new one if Action is ADD
            else if (act.equals(Action.ADD)) {
                board = ScoreboardHelper.createScoreboard(id.asString());
            }
        }

        // Don't progress if we ended up with a null board
        if (board == null) {
            dB.echoError(scriptEntry.getResidingQueue(), "Scoreboard " + id.asString() + " does not exist!");
            return;
        }

        Objective obj = null;

        if (act.equals(Action.ADD)) {

            if (objective != null) {
                // Try getting the objective from the board
                obj = board.getObjective(objective.asString());

                // Create the objective if it does not already exist
                if (obj == null) {
                    obj = board.registerNewObjective(objective.asString(), criteria.asString());
                }
                // If a different criteria has been set for this objective,
                // recreate the objective
                else if (criteria != null && !obj.getCriteria().equals(criteria.asString())) {
                    obj.unregister();
                    obj = board.registerNewObjective(objective.asString(), criteria.asString());
                }

                // Change the objective's display slot
                if (!displaySlot.asString().equalsIgnoreCase("none")) {
                    obj.setDisplaySlot(DisplaySlot.valueOf(displaySlot.asString().toUpperCase()));
                }

                obj.setDisplayName(objective.asString());

                if (!lines.isEmpty()) {
                    // If we've gotten this far, but the score is null,
                    // use a score of 0
                    if (score == null) score = new Element(0);

                    // Set all the score lines in the scoreboard, creating fake players
                    // for those lines that are not meant to track players
                    //
                    // Read https://forums.bukkit.org/threads/help-with-multi-line-scoreboards.181149/
                    // for clarifications
                    for (String line : lines) {
                        line = line.replaceAll("[pP]@", "");
                        if (line.length() > 48) {
                            line = line.substring(0, 48);
                        }
                        ScoreboardHelper.addScore(obj, getOfflinePlayer(line), score.asInt());
                    }
                }
            }
            // If there is no objective and no viewers, but there are some lines,
            // the command cannot do anything at all, so print a message about that
            else if (viewers == null && !lines.isEmpty()) {
                dB.echoDebug(scriptEntry, "Cannot add lines without specifying an objective!");
            }
        }
        else if (act.equals(Action.REMOVE)) {
            if (objective != null) {
                // Try getting the objective from the board
                obj = board.getObjective(objective.asString());

                if (obj != null) {
                    // Remove the entire objective if no lines have been specified
                    if (lines.isEmpty()) {
                        dB.echoDebug(scriptEntry, "Removing objective " + obj.getName() +
                                " from scoreboard " + id.asString());
                        obj.unregister();
                    }
                    else {
                        for (String line : lines) {
                            line = line.replaceAll("[pP]@", "");
                            ScoreboardHelper.removeScore(obj, getOfflinePlayer(line));
                        }
                    }
                }
                else {
                    dB.echoError(scriptEntry.getResidingQueue(), "Objective " + objective.asString() +
                                 " does not exist in scoreboard " + id.asString());
                }
            }
            // If lines were specified, but an objective was not, remove the
            // lines from every objective
            else if (!lines.isEmpty()) {
                dB.echoDebug(scriptEntry, "Removing lines " + lines.identify() +
                        " from all objectives in scoreboard " + id.asString());

                for (String line : lines) {
                    line = line.replaceAll("[pP]@", "");
                    ScoreboardHelper.removePlayer(id.asString(), getOfflinePlayer(line));
View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

        // @returns dList(Queue)
        // @description
        // Returns a list of all currently running queues on the server.
        // -->
        if (attribute.startsWith("list")) {
            event.setReplaced(new dList(ScriptQueue._getQueues())
                    .getAttribute(attribute.fulfill(1)));
            return;
        }

View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

         // skills = Skills.getForPlayer(aH.getPlayerFrom(type_context)).list()

            // Use event.setReplaced() to pass the attribute off to the dList object (or any other dScriptArg object).
            // The dList constructor requires a string list and a prefix.
            event.setReplaced(new dList(skills).getAttribute(attribute));
        }

        // Got here? No attributes were handled! Probably should let the dBugger know.
        dB.echoError("Example skills tag '" + event.raw_tag + "' was unable to match an attribute. Replacement has been cancelled...");
View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

        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) { }
View Full Code Here

Examples of net.aufdemrand.denizen.objects.dList

    @EventHandler
    public void locationTags(ReplaceableTagEvent event) {

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

        dList list = null;

        if (event.hasNameContext())
            list = dList.valueOf(event.getNameContext());

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

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

    }
View Full Code Here

Examples of org.odmg.DList

     * for the predicate, otherwise false.
     * @exception  org.odmg.QueryInvalidException  The query predicate is invalid.
     */
    public boolean existsElement(String predicate) throws org.odmg.QueryInvalidException
    {
        DList results = (DList) this.query(predicate);
        if (results == null || results.size() == 0)
            return false;
        else
            return true;
    }
View Full Code Here

Examples of org.odmg.DList

        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();

        PBCapsule handle = new PBCapsule(pbKey, tx);
        DList result;
        try
        {
            PersistenceBroker broker = handle.getBroker();
            Criteria allElementsCriteria = this.getPkCriteriaForAllElements(broker);
            // join selection of elements with predicate criteria:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.