aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/commands
diff options
context:
space:
mode:
authorTymanWasTaken <tyman@tyman.tech>2021-07-06 17:15:21 -0400
committerTymanWasTaken <tyman@tyman.tech>2021-07-06 17:17:22 -0400
commita8e475fa0a7977f64f072548459d592274169d66 (patch)
tree2f6e3c2fc4aa55c52b848adc493a9ecc842e53f8 /src/main/java/com/thatgravyboat/skyblockhud/commands
parentbb75fd7b83b238f1f922ffc64b2a0a535c5524b7 (diff)
downloadSkyblockHud-Death-Defied-a8e475fa0a7977f64f072548459d592274169d66.tar.gz
SkyblockHud-Death-Defied-a8e475fa0a7977f64f072548459d592274169d66.tar.bz2
SkyblockHud-Death-Defied-a8e475fa0a7977f64f072548459d592274169d66.zip
Format v2
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/commands')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java91
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleCommand.java101
2 files changed, 104 insertions, 88 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java
index 3e1c995..e09f324 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java
@@ -12,48 +12,57 @@ import org.apache.commons.lang3.StringUtils;
public class Commands {
- private static final SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- if (args.length > 0) {
- SkyblockHud.screenToOpen =
- new GuiScreenElementWrapper(
- new SBHConfigEditor(SkyblockHud.config, StringUtils.join(args, " "))
- );
- } else {
- SkyblockHud.screenToOpen =
- new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config));
- }
- }
- };
+ private static final SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() {
+ public void processCommand(ICommandSender sender, String[] args) {
+ if (args.length > 0) {
+ SkyblockHud.screenToOpen =
+ new GuiScreenElementWrapper(
+ new SBHConfigEditor(
+ SkyblockHud.config,
+ StringUtils.join(args, " ")
+ )
+ );
+ } else {
+ SkyblockHud.screenToOpen =
+ new GuiScreenElementWrapper(
+ new SBHConfigEditor(SkyblockHud.config)
+ );
+ }
+ }
+ };
- 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
- );
+ 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
+ );
- private static final SimpleCommand mapCommand = new SimpleCommand(
- "sbhmap",
- new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- if (
- LocationHandler.getCurrentLocation().getCategory().getMap() != null
- ) SkyblockHud.screenToOpen = new MapHandler.MapScreen();
- }
- }
- );
+ private static final SimpleCommand mapCommand = new SimpleCommand(
+ "sbhmap",
+ new SimpleCommand.ProcessCommandRunnable() {
+ public void processCommand(ICommandSender sender, String[] args) {
+ if (
+ LocationHandler
+ .getCurrentLocation()
+ .getCategory()
+ .getMap() !=
+ null
+ ) SkyblockHud.screenToOpen = new MapHandler.MapScreen();
+ }
+ }
+ );
- public static void init() {
- ClientCommandHandler.instance.registerCommand(settingsCommand);
- ClientCommandHandler.instance.registerCommand(settingsCommand2);
- ClientCommandHandler.instance.registerCommand(settingsCommand3);
- ClientCommandHandler.instance.registerCommand(mapCommand);
- }
+ public static void init() {
+ ClientCommandHandler.instance.registerCommand(settingsCommand);
+ ClientCommandHandler.instance.registerCommand(settingsCommand2);
+ ClientCommandHandler.instance.registerCommand(settingsCommand3);
+ ClientCommandHandler.instance.registerCommand(mapCommand);
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleCommand.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleCommand.java
index 49a02a8..358ebe0 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleCommand.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleCommand.java
@@ -11,62 +11,69 @@ import net.minecraft.util.BlockPos;
**/
public class SimpleCommand extends CommandBase {
- private String commandName;
- private ProcessCommandRunnable runnable;
- private TabCompleteRunnable tabRunnable;
+ private String commandName;
+ private ProcessCommandRunnable runnable;
+ private TabCompleteRunnable tabRunnable;
- public SimpleCommand(String commandName, ProcessCommandRunnable runnable) {
- this.commandName = commandName;
- this.runnable = runnable;
- }
+ public SimpleCommand(String commandName, ProcessCommandRunnable runnable) {
+ this.commandName = commandName;
+ this.runnable = runnable;
+ }
- public SimpleCommand(
- String commandName,
- ProcessCommandRunnable runnable,
- TabCompleteRunnable tabRunnable
- ) {
- this.commandName = commandName;
- this.runnable = runnable;
- this.tabRunnable = tabRunnable;
- }
+ public SimpleCommand(
+ String commandName,
+ ProcessCommandRunnable runnable,
+ TabCompleteRunnable tabRunnable
+ ) {
+ this.commandName = commandName;
+ this.runnable = runnable;
+ this.tabRunnable = tabRunnable;
+ }
- public abstract static class ProcessCommandRunnable {
+ public abstract static class ProcessCommandRunnable {
- public abstract void processCommand(ICommandSender sender, String[] args);
- }
+ public abstract void processCommand(
+ ICommandSender sender,
+ String[] args
+ );
+ }
- public abstract static class TabCompleteRunnable {
+ public abstract static class TabCompleteRunnable {
- public abstract List<String> tabComplete(
- ICommandSender sender,
- String[] args,
- BlockPos pos
- );
- }
+ public abstract List<String> tabComplete(
+ ICommandSender sender,
+ String[] args,
+ BlockPos pos
+ );
+ }
- public boolean canCommandSenderUseCommand(ICommandSender sender) {
- return true;
- }
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
- public String getCommandName() {
- return commandName;
- }
+ public String getCommandName() {
+ return commandName;
+ }
- public String getCommandUsage(ICommandSender sender) {
- return "/" + commandName;
- }
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + commandName;
+ }
- public void processCommand(ICommandSender sender, String[] args)
- throws CommandException {
- runnable.processCommand(sender, args);
- }
+ public void processCommand(ICommandSender sender, String[] args)
+ throws CommandException {
+ runnable.processCommand(sender, args);
+ }
- public List<String> addTabCompletionOptions(
- ICommandSender sender,
- String[] args,
- BlockPos pos
- ) {
- if (tabRunnable != null) return tabRunnable.tabComplete(sender, args, pos);
- return null;
- }
+ public List<String> addTabCompletionOptions(
+ ICommandSender sender,
+ String[] args,
+ BlockPos pos
+ ) {
+ if (tabRunnable != null) return tabRunnable.tabComplete(
+ sender,
+ args,
+ pos
+ );
+ return null;
+ }
}