diff --git a/pom.xml b/pom.xml index a94526c..14ca136 100644 --- a/pom.xml +++ b/pom.xml @@ -52,9 +52,16 @@ maven-shade-plugin 3.2.2 + + + + org.bstats + nl.SBDeveloper.V10Lift.Metrics + + + - shade package shade @@ -135,6 +142,10 @@ iobyte-repo https://nexus.iobyte.nl/repository/maven-public/ + + CodeMC + https://repo.codemc.org/repository/maven-public + @@ -173,6 +184,14 @@ jackson-module-parameter-names 2.10.2 + + + + org.bstats + bstats-bukkit + 1.7 + compile + \ No newline at end of file diff --git a/src/main/lombok/nl/SBDeveloper/V10Lift/V10LiftPlugin.java b/src/main/lombok/nl/SBDeveloper/V10Lift/V10LiftPlugin.java index dd1f6a4..d24edef 100644 --- a/src/main/lombok/nl/SBDeveloper/V10Lift/V10LiftPlugin.java +++ b/src/main/lombok/nl/SBDeveloper/V10Lift/V10LiftPlugin.java @@ -8,9 +8,11 @@ import nl.SBDeveloper.V10Lift.Listeners.EntityDamageListener; import nl.SBDeveloper.V10Lift.Listeners.PlayerInteractListener; import nl.SBDeveloper.V10Lift.Listeners.SignChangeListener; import nl.SBDeveloper.V10Lift.Managers.DBManager; +import nl.SBDeveloper.V10Lift.Managers.DataManager; import nl.SBDevelopment.SBUtilities.Data.YamlFile; import nl.SBDevelopment.SBUtilities.PrivateManagers.UpdateManager; import nl.SBDevelopment.SBUtilities.SBUtilities; +import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -55,16 +57,22 @@ public class V10LiftPlugin extends JavaPlugin { Bukkit.getPluginManager().registerEvents(new SignChangeListener(), this); Bukkit.getPluginManager().registerEvents(new EntityDamageListener(), this); + //Load metrics + Metrics metrics = new Metrics(this, 6564); + metrics.addCustomChart(new Metrics.SingleLineChart("lifts", () -> DataManager.getLifts().size())); + //Load the update checker - new UpdateManager(this, 72317, UpdateManager.CheckType.SPIGOT).handleResponse((versionResponse, version) -> { - if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) { - Bukkit.getLogger().warning("[V10Lift] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version); - } else if (versionResponse == UpdateManager.VersionResponse.LATEST) { - Bukkit.getLogger().info("[V10Lift] You are running the latest version [" + this.getDescription().getVersion() + "]!"); - } else if (versionResponse == UpdateManager.VersionResponse.UNAVAILABLE) { - Bukkit.getLogger().severe("[V10Lift] Unable to perform an update check."); - } - }).check(); + if (getSConfig().getFile().getBoolean("CheckUpdates")) { + new UpdateManager(this, 72317, UpdateManager.CheckType.SPIGOT).handleResponse((versionResponse, version) -> { + if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) { + Bukkit.getLogger().warning("[V10Lift] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version); + } else if (versionResponse == UpdateManager.VersionResponse.LATEST) { + Bukkit.getLogger().info("[V10Lift] You are running the latest version [" + this.getDescription().getVersion() + "]!"); + } else if (versionResponse == UpdateManager.VersionResponse.UNAVAILABLE) { + Bukkit.getLogger().severe("[V10Lift] Unable to perform an update check."); + } + }).check(); + } Bukkit.getLogger().info("[V10Lift] Plugin loaded successfully!"); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ee7d594..70699ab 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -9,4 +9,5 @@ MasterRepairItem: DIAMOND MasterRepairAmount: 10 DefaultSpeed: 16 DefaultRealistic: true -DoorCloseTime: 100 \ No newline at end of file +DoorCloseTime: 100 +CheckUpdates: true \ No newline at end of file