Added metrics & made UpdateChecker optional
This commit is contained in:
parent
383b99114a
commit
a881adb64a
3 changed files with 39 additions and 11 deletions
21
pom.xml
21
pom.xml
|
@ -52,9 +52,16 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.2</version>
|
<version>3.2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.bstats</pattern>
|
||||||
|
<shadedPattern>nl.SBDeveloper.V10Lift.Metrics</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>shade</id>
|
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
|
@ -135,6 +142,10 @@
|
||||||
<id>iobyte-repo</id>
|
<id>iobyte-repo</id>
|
||||||
<url>https://nexus.iobyte.nl/repository/maven-public/</url>
|
<url>https://nexus.iobyte.nl/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>CodeMC</id>
|
||||||
|
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -173,6 +184,14 @@
|
||||||
<artifactId>jackson-module-parameter-names</artifactId>
|
<artifactId>jackson-module-parameter-names</artifactId>
|
||||||
<version>2.10.2</version>
|
<version>2.10.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- BStats, used for metrics -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bstats</groupId>
|
||||||
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -8,9 +8,11 @@ import nl.SBDeveloper.V10Lift.Listeners.EntityDamageListener;
|
||||||
import nl.SBDeveloper.V10Lift.Listeners.PlayerInteractListener;
|
import nl.SBDeveloper.V10Lift.Listeners.PlayerInteractListener;
|
||||||
import nl.SBDeveloper.V10Lift.Listeners.SignChangeListener;
|
import nl.SBDeveloper.V10Lift.Listeners.SignChangeListener;
|
||||||
import nl.SBDeveloper.V10Lift.Managers.DBManager;
|
import nl.SBDeveloper.V10Lift.Managers.DBManager;
|
||||||
|
import nl.SBDeveloper.V10Lift.Managers.DataManager;
|
||||||
import nl.SBDevelopment.SBUtilities.Data.YamlFile;
|
import nl.SBDevelopment.SBUtilities.Data.YamlFile;
|
||||||
import nl.SBDevelopment.SBUtilities.PrivateManagers.UpdateManager;
|
import nl.SBDevelopment.SBUtilities.PrivateManagers.UpdateManager;
|
||||||
import nl.SBDevelopment.SBUtilities.SBUtilities;
|
import nl.SBDevelopment.SBUtilities.SBUtilities;
|
||||||
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
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 SignChangeListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new EntityDamageListener(), 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
|
//Load the update checker
|
||||||
new UpdateManager(this, 72317, UpdateManager.CheckType.SPIGOT).handleResponse((versionResponse, version) -> {
|
if (getSConfig().getFile().getBoolean("CheckUpdates")) {
|
||||||
if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) {
|
new UpdateManager(this, 72317, UpdateManager.CheckType.SPIGOT).handleResponse((versionResponse, version) -> {
|
||||||
Bukkit.getLogger().warning("[V10Lift] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version);
|
if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) {
|
||||||
} else if (versionResponse == UpdateManager.VersionResponse.LATEST) {
|
Bukkit.getLogger().warning("[V10Lift] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version);
|
||||||
Bukkit.getLogger().info("[V10Lift] You are running the latest version [" + this.getDescription().getVersion() + "]!");
|
} else if (versionResponse == UpdateManager.VersionResponse.LATEST) {
|
||||||
} else if (versionResponse == UpdateManager.VersionResponse.UNAVAILABLE) {
|
Bukkit.getLogger().info("[V10Lift] You are running the latest version [" + this.getDescription().getVersion() + "]!");
|
||||||
Bukkit.getLogger().severe("[V10Lift] Unable to perform an update check.");
|
} else if (versionResponse == UpdateManager.VersionResponse.UNAVAILABLE) {
|
||||||
}
|
Bukkit.getLogger().severe("[V10Lift] Unable to perform an update check.");
|
||||||
}).check();
|
}
|
||||||
|
}).check();
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getLogger().info("[V10Lift] Plugin loaded successfully!");
|
Bukkit.getLogger().info("[V10Lift] Plugin loaded successfully!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,5 @@ MasterRepairItem: DIAMOND
|
||||||
MasterRepairAmount: 10
|
MasterRepairAmount: 10
|
||||||
DefaultSpeed: 16
|
DefaultSpeed: 16
|
||||||
DefaultRealistic: true
|
DefaultRealistic: true
|
||||||
DoorCloseTime: 100
|
DoorCloseTime: 100
|
||||||
|
CheckUpdates: true
|
Loading…
Reference in a new issue