Package net.aufdemrand.denizen.scripts.containers.core

Examples of net.aufdemrand.denizen.scripts.containers.core.ProcedureScriptContainer


        // Note that the script should ALWAYS return -1, 0, or 1, or glitches will happen!
        // Note that if two inputs are exactly equal, the procedure should always return 0.
        // -->
        if (attribute.startsWith("sort")
                && attribute.hasContext(1)) {
            final ProcedureScriptContainer script = ScriptRegistry.getScriptContainer(attribute.getContext(1));
            if (script == null) {
                dB.echoError("'" + attribute.getContext(1) + "' is not a valid procedure script!");
                return getAttribute(attribute.fulfill(1));
            }
            final ScriptEntry entry = attribute.getScriptEntry();
            List<String> list = new ArrayList<String>(this);
            try {
                Collections.sort(list, new Comparator<String>() {
                    @Override
                    public int compare(String o1, String o2) {
                        List<ScriptEntry> entries = script.getBaseEntries(entry.entryData.clone());
                        if (entries.isEmpty()) {
                            return 0;
                        }
                        long id = DetermineCommand.getNewId();
                        ScriptBuilder.addObjectToEntries(entries, "ReqId", id);
                        InstantQueue queue = InstantQueue.getQueue(ScriptQueue.getNextId("DLIST_SORT"));
                        queue.addEntries(entries);
                        queue.setReqId(id);
                        int x = 1;
                        dList definitions = new dList();
                        definitions.add(o1);
                        definitions.add(o2);
                        String[] definition_names = null;
                        try { definition_names = script.getString("definitions").split("\\|"); } catch (Exception e) { /* IGNORE */ }
                        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(entry, "Adding definition %" + name + "% as " + definition);
View Full Code Here

TOP

Related Classes of net.aufdemrand.denizen.scripts.containers.core.ProcedureScriptContainer

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.