diff --git a/src/main/java/net/knarcraft/stargatecommand/StargateCommand.java b/src/main/java/net/knarcraft/stargatecommand/StargateCommand.java index b7c4c99..0e9c76c 100644 --- a/src/main/java/net/knarcraft/stargatecommand/StargateCommand.java +++ b/src/main/java/net/knarcraft/stargatecommand/StargateCommand.java @@ -21,9 +21,9 @@ public class StargateCommand extends JavaPlugin { RegisteredServiceProvider stargateProvider = servicesManager.getRegistration(StargateAPI.class); if (stargateProvider != null) { StargateAPI stargateAPI = stargateProvider.getProvider(); - + //Register commands - PluginCommand stargateCommand = this.getCommand("stargatecommand"); + PluginCommand stargateCommand = this.getCommand("stargateCommand"); if (stargateCommand != null) { stargateCommand.setExecutor(new CommandStarGateCommand(stargateAPI)); stargateCommand.setTabCompleter(new StargateCommandTabCompleter()); @@ -38,5 +38,5 @@ public class StargateCommand extends JavaPlugin { public void onDisable() { //Currently, nothing needs to be disabled } - + } diff --git a/src/main/java/net/knarcraft/stargatecommand/command/CommandConfig.java b/src/main/java/net/knarcraft/stargatecommand/command/CommandConfig.java index a6472c5..1d09d04 100644 --- a/src/main/java/net/knarcraft/stargatecommand/command/CommandConfig.java +++ b/src/main/java/net/knarcraft/stargatecommand/command/CommandConfig.java @@ -17,17 +17,17 @@ import java.util.Arrays; * This command represents the config command for changing config values */ public class CommandConfig implements CommandExecutor { - + private final ConfigurationAPI configurationAPI; /** * Instantiates a new instance of the config command - * + * * @param configurationAPI

A reference to the Stargate API

*/ public CommandConfig(ConfigurationAPI configurationAPI) { super(); - + this.configurationAPI = configurationAPI; } @@ -95,10 +95,10 @@ public class CommandConfig implements CommandExecutor { } } } - - /* Test any option data type with a defined set of values. + + /* Test any option data type with a defined set of values. * Color is excluded as it has a near-infinite number of valid values. */ - if (optionDataType != OptionDataType.COLOR && optionDataType.getValues() != null && + if (optionDataType != OptionDataType.COLOR && optionDataType.getValues() != null && optionDataType.getValues().length > 0) { if (!checkIfValueMatchesDatatype(optionDataType, value, commandSender)) { return; @@ -111,15 +111,15 @@ public class CommandConfig implements CommandExecutor { /** * Checks if the given value is valid for the given option data type and warns if it isn't - * - * @param dataType

The expected type for the value

- * @param value

The value to check

+ * + * @param dataType

The expected type for the value

+ * @param value

The value to check

* @param commandSender

The command sender to warn about invalid values

* @return

True if the given value is valid for the option data type

*/ private boolean checkIfValueMatchesDatatype(OptionDataType dataType, String value, CommandSender commandSender) { if (!matchesOptionDataType(dataType, value)) { - commandSender.sendMessage(String.format("Invalid %s given", + commandSender.sendMessage(String.format("Invalid %s given", dataType.name().toLowerCase().replace('_', ' '))); return false; } else { @@ -129,9 +129,9 @@ public class CommandConfig implements CommandExecutor { /** * Checks if the given value is valid for the given option data type - * + * * @param dataType

The expected type for the value

- * @param value

The value to check

+ * @param value

The value to check

* @return

True if the given value is valid for the option data type

*/ private boolean matchesOptionDataType(OptionDataType dataType, String value) { @@ -141,7 +141,7 @@ public class CommandConfig implements CommandExecutor { /** * Saves the configuration file and reloads * - * @param commandSender

The command sender that executed the config command

+ * @param commandSender

The command sender that executed the config command

*/ private void saveAndReload(CommandSender commandSender) { configurationAPI.saveConfiguration(); @@ -216,7 +216,7 @@ public class CommandConfig implements CommandExecutor { */ private void displayConfigValues(CommandSender sender) { sender.sendMessage(ChatColor.GREEN + "Stargate" + ChatColor.GOLD + "Config values:"); - + for (ConfigurationOption option : ConfigurationOption.values()) { sender.sendMessage(getOptionDescription(option)); } diff --git a/src/main/java/net/knarcraft/stargatecommand/command/CommandStarGateCommand.java b/src/main/java/net/knarcraft/stargatecommand/command/CommandStarGateCommand.java index 1265c47..1839eb5 100644 --- a/src/main/java/net/knarcraft/stargatecommand/command/CommandStarGateCommand.java +++ b/src/main/java/net/knarcraft/stargatecommand/command/CommandStarGateCommand.java @@ -11,9 +11,9 @@ import org.jetbrains.annotations.NotNull; * This command represents any command which starts with stargate-command (sgc) */ public class CommandStarGateCommand implements CommandExecutor { - - private StargateAPI stargateAPI; - + + private final StargateAPI stargateAPI; + public CommandStarGateCommand(StargateAPI stargateAPI) { this.stargateAPI = stargateAPI; } diff --git a/src/main/java/net/knarcraft/stargatecommand/command/ConfigTabCompleter.java b/src/main/java/net/knarcraft/stargatecommand/command/ConfigTabCompleter.java index aadf9b2..6e86d04 100644 --- a/src/main/java/net/knarcraft/stargatecommand/command/ConfigTabCompleter.java +++ b/src/main/java/net/knarcraft/stargatecommand/command/ConfigTabCompleter.java @@ -82,7 +82,7 @@ public class ConfigTabCompleter implements TabCompleter { return new ArrayList<>(); } } - + if (selectedOption.getDataType() == OptionDataType.COLOR) { return filterMatching(chatColors, typedText); } diff --git a/src/main/java/net/knarcraft/stargatecommand/command/StargateCommandTabCompleter.java b/src/main/java/net/knarcraft/stargatecommand/command/StargateCommandTabCompleter.java index 538ebae..a558737 100644 --- a/src/main/java/net/knarcraft/stargatecommand/command/StargateCommandTabCompleter.java +++ b/src/main/java/net/knarcraft/stargatecommand/command/StargateCommandTabCompleter.java @@ -46,5 +46,5 @@ public class StargateCommandTabCompleter implements TabCompleter { } return commands; } - + }