diff --git a/pom.xml b/pom.xml
index f1d921d..bcd612a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ADHDMC
VillagerInfo
- 2.5
+ 2.6
jar
VillagerInfo
diff --git a/src/main/java/adhdmc/villagerinfo/Commands/CommandHandler.java b/src/main/java/adhdmc/villagerinfo/Commands/CommandHandler.java
index e003666..fc293d3 100644
--- a/src/main/java/adhdmc/villagerinfo/Commands/CommandHandler.java
+++ b/src/main/java/adhdmc/villagerinfo/Commands/CommandHandler.java
@@ -1,7 +1,6 @@
package adhdmc.villagerinfo.Commands;
-import adhdmc.villagerinfo.Config.ConfigValidator;
-import adhdmc.villagerinfo.Config.Message;
+import adhdmc.villagerinfo.Config.VIMessage;
import adhdmc.villagerinfo.VillagerInfo;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
@@ -9,6 +8,7 @@
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
+import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -19,7 +19,7 @@ public class CommandHandler implements CommandExecutor, TabExecutor {
//TY Peashooter101
@Override
- public List onTabComplete(CommandSender sender, Command command, String label, String[] args) {
+ public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
ArrayList subCommands1 = new ArrayList<>(Arrays.asList("help", "toggle", "reload"));
if (args.length == 1) {
return subCommands1;
@@ -29,10 +29,15 @@ public List onTabComplete(CommandSender sender, Command command, String
@Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
+ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
//Checking for arguments
if (args.length == 0) {
- String url = VillagerInfo.getInstance().getDescription().getWebsite();
+ String url;
+ if (VillagerInfo.getInstance().getDescription().getWebsite() != null) {
+ url = VillagerInfo.getInstance().getDescription().getWebsite();
+ } else {
+ url = "https://github.com/ADHDMC/VillagerInfo";
+ }
String version = VillagerInfo.getInstance().getDescription().getVersion();
List authors = new ArrayList<>();
for (String authorName : VillagerInfo.getInstance().getDescription().getAuthors()) {
@@ -48,12 +53,12 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
);
return true;
}
- //if has an argument, check to see if it's contained in the list of arguments
+ //if there is an argument, check to see if it's contained in the list of arguments
String command = args[0].toLowerCase();
if (subcommandList.containsKey(command)) {
subcommandList.get(command).execute(sender, Arrays.copyOfRange(args, 1, args.length));
} else {
- sender.sendMessage(miniMessage.deserialize(Message.NO_COMMAND.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.NO_COMMAND.getMessage()));
}
return true;
}
diff --git a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/HelpCommand.java b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/HelpCommand.java
index 5e7a07f..0c236a9 100644
--- a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/HelpCommand.java
+++ b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/HelpCommand.java
@@ -1,7 +1,7 @@
package adhdmc.villagerinfo.Commands.SubCommands;
import adhdmc.villagerinfo.Commands.SubCommand;
-import adhdmc.villagerinfo.Config.Message;
+import adhdmc.villagerinfo.Config.VIMessage;
import adhdmc.villagerinfo.Config.Perms;
import adhdmc.villagerinfo.VillagerInfo;
import net.kyori.adventure.text.minimessage.MiniMessage;
@@ -19,14 +19,14 @@ public HelpCommand() {
public void execute(CommandSender sender, String[] args) {
MiniMessage miniMessage = VillagerInfo.getMiniMessage();
- if (sender.hasPermission(Perms.USE.getPerm())) {
- sender.sendMessage(miniMessage.deserialize(Message.PREFIX.getMessage()));
- sender.sendMessage(miniMessage.deserialize(Message.HELP_MAIN.getMessage()));
- sender.sendMessage(miniMessage.deserialize(Message.HELP_TOGGLE.getMessage()));
- sender.sendMessage(miniMessage.deserialize(Message.HELP_RELOAD.getMessage()));
+ if (sender.hasPermission(Perms.USE.getVIPerm())) {
+ sender.sendMessage(miniMessage.deserialize(VIMessage.PLUGIN_PREFIX.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.HELP_MAIN.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.HELP_TOGGLE.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.HELP_RELOAD.getMessage()));
return;
}
- sender.sendMessage(miniMessage.deserialize(Message.NO_PERMISSION.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.NO_PERMISSION.getMessage()));
}
@Override
diff --git a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/InventoryCommand.java b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/InventoryCommand.java
deleted file mode 100644
index acbfc70..0000000
--- a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/InventoryCommand.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package adhdmc.villagerinfo.Commands.SubCommands;
-
-import adhdmc.villagerinfo.Commands.SubCommand;
-import org.bukkit.command.CommandSender;
-
-import java.util.List;
-
-public class InventoryCommand extends SubCommand {
-
-
- public InventoryCommand() {
- super("inv", "gets the inventory of the specified villager", "/vill inv ");
- }
-
-
- @Override
- public void execute(CommandSender sender, String[] args) {
-
- }
-
- @Override
- public List getSubcommandArguments(CommandSender sender, String[] args) {
- return null;
- }
-}
diff --git a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ReloadCommand.java b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ReloadCommand.java
index faca71e..fb047e8 100644
--- a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ReloadCommand.java
+++ b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ReloadCommand.java
@@ -2,7 +2,8 @@
import adhdmc.villagerinfo.Commands.SubCommand;
import adhdmc.villagerinfo.Config.ConfigValidator;
-import adhdmc.villagerinfo.Config.Message;
+import adhdmc.villagerinfo.Config.LocaleConfig;
+import adhdmc.villagerinfo.Config.VIMessage;
import adhdmc.villagerinfo.Config.Perms;
import adhdmc.villagerinfo.VillagerInfo;
import net.kyori.adventure.text.minimessage.MiniMessage;
@@ -21,13 +22,13 @@ public ReloadCommand() {
@Override
public void execute(CommandSender sender, String[] args) {
MiniMessage miniMessage = VillagerInfo.getMiniMessage();
- if (!(sender instanceof Player) || sender.hasPermission(Perms.RELOAD.getPerm())) {
+ if (!(sender instanceof Player) || sender.hasPermission(Perms.RELOAD.getVIPerm())) {
VillagerInfo.getInstance().reloadConfig();
- VillagerInfo.getLocaleConfig().reloadConfig();
+ LocaleConfig.getInstance().reloadLocale();
ConfigValidator.configValidator();
- sender.sendMessage(miniMessage.deserialize(Message.CONFIG_RELOADED.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.CONFIG_RELOADED.getMessage()));
} else {
- sender.sendMessage(miniMessage.deserialize((Message.NO_PERMISSION.getMessage())));
+ sender.sendMessage(miniMessage.deserialize((VIMessage.NO_PERMISSION.getMessage())));
}
}
diff --git a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ToggleCommand.java b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ToggleCommand.java
index 10a1a43..7e422ba 100644
--- a/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ToggleCommand.java
+++ b/src/main/java/adhdmc/villagerinfo/Commands/SubCommands/ToggleCommand.java
@@ -1,7 +1,7 @@
package adhdmc.villagerinfo.Commands.SubCommands;
import adhdmc.villagerinfo.Commands.SubCommand;
-import adhdmc.villagerinfo.Config.Message;
+import adhdmc.villagerinfo.Config.VIMessage;
import adhdmc.villagerinfo.Config.Perms;
import adhdmc.villagerinfo.VillagerInfo;
import net.kyori.adventure.text.minimessage.MiniMessage;
@@ -22,20 +22,20 @@ public ToggleCommand() {
@Override
public void execute(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
- sender.sendMessage(miniMessage.deserialize(Message.NOT_A_PLAYER.getMessage()));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.NOT_A_PLAYER.getMessage()));
return;
}
- if (!(sender.hasPermission(Perms.TOGGLE.getPerm()))) {
- sender.sendMessage(miniMessage.deserialize(Message.NO_PERMISSION.getMessage()));
+ if (!(sender.hasPermission(Perms.TOGGLE.getVIPerm()))) {
+ sender.sendMessage(miniMessage.deserialize(VIMessage.NO_PERMISSION.getMessage()));
return;
}
if (toggleSetting((Player) sender)) {
- sender.sendMessage(miniMessage.deserialize(Message.PREFIX.getMessage())
- .append(miniMessage.deserialize(Message.TOGGLE_ON.getMessage())));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.PLUGIN_PREFIX.getMessage())
+ .append(miniMessage.deserialize(VIMessage.TOGGLE_ON.getMessage())));
return;
}
- sender.sendMessage(miniMessage.deserialize(Message.PREFIX.getMessage())
- .append(miniMessage.deserialize(Message.TOGGLE_OFF.getMessage())));
+ sender.sendMessage(miniMessage.deserialize(VIMessage.PLUGIN_PREFIX.getMessage())
+ .append(miniMessage.deserialize(VIMessage.TOGGLE_OFF.getMessage())));
}
private boolean toggleSetting(Player player) {
diff --git a/src/main/java/adhdmc/villagerinfo/Config/ConfigValidator.java b/src/main/java/adhdmc/villagerinfo/Config/ConfigValidator.java
index fd46ff0..91d1e46 100644
--- a/src/main/java/adhdmc/villagerinfo/Config/ConfigValidator.java
+++ b/src/main/java/adhdmc/villagerinfo/Config/ConfigValidator.java
@@ -4,10 +4,7 @@
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Locale;
-import java.util.Map;
public class ConfigValidator {
@@ -50,7 +47,6 @@ public static void configValidator() {
soundPitch = 1.5F;
}
ToggleSetting.reloadToggles();
- Message.reloadLocale();
}
public static float getSoundPitch() {
diff --git a/src/main/java/adhdmc/villagerinfo/Config/Defaults.java b/src/main/java/adhdmc/villagerinfo/Config/Defaults.java
deleted file mode 100644
index 3a35569..0000000
--- a/src/main/java/adhdmc/villagerinfo/Config/Defaults.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package adhdmc.villagerinfo.Config;
-
-import adhdmc.villagerinfo.VillagerInfo;
-import org.bukkit.configuration.file.FileConfiguration;
-
-public class Defaults {
-
- public static void localeDefaults() {
- FileConfiguration locale = VillagerInfo.getLocaleConfig().getlocaleConfig();
- locale.addDefault("prefix", "<#3256a8>[<#4dd5ff>Villager Info<#3256a8>]");
- locale.addDefault("toggle-on", " Villager Info Toggled ON");
- locale.addDefault("toggle-off", " Villager Info Toggled OFF");
- locale.addDefault("no-permission", "You don't have permission to use this command!");
- locale.addDefault("no-command", "No subcommand by that name!");
- locale.addDefault("config-reloaded", "VillagerInfo Config Reloaded!");
- locale.addDefault("help-main", "<#4dd5ff> • How to use Villager Info\nCrouch-right-click a villager while toggle is on to have a villager's information displayed");
- locale.addDefault("help-toggle", "<#4dd5ff> • /vill toggle\nToggles the ability to receive villager information on or off.");
- locale.addDefault("help-reload", "<#4dd5ff> • /vill reload\nReloads the plugin, applies config values");
- locale.addDefault("not-a-player", "Sorry, you must be a player to use this command");
- locale.addDefault("purpur-lobotomized","<#05bff7>Lobotomized: '>[<#c4fff7>Lobotomized#c4fff7>]");
- locale.addDefault("zombie-villager-conversion-time", "<#05bff7>Conversion Time: