From 7c00af18febf6c0b833c7633b4fb60a9a1bb93af Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 16 Oct 2021 15:50:41 -0400 Subject: Code Clean Up (#2) * intellij code clean up * optimize imports * format * intellij suggestions * fix empty catch issues --- .../github/moulberry/notenoughupdates/commands/SimpleCommand.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java index 029e24db..f13dca10 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java @@ -5,13 +5,12 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; -import java.util.ArrayList; import java.util.List; public class SimpleCommand extends CommandBase { - private String commandName; - private ProcessCommandRunnable runnable; + private final String commandName; + private final ProcessCommandRunnable runnable; private TabCompleteRunnable tabRunnable; public SimpleCommand(String commandName, ProcessCommandRunnable runnable) { @@ -50,7 +49,7 @@ public class SimpleCommand extends CommandBase { } public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { - if(tabRunnable != null) return tabRunnable.tabComplete(sender, args, pos); + if (tabRunnable != null) return tabRunnable.tabComplete(sender, args, pos); return null; } } -- cgit From ea3ec354ba3bb5b4ac64b8032816b8e4c407f099 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 28 Dec 2021 00:49:28 -0500 Subject: more code clean up (#38) --- .../io/github/moulberry/notenoughupdates/commands/SimpleCommand.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java index f13dca10..2e2e2831 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java @@ -8,7 +8,6 @@ import net.minecraft.util.BlockPos; import java.util.List; public class SimpleCommand extends CommandBase { - private final String commandName; private final ProcessCommandRunnable runnable; private TabCompleteRunnable tabRunnable; -- cgit From 393f3c8f9279f5d8f5e33933ce6ef985d65a92f0 Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Fri, 18 Feb 2022 04:58:10 -0330 Subject: Move commands to separate classes (#82) --- .../notenoughupdates/commands/SimpleCommand.java | 54 ---------------------- 1 file changed, 54 deletions(-) delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java deleted file mode 100644 index 2e2e2831..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/SimpleCommand.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.github.moulberry.notenoughupdates.commands; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.BlockPos; - -import java.util.List; - -public class SimpleCommand extends CommandBase { - private final String commandName; - private final ProcessCommandRunnable runnable; - private TabCompleteRunnable tabRunnable; - - 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 abstract static class ProcessCommandRunnable { - public abstract void processCommand(ICommandSender sender, String[] args); - } - - public abstract static class TabCompleteRunnable { - public abstract List tabComplete(ICommandSender sender, String[] args, BlockPos pos); - } - - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } - - public String getCommandName() { - return commandName; - } - - public String getCommandUsage(ICommandSender sender) { - return "/" + commandName; - } - - public void processCommand(ICommandSender sender, String[] args) throws CommandException { - runnable.processCommand(sender, args); - } - - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { - if (tabRunnable != null) return tabRunnable.tabComplete(sender, args, pos); - return null; - } -} -- cgit