Package com.sk89q.worldedit.util.formatting.component

Examples of com.sk89q.worldedit.util.formatting.component.CommandListBox


            Optional<Integer> limit = ActorSelectorLimits.forActor(player).getPolyhedronVertexLimit();
            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");
            box.appendCommand("sphere", "Select a sphere");
            box.appendCommand("cyl", "Select a cylinder");
            box.appendCommand("convex", "Select a convex polyhedral");

            player.printRaw(ColorCodeBuilder.asColorCodes(box));
            return;
        }
View Full Code Here


            // Calculate pagination
            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) {
                        builder.append("/");
                    }
                    if (!visited.isEmpty()) {
                        builder.append(Joiner.on(" ").join(visited));
                        builder.append(" ");
                    }
                    builder.append(mapping.getPrimaryAlias());
                    box.appendCommand(builder.toString(), mapping.getDescription().getShortDescription());
                }
            }

            actor.printRaw(ColorCodeBuilder.asColorCodes(box));
        } else {
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.util.formatting.component.CommandListBox

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.