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

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


        assignment = "";
    }

    public void describe(CommandSender sender, int page) throws CommandException {

        AssignmentScriptContainer assignmentScript = ScriptRegistry.getScriptContainer(assignment);

        Paginator paginator = new Paginator().header("Assignment");
        paginator.addLine("<e>Current assignment: " + (hasAssignment() ? this.assignment : "None.") + "");
        paginator.addLine("");

        if (!hasAssignment()) {
            paginator.sendPage(sender, page);
            return;
        }

        // Interact Scripts
        boolean entriesPresent = false;
        paginator.addLine(ChatColor.GRAY + "Interact Scripts:");
        paginator.addLine("<e>Key: <a>Priority  <b>Name");
        if (assignmentScript.contains("INTERACT SCRIPTS")) {
            entriesPresent = true;
            for (String scriptEntry : assignmentScript.getStringList("INTERACT SCRIPTS"))
                paginator.addLine("<a>" + scriptEntry.split(" ")[0] + "<b> " + scriptEntry.split(" ", 2)[1]);
        } if (!entriesPresent) paginator.addLine("<c>No Interact Scripts assigned.");
        paginator.addLine("");

        if (!entriesPresent) {
            if (!paginator.sendPage(sender, page))
                throw new CommandException(Messages.COMMAND_PAGE_MISSING);
            return;
        }

        // Scheduled Activities
        entriesPresent = false;
        paginator.addLine(ChatColor.GRAY + "Scheduled Scripts:");
        paginator.addLine("<e>Key: <a>Time  <b>Name");
        if (assignmentScript.contains("SCHEDULED ACTIVITIES")) {
            entriesPresent = true;
            for (String scriptEntry : assignmentScript.getStringList("SCHEDULED ACTIVITIES"))
                paginator.addLine("<a>" + scriptEntry.split(" ")[0] + "<b> " + scriptEntry.split(" ", 2)[1]);
        } if (!entriesPresent) paginator.addLine("<c>No scheduled scripts activities.");
        paginator.addLine("");

        // Actions
        entriesPresent = false;
        paginator.addLine(ChatColor.GRAY + "Actions:");
        paginator.addLine("<e>Key: <a>Action name  <b>Script Size");
        if (assignmentScript.contains("ACTIONS")) entriesPresent = true;
        if (entriesPresent)
            for (String action : assignmentScript.getConfigurationSection("ACTIONS").getKeys(false))
                paginator.addLine("<a>" + action + " <b>" + assignmentScript.getStringList("ACTIONS." + action).size());
        else paginator.addLine("<c>No actions defined in the assignment.");
        paginator.addLine("");

        if (!paginator.sendPage(sender, page))
            throw new CommandException(Messages.COMMAND_PAGE_MISSING, page);
View Full Code Here

TOP

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

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.