From a8df8a805f1ee491fe64c03c3c90fc2ed969b107 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 23 Oct 2019 15:58:18 +0100 Subject: [PATCH] Update CFICommands.java --- .../com/boydti/fawe/command/CFICommands.java | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java index dc97e6e68..521563bbb 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java @@ -44,10 +44,12 @@ import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.formatting.component.TextComponentProducer; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder; import com.sk89q.worldedit.util.formatting.text.event.ClickEvent; import com.sk89q.worldedit.util.formatting.text.event.HoverEvent; +import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -72,6 +74,8 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.IntStream; import javax.imageio.ImageIO; +import javax.xml.soap.Text; + import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.param.Arg; @@ -1234,12 +1238,34 @@ public class CFICommands { @SuppressWarnings("unused") protected static void mainMenu(Player player) { - //TODO -// msg("What do you want to do now?").append(newline()) -// .cmdOptions("/cfi ", "", "Coloring", "Component", "Populate", "Brush") -// .append(newline()).text("<> [View]").command("/cfi " + Commands.getAlias(CFICommands.class, "download")).tooltip("View full resolution image") -// .append(newline()).text(">< [Cancel]").cmdTip("/cfi " + Commands.getAlias(CFICommands.class, "cancel")) -// .append(newline()).text("&2>> [Done]").cmdTip("/cfi " + Commands.getAlias(CFICommands.class, "done")) -// .send(fp); + TextComponentProducer producer = new TextComponentProducer(); + producer.append(TextComponent.of("What do you want to do now?")); + producer.newline(); + String prefix = "/cfi "; + String[] options = {"Coloring", "Component", "Populate", "Brush"}; + for (int i = 0; i < options.length; i++) { + if (i != 0) { + producer.append(TextComponent.of(" | ", TextColor.DARK_GRAY)); + } + String option = options[i]; + String cmd = prefix + option; + producer.append(TextComponent.of(option, TextColor.GREEN) + .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, cmd)) + .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(option)))); + } + producer.newline(); + producer.newline().append(TextComponent.of("<> [View]", TextColor.DARK_AQUA) + .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "download")) + .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("View full res image")))); + + producer.newline().append(TextComponent.of(">< [Cancel]", TextColor.RED) + .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "cancel")) + .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("cancel")))); + + producer.newline().append(TextComponent.of(">> [Done]", TextColor.DARK_GREEN) + .clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "done")) + .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("done")))); + + player.print(producer.create()); } }