diff --git a/pom.xml b/pom.xml index fcef3df..7e546c5 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.3.0 package @@ -39,6 +39,12 @@ false + + + org.bstats + adhdmc.scythe.bstats + + @@ -80,5 +86,11 @@ 1.18.2-R0.1-SNAPSHOT provided + + org.bstats + bstats-bukkit + 3.0.0 + compile + diff --git a/src/main/java/adhdmc/scythe/Scythe.java b/src/main/java/adhdmc/scythe/Scythe.java index 80b31e9..29071eb 100644 --- a/src/main/java/adhdmc/scythe/Scythe.java +++ b/src/main/java/adhdmc/scythe/Scythe.java @@ -9,6 +9,7 @@ import adhdmc.scythe.listeners.InteractListener; import adhdmc.scythe.listeners.InteractListenerDependsCoreprotect; import net.kyori.adventure.text.minimessage.MiniMessage; +import org.bstats.bukkit.Metrics; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; @@ -27,6 +28,7 @@ public void onEnable() { instance = this; logger = this.getLogger(); config = this.getConfig(); + Metrics metrics = new Metrics(this, 16540); try { Class.forName("net.kyori.adventure.text.minimessage.MiniMessage"); Class.forName("net.kyori.adventure.text.Component"); diff --git a/src/main/java/adhdmc/scythe/commands/subcommands/ReloadCommand.java b/src/main/java/adhdmc/scythe/commands/subcommands/ReloadCommand.java index 0aa3550..b980ca2 100644 --- a/src/main/java/adhdmc/scythe/commands/subcommands/ReloadCommand.java +++ b/src/main/java/adhdmc/scythe/commands/subcommands/ReloadCommand.java @@ -22,8 +22,8 @@ public ReloadCommand(){ @Override public void doThing(CommandSender sender, String[] args) { if (!(sender instanceof Player)|| sender.hasPermission(ConfigHandler.getPermMap().get(ConfigHandler.Permission.RELOAD_COMMAND))) { - ConfigHandler.configParser(); Scythe.getInstance().reloadConfig(); + ConfigHandler.configParser(); sender.sendMessage(miniMessage.deserialize(msgs.get(ConfigHandler.Message.CONFIG_RELOAD))); return; } diff --git a/src/main/java/adhdmc/scythe/config/ConfigHandler.java b/src/main/java/adhdmc/scythe/config/ConfigHandler.java index 77f6c5d..eaf8d9b 100644 --- a/src/main/java/adhdmc/scythe/config/ConfigHandler.java +++ b/src/main/java/adhdmc/scythe/config/ConfigHandler.java @@ -10,13 +10,14 @@ import org.bukkit.block.data.Ageable; import org.bukkit.block.data.BlockData; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.plugin.Plugin; import java.util.*; import java.util.logging.Logger; public class ConfigHandler { private static final Logger logger = Scythe.getScytheLogger(); - private static final FileConfiguration config = Scythe.getScytheConfig(); + private static final Plugin instance = Scythe.getInstance(); private static boolean requireHoe; private static boolean rightClickHarvest; private static final HashMap messageMap = new HashMap<>(); @@ -30,13 +31,13 @@ public static void configParser(){ setConfiguredCrops(); requireHoe = false; rightClickHarvest = true; - requireHoe = config.getBoolean("require-hoe"); - rightClickHarvest = config.getBoolean("right-click-to-harvest"); + requireHoe = instance.getConfig().getBoolean("require-hoe"); + rightClickHarvest = instance.getConfig().getBoolean("right-click-to-harvest"); } private static void setConfiguredCrops(){ configuredCrops.clear(); - List cropList = config.getStringList("crops"); + List cropList = instance.getConfig().getStringList("crops"); for (String configCrop : cropList){ if(Material.matchMaterial(configCrop) == null){ logger.warning( messageMap.get(Message.CONSOLE_PREFIX) + configCrop + " is not a valid material. Please check to be sure you spelled everything correctly."); @@ -84,25 +85,25 @@ private static void setMessageMap(){ messageMap.clear(); messageMap.put(Message.CONSOLE_PREFIX, "[Scythe] "); messageMap.put(Message.PREFIX, - config.getString("prefix","[Scythe]")); + instance.getConfig().getString("prefix","[Scythe]")); messageMap.put(Message.TOGGLE_ON, - config.getString("toggle-on", "Scythe toggled on!")); + instance.getConfig().getString("toggle-on", "Scythe toggled on!")); messageMap.put(Message.TOGGLE_OFF, - config.getString("toggle-off", "Scythe toggled off!")); + instance.getConfig().getString("toggle-off", "Scythe toggled off!")); messageMap.put(Message.UNKNOWN_COMMAND, - config.getString("unknown-command", "Unknown Command")); + instance.getConfig().getString("unknown-command", "Unknown Command")); messageMap.put(Message.CONFIG_RELOAD, - config.getString("config-reload", "Scythe Config Reloaded!")); + instance.getConfig().getString("config-reload", "Scythe Config Reloaded!")); messageMap.put(Message.NO_PERMISSION, - config.getString("no-permission", "You do not have the required Permission to run this command")); + instance.getConfig().getString("no-permission", "You do not have the required Permission to run this command")); messageMap.put(Message.NOT_A_PLAYER, - config.getString("not-a-player", "Sorry! This command can only be run by a player")); + instance.getConfig().getString("not-a-player", "Sorry! This command can only be run by a player")); messageMap.put(Message.HELP_MAIN, - config.getString("help-main", "Scythe allows players to harvest grown crops without needing to replant")); + instance.getConfig().getString("help-main", "Scythe allows players to harvest grown crops without needing to replant")); messageMap.put(Message.HELP_TOGGLE, - config.getString("help-toggle", "/scythe toggle \n• Toggle scythe on or off")); + instance.getConfig().getString("help-toggle", "/scythe toggle \n• Toggle scythe on or off")); messageMap.put(Message.HELP_RELOAD, - config.getString("help-reload", "/scythe reload \n• Reloads config settings")); + instance.getConfig().getString("help-reload", "/scythe reload \n• Reloads config settings")); } public static Map getMessageMap() { return Collections.unmodifiableMap(messageMap); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 102cdc1..6060d5b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,6 +1,6 @@ #Scythe require-hoe: false -allow-right-click-to-harvest: true +right-click-to-harvest: true #crops the plugin should work on crops: - BEETROOTS