diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-07 21:52:37 -0230 |
---|---|---|
committer | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-07 21:52:37 -0230 |
commit | 36a66e436ef3c5a3aa2deda0e1538db072ca7f71 (patch) | |
tree | 32a3a104464da3ef8ee743ecfe241d1320ad25c9 /src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java | |
parent | 93248d28d6b314b42f6b0d82164975343b214ece (diff) | |
download | SkyblockHud-Death-Defied-36a66e436ef3c5a3aa2deda0e1538db072ca7f71.tar.gz SkyblockHud-Death-Defied-36a66e436ef3c5a3aa2deda0e1538db072ca7f71.tar.bz2 SkyblockHud-Death-Defied-36a66e436ef3c5a3aa2deda0e1538db072ca7f71.zip |
Added Alpha Crystal Hollows locations to get ahead of the update and added commands for people to help me with deving.
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index ef3df57..897c088 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -1,17 +1,27 @@ package com.thatgravyboat.skyblockhud.commands; +import com.google.common.collect.ImmutableSet; import com.thatgravyboat.skyblockhud.SkyblockHud; +import com.thatgravyboat.skyblockhud.api.LeaderboardGetter; import com.thatgravyboat.skyblockhud.config.SBHConfigEditor; import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; import com.thatgravyboat.skyblockhud.handlers.MapHandler; import com.thatgravyboat.skyblockhud.location.LocationHandler; -import net.minecraft.client.Minecraft; +import com.thatgravyboat.skyblockhud.playerstats.ActionBarParsing; import net.minecraft.command.ICommandSender; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.ClientCommandHandler; import org.apache.commons.lang3.StringUtils; +import java.awt.*; +import java.awt.datatransfer.StringSelection; + public class Commands { + private static boolean devMode = false; + private static final SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { if (args.length > 0) { @@ -22,6 +32,46 @@ public class Commands { } }; + private static final SimpleSubCommand devCommand = new SimpleSubCommand("sbhdev", ImmutableSet.of("copyBossBar", "copyScoreboard", "copyActionBar")) { + + @Override + void processSubCommand(ICommandSender sender, String subCommand, String[] args) { + StringSelection clipboard = null; + switch (subCommand) { + case "copyBossBar": + clipboard = new StringSelection(BossStatus.bossName); + break; + case "copyScoreboard": + StringBuilder builder = new StringBuilder(); + LeaderboardGetter.getCachedScores().forEach(s -> builder.append(s).append("\n")); + clipboard = new StringSelection(builder.toString()); + break; + case "copyActionBar": + clipboard = new StringSelection(ActionBarParsing.lastLowActionBar); + break; + } + if (clipboard != null) { + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); + sender.addChatMessage(new ChatComponentText( + "[" + + EnumChatFormatting.RED + + EnumChatFormatting.BOLD + + "SkyBlockHud" + + EnumChatFormatting.RESET + + "] : " + + EnumChatFormatting.GRAY + + "Info copied to clipboard!" + )); + } + } + + @Override + void processNoSubCommand(ICommandSender sender) { + devMode = !devMode; + sender.addChatMessage(new ChatComponentText("Dev Mode " + (devMode ? "Enabled" : "Disabled") + "!")); + } + }; + private static final SimpleCommand settingsCommand = new SimpleCommand("sbh", settingsRunnable); private static final SimpleCommand settingsCommand2 = new SimpleCommand("sbhsettings", settingsRunnable); private static final SimpleCommand settingsCommand3 = new SimpleCommand("sbhud", settingsRunnable); @@ -30,7 +80,8 @@ public class Commands { "sbhmap", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if (LocationHandler.getCurrentLocation().getCategory().getMap() != null) SkyblockHud.screenToOpen = new MapHandler.MapScreen(); + if (LocationHandler.getCurrentLocation().getCategory().getMap() != null && SkyblockHud.hasSkyblockScoreboard()) + SkyblockHud.screenToOpen = new MapHandler.MapScreen(); } } ); @@ -40,5 +91,6 @@ public class Commands { ClientCommandHandler.instance.registerCommand(settingsCommand2); ClientCommandHandler.instance.registerCommand(settingsCommand3); ClientCommandHandler.instance.registerCommand(mapCommand); + ClientCommandHandler.instance.registerCommand(devCommand); } } |