Examples of StyledFragment


Examples of com.sk89q.worldedit.util.formatting.StyledFragment

            if (limit.isPresent()) {
                player.print(limit.get() + " points maximum.");
            }
        } else {
            CommandListBox box = new CommandListBox("Selection modes");
            StyledFragment contents = box.getContents();
            StyledFragment tip = contents.createFragment(Style.RED);
            tip.append("Select one of the modes below:").newLine();

            box.appendCommand("cuboid", "Select two corners of a cuboid");
            box.appendCommand("extend", "Fast cuboid selection mode");
            box.appendCommand("poly", "Select a 2D polygon with height");
            box.appendCommand("ellipsoid", "Select an ellipsoid");
View Full Code Here

Examples of com.sk89q.worldedit.util.formatting.StyledFragment

        append(box);
    }

    private void attachCommandUsage(Description description, String commandString) {
        MessageBox box = new MessageBox("Help for " + commandString);
        StyledFragment contents = box.getContents();

        if (description.getUsage() != null) {
            contents.append(new Label().append("Usage: "));
            contents.append(description.getUsage());
        } else {
            contents.append(new Subtle().append("Usage information is not available."));
        }

        contents.newLine();

        if (description.getHelp() != null) {
            contents.append(description.getHelp());
        } else if (description.getShortDescription() != null) {
            contents.append(description.getShortDescription());
        } else {
            contents.append(new Subtle().append("No further help is available."));
        }

        append(box);
    }
View Full Code Here

Examples of com.sk89q.worldedit.util.formatting.StyledFragment

            int offset = perPage * page;
            int pageTotal = (int) Math.ceil(aliases.size() / (double) perPage);

            // Box
            CommandListBox box = new CommandListBox(String.format("Help: page %d/%d ", page + 1, pageTotal));
            StyledFragment contents = box.getContents();
            StyledFragment tip = contents.createFragment(Style.GRAY);

            if (offset >= aliases.size()) {
                tip.createFragment(Style.RED).append(String.format("There is no page %d (total number of pages is %d).", page + 1, pageTotal)).newLine();
            } else {
                List<CommandMapping> list = aliases.subList(offset, Math.min(offset + perPage, aliases.size()));

                tip.append("Type ");
                tip.append(new Code().append("//help ").append("<command> [<page>]"));
                tip.append(" for more information.").newLine();

                // Add each command
                for (CommandMapping mapping : list) {
                    StringBuilder builder = new StringBuilder();
                    if (isRootLevel) {
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.