diff --git a/src/main/java/net/draycia/carbon/util/Metrics.java b/src/main/java/net/draycia/carbon/util/Metrics.java index c3310158..2c7a42ad 100644 --- a/src/main/java/net/draycia/carbon/util/Metrics.java +++ b/src/main/java/net/draycia/carbon/util/Metrics.java @@ -10,8 +10,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.ServicePriority; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import javax.net.ssl.HttpsURLConnection; import java.io.*; @@ -65,10 +63,10 @@ public class Metrics { private static boolean logResponseStatusText; // The uuid of the server - private static @Nullable String serverUUID; + private static String serverUUID; // The plugin - private final @Nullable Plugin plugin; + private final Plugin plugin; // The plugin id private final int pluginId; @@ -83,7 +81,7 @@ public class Metrics { * @param pluginId The id of the plugin. * It can be found at What is my plugin id? */ - public Metrics(@Nullable Plugin plugin, int pluginId) { + public Metrics(Plugin plugin, int pluginId) { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null!"); } @@ -161,7 +159,7 @@ public class Metrics { * * @param chart The chart to add. */ - public void addCustomChart(@Nullable CustomChart chart) { + public void addCustomChart(CustomChart chart) { if (chart == null) { throw new IllegalArgumentException("Chart cannot be null!"); } @@ -196,7 +194,7 @@ public class Metrics { * * @return The plugin specific data. */ - public @NonNull JsonObject getPluginData() { + public JsonObject getPluginData() { JsonObject data = new JsonObject(); String pluginName = plugin.getDescription().getName(); @@ -224,7 +222,7 @@ public class Metrics { * * @return The server specific data. */ - private @NonNull JsonObject getServerData() { + private JsonObject getServerData() { // Minecraft specific data int playerAmount; try { @@ -300,7 +298,7 @@ public class Metrics { } } } - } catch (@NonNull NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } + } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } } } catch (NoSuchFieldException ignored) { } } @@ -328,7 +326,7 @@ public class Metrics { * @param data The data to send. * @throws Exception If the request failed. */ - private static void sendData(@NonNull Plugin plugin, @Nullable JsonObject data) throws Exception { + private static void sendData(Plugin plugin, JsonObject data) throws Exception { if (data == null) { throw new IllegalArgumentException("Data cannot be null!"); } @@ -378,7 +376,7 @@ public class Metrics { * @return The gzipped String. * @throws IOException If the compression failed. */ - private static byte @Nullable [] compress(final @Nullable String str) throws IOException { + private static byte[] compress(final String str) throws IOException { if (str == null) { return null; } @@ -395,21 +393,21 @@ public class Metrics { public static abstract class CustomChart { // The id of the chart - final @Nullable String chartId; + final String chartId; /** * Class constructor. * * @param chartId The id of the chart. */ - CustomChart(@Nullable String chartId) { + CustomChart(String chartId) { if (chartId == null || chartId.isEmpty()) { throw new IllegalArgumentException("ChartId cannot be null or empty!"); } this.chartId = chartId; } - private @Nullable JsonObject getRequestJsonObject() { + private JsonObject getRequestJsonObject() { JsonObject chart = new JsonObject(); chart.addProperty("chartId", chartId); try { @@ -428,7 +426,7 @@ public class Metrics { return chart; } - protected abstract @Nullable JsonObject getChartData() throws Exception; + protected abstract JsonObject getChartData() throws Exception; } @@ -451,7 +449,7 @@ public class Metrics { } @Override - protected @Nullable JsonObject getChartData() throws Exception { + protected JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); String value = callable.call(); if (value == null || value.isEmpty()) { @@ -482,7 +480,7 @@ public class Metrics { } @Override - protected @Nullable JsonObject getChartData() throws Exception { + protected JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); JsonObject values = new JsonObject(); Map map = callable.call(); @@ -526,7 +524,7 @@ public class Metrics { } @Override - public @Nullable JsonObject getChartData() throws Exception { + public JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); JsonObject values = new JsonObject(); Map> map = callable.call(); @@ -575,7 +573,7 @@ public class Metrics { } @Override - protected @Nullable JsonObject getChartData() throws Exception { + protected JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); int value = callable.call(); if (value == 0) { @@ -607,7 +605,7 @@ public class Metrics { } @Override - protected @Nullable JsonObject getChartData() throws Exception { + protected JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); JsonObject values = new JsonObject(); Map map = callable.call(); @@ -652,7 +650,7 @@ public class Metrics { } @Override - protected @Nullable JsonObject getChartData() throws Exception { + protected JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); JsonObject values = new JsonObject(); Map map = callable.call(); @@ -690,7 +688,7 @@ public class Metrics { } @Override - protected @Nullable JsonObject getChartData() throws Exception { + protected JsonObject getChartData() throws Exception { JsonObject data = new JsonObject(); JsonObject values = new JsonObject(); Map map = callable.call();