diff --git a/.gitignore b/.gitignore index 028fb0c..dc7d8e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,86 +1,13 @@ -# Git -*.orig -!.gitignore - -# Windows -Thumbs.db -ehthumbs.db -ehthumbs_vista.db -*.stackdump -[Dd]esktop.ini -$RECYCLE.BIN/ -*.lnk - -# Linux -*~ -.fuse_hidden* -.directory -.Trash-* -.nfs* - -# MacOS -.DS_Store -.AppleDouble -.LSOverride -._* - -# Java -*.class -*.log -*.ctxt -.mtj.tmp/ -*.jar -*.war -*.nar -*.ear -hs_err_pid* - -# Maven +# compile output target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -# Intellij +# IntelliJ files +.idea *.iml -*.java___jb_tmp___ -.idea/* -*.ipr -*.iws -/out/ -.idea_modules/ +out +gen -# Eclipse -*.pydevproject -.metadata -.gradle -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.project -.externalToolBuilders/ -*.launch -.cproject +# eclipse files +.settings .classpath -.buildpath -.target - -# NetBeans -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -nbactions.xml -nb-configuration.xml -.nb-gradle/ \ No newline at end of file +.project diff --git a/LICENSE b/LICENSE index 02bbb60..65c5ca8 100644 --- a/LICENSE +++ b/LICENSE @@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation. whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the -Library. \ No newline at end of file +Library. diff --git a/README.md b/README.md index 9d28384..1e0dd8c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # bStats Metrics classes This repo includes the metrics classes for Bukkit/Spigot, Bungeecord and Sponge. -A tutorial on how to include them into your project can be found [here](https://bstats.org/getting-started/metrics-class). \ No newline at end of file +A tutorial on how to include them into your project can be found [here](https://bstats.org/getting-started/metrics-class). diff --git a/bstats-bukkit-lite/pom.xml b/bstats-bukkit-lite/pom.xml index 5ef00e7..7289a2c 100644 --- a/bstats-bukkit-lite/pom.xml +++ b/bstats-bukkit-lite/pom.xml @@ -28,4 +28,4 @@ - \ No newline at end of file + diff --git a/bstats-bukkit-lite/src/main/java/org/bstats/bukkit/MetricsLite.java b/bstats-bukkit-lite/src/main/java/org/bstats/bukkit/MetricsLite.java index 355c60c..13bcf00 100644 --- a/bstats-bukkit-lite/src/main/java/org/bstats/bukkit/MetricsLite.java +++ b/bstats-bukkit-lite/src/main/java/org/bstats/bukkit/MetricsLite.java @@ -107,8 +107,7 @@ public MetricsLite(Plugin plugin) { ).copyDefaults(true); try { config.save(configFile); - } catch (IOException ignored) { - } + } catch (IOException ignored) { } } // Load the data @@ -123,8 +122,7 @@ public MetricsLite(Plugin plugin) { service.getField("B_STATS_VERSION"); // Our identifier :) found = true; // We aren't the first break; - } catch (NoSuchFieldException ignored) { - } + } catch (NoSuchFieldException ignored) { } } // Register our service Bukkit.getServicesManager().register(MetricsLite.class, this, plugin, ServicePriority.Normal); @@ -158,12 +156,7 @@ public void run() { } // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - submitData(); - } - }); + Bukkit.getScheduler().runTask(plugin, () -> submitData()); } }, 1000 * 60 * 5, 1000 * 60 * 30); // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start @@ -254,8 +247,7 @@ private void submitData() { } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } } - } catch (NoSuchFieldException ignored) { - } + } catch (NoSuchFieldException ignored) { } } data.put("plugins", pluginData); @@ -281,7 +273,7 @@ public void run() { * Sends the data to the bStats server. * * @param plugin Any plugin. It's just used to get a logger instance. - * @param data The data to send. + * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(Plugin plugin, JSONObject data) throws Exception { @@ -347,4 +339,4 @@ private static byte[] compress(final String str) throws IOException { return outputStream.toByteArray(); } -} \ No newline at end of file +} diff --git a/bstats-bukkit/pom.xml b/bstats-bukkit/pom.xml index 31a5403..6ee9b1b 100644 --- a/bstats-bukkit/pom.xml +++ b/bstats-bukkit/pom.xml @@ -28,4 +28,4 @@ - \ No newline at end of file + diff --git a/bstats-bukkit/src/examples/java/ExamplePlugin.java b/bstats-bukkit/src/examples/java/ExamplePlugin.java index b7a630e..1862099 100644 --- a/bstats-bukkit/src/examples/java/ExamplePlugin.java +++ b/bstats-bukkit/src/examples/java/ExamplePlugin.java @@ -12,4 +12,4 @@ public void onEnable() { metrics.addCustomChart(new Metrics.SimplePie("chart_id", () -> "My value")); } -} \ No newline at end of file +} diff --git a/bstats-bukkit/src/main/java/org/bstats/bukkit/Metrics.java b/bstats-bukkit/src/main/java/org/bstats/bukkit/Metrics.java index e7f800e..69c78ad 100644 --- a/bstats-bukkit/src/main/java/org/bstats/bukkit/Metrics.java +++ b/bstats-bukkit/src/main/java/org/bstats/bukkit/Metrics.java @@ -108,8 +108,7 @@ public Metrics(Plugin plugin) { ).copyDefaults(true); try { config.save(configFile); - } catch (IOException ignored) { - } + } catch (IOException ignored) { } } // Load the data @@ -127,8 +126,7 @@ public Metrics(Plugin plugin) { service.getField("B_STATS_VERSION"); // Our identifier :) found = true; // We aren't the first break; - } catch (NoSuchFieldException ignored) { - } + } catch (NoSuchFieldException ignored) { } } // Register our service Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); @@ -174,12 +172,7 @@ public void run() { } // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) - Bukkit.getScheduler().runTask(plugin, new Runnable() { - @Override - public void run() { - submitData(); - } - }); + Bukkit.getScheduler().runTask(plugin, () -> submitData()); } }, 1000 * 60 * 5, 1000 * 60 * 30); // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start @@ -275,11 +268,9 @@ private void submitData() { for (RegisteredServiceProvider provider : Bukkit.getServicesManager().getRegistrations(service)) { try { pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider())); - } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { - } + } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } } - } catch (NoSuchFieldException ignored) { - } + } catch (NoSuchFieldException ignored) { } } data.put("plugins", pluginData); @@ -305,7 +296,7 @@ public void run() { * Sends the data to the bStats server. * * @param plugin Any plugin. It's just used to get a logger instance. - * @param data The data to send. + * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(Plugin plugin, JSONObject data) throws Exception { @@ -424,7 +415,7 @@ public static class SimplePie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SimplePie(String chartId, Callable callable) { @@ -455,7 +446,7 @@ public static class AdvancedPie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public AdvancedPie(String chartId, Callable> callable) { @@ -499,7 +490,7 @@ public static class DrilldownPie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public DrilldownPie(String chartId, Callable>> callable) { @@ -548,7 +539,7 @@ public static class SingleLineChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SingleLineChart(String chartId, Callable callable) { @@ -580,7 +571,7 @@ public static class MultiLineChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public MultiLineChart(String chartId, Callable> callable) { @@ -625,7 +616,7 @@ public static class SimpleBarChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SimpleBarChart(String chartId, Callable> callable) { @@ -663,7 +654,7 @@ public static class AdvancedBarChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public AdvancedBarChart(String chartId, Callable> callable) { @@ -701,4 +692,4 @@ protected JSONObject getChartData() throws Exception { } } -} \ No newline at end of file +} diff --git a/bstats-bungeecord-lite/src/main/java/org/bstats/bungeecord/MetricsLite.java b/bstats-bungeecord-lite/src/main/java/org/bstats/bungeecord/MetricsLite.java index ced28af..78f9fd7 100644 --- a/bstats-bungeecord-lite/src/main/java/org/bstats/bungeecord/MetricsLite.java +++ b/bstats-bungeecord-lite/src/main/java/org/bstats/bungeecord/MetricsLite.java @@ -207,8 +207,7 @@ private void submitData() { if (plugin instanceof JsonObject) { pluginData.add((JsonObject) plugin); } - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { - } + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } } data.add("plugins", pluginData); @@ -272,8 +271,7 @@ private Class getFirstBStatsClass() { try { // Let's check if a class with the given name exists. return Class.forName(className); - } catch (ClassNotFoundException ignored) { - } + } catch (ClassNotFoundException ignored) { } } writeFile(tempFile, getClass().getName()); return getClass(); @@ -307,7 +305,7 @@ private String readFile(File file) throws IOException { /** * Writes a String to a file. It also adds a note for the user, * - * @param file The file to write to. Cannot be null. + * @param file The file to write to. Cannot be null. * @param lines The lines to write. * @throws IOException If something did not work :( */ @@ -330,7 +328,7 @@ private void writeFile(File file, String... lines) throws IOException { * Sends the data to the bStats server. * * @param plugin Any plugin. It's just used to get a logger instance. - * @param data The data to send. + * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(Plugin plugin, JsonObject data) throws Exception { @@ -394,4 +392,4 @@ private static byte[] compress(final String str) throws IOException { return outputStream.toByteArray(); } -} \ No newline at end of file +} diff --git a/bstats-bungeecord/pom.xml b/bstats-bungeecord/pom.xml index 0b4099c..da8b814 100644 --- a/bstats-bungeecord/pom.xml +++ b/bstats-bungeecord/pom.xml @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/bstats-bungeecord/src/examples/java/ExamplePlugin.java b/bstats-bungeecord/src/examples/java/ExamplePlugin.java index e6f7074..d4fe805 100644 --- a/bstats-bungeecord/src/examples/java/ExamplePlugin.java +++ b/bstats-bungeecord/src/examples/java/ExamplePlugin.java @@ -14,4 +14,4 @@ public void onEnable() { metrics.addCustomChart(new Metrics.SimplePie("chart_id", () -> "My value")); } -} \ No newline at end of file +} diff --git a/bstats-bungeecord/src/main/java/org/bstats/bungeecord/Metrics.java b/bstats-bungeecord/src/main/java/org/bstats/bungeecord/Metrics.java index 22bb99c..c5e79bf 100644 --- a/bstats-bungeecord/src/main/java/org/bstats/bungeecord/Metrics.java +++ b/bstats-bungeecord/src/main/java/org/bstats/bungeecord/Metrics.java @@ -234,8 +234,7 @@ private void submitData() { if (plugin instanceof JsonObject) { pluginData.add((JsonObject) plugin); } - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { - } + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } } data.add("plugins", pluginData); @@ -299,8 +298,7 @@ private Class getFirstBStatsClass() { try { // Let's check if a class with the given name exists. return Class.forName(className); - } catch (ClassNotFoundException ignored) { - } + } catch (ClassNotFoundException ignored) { } } writeFile(tempFile, getClass().getName()); return getClass(); @@ -334,7 +332,7 @@ private String readFile(File file) throws IOException { /** * Writes a String to a file. It also adds a note for the user, * - * @param file The file to write to. Cannot be null. + * @param file The file to write to. Cannot be null. * @param lines The lines to write. * @throws IOException If something did not work :( */ @@ -357,7 +355,7 @@ private void writeFile(File file, String... lines) throws IOException { * Sends the data to the bStats server. * * @param plugin Any plugin. It's just used to get a logger instance. - * @param data The data to send. + * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(Plugin plugin, JsonObject data) throws Exception { @@ -475,7 +473,7 @@ public static class SimplePie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SimplePie(String chartId, Callable callable) { @@ -506,7 +504,7 @@ public static class AdvancedPie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public AdvancedPie(String chartId, Callable> callable) { @@ -550,7 +548,7 @@ public static class DrilldownPie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public DrilldownPie(String chartId, Callable>> callable) { @@ -599,7 +597,7 @@ public static class SingleLineChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SingleLineChart(String chartId, Callable callable) { @@ -631,7 +629,7 @@ public static class MultiLineChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public MultiLineChart(String chartId, Callable> callable) { @@ -676,7 +674,7 @@ public static class SimpleBarChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SimpleBarChart(String chartId, Callable> callable) { @@ -714,7 +712,7 @@ public static class AdvancedBarChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public AdvancedBarChart(String chartId, Callable> callable) { @@ -753,4 +751,4 @@ protected JsonObject getChartData() throws Exception { } -} \ No newline at end of file +} diff --git a/bstats-sponge-lite/pom.xml b/bstats-sponge-lite/pom.xml index b9e158d..f433795 100644 --- a/bstats-sponge-lite/pom.xml +++ b/bstats-sponge-lite/pom.xml @@ -28,4 +28,4 @@ - \ No newline at end of file + diff --git a/bstats-sponge-lite/src/examples/java/ExamplePlugin.java b/bstats-sponge-lite/src/examples/java/ExamplePlugin.java index f401ef8..095aa74 100644 --- a/bstats-sponge-lite/src/examples/java/ExamplePlugin.java +++ b/bstats-sponge-lite/src/examples/java/ExamplePlugin.java @@ -11,4 +11,4 @@ public class ExamplePlugin { @Inject private MetricsLite2 metrics; -} \ No newline at end of file +} diff --git a/bstats-sponge-lite/src/main/java/org/bstats/sponge/MetricsLite2.java b/bstats-sponge-lite/src/main/java/org/bstats/sponge/MetricsLite2.java index f37e309..d4a00fc 100644 --- a/bstats-sponge-lite/src/main/java/org/bstats/sponge/MetricsLite2.java +++ b/bstats-sponge-lite/src/main/java/org/bstats/sponge/MetricsLite2.java @@ -505,7 +505,7 @@ private String readFile(File file) throws IOException { * Sends the data to the bStats server. * * @param logger The used logger. - * @param data The data to send. + * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(Logger logger, JsonObject data) throws Exception { diff --git a/bstats-sponge/src/examples/java/ExamplePlugin.java b/bstats-sponge/src/examples/java/ExamplePlugin.java index 3e9de4b..e79af4d 100644 --- a/bstats-sponge/src/examples/java/ExamplePlugin.java +++ b/bstats-sponge/src/examples/java/ExamplePlugin.java @@ -19,4 +19,4 @@ public void onServerStart(GameStartedServerEvent event) { metrics.addCustomChart(new Metrics.SimplePie("chart_id", () -> "My value")); } -} \ No newline at end of file +} diff --git a/bstats-sponge/src/main/java/org/bstats/sponge/Metrics2.java b/bstats-sponge/src/main/java/org/bstats/sponge/Metrics2.java index 63f39ca..ae06e63 100644 --- a/bstats-sponge/src/main/java/org/bstats/sponge/Metrics2.java +++ b/bstats-sponge/src/main/java/org/bstats/sponge/Metrics2.java @@ -528,7 +528,7 @@ private String readFile(File file) throws IOException { * Sends the data to the bStats server. * * @param logger The used logger. - * @param data The data to send. + * @param data The data to send. * @throws Exception If the request failed. */ private static void sendData(Logger logger, JsonObject data) throws Exception { @@ -642,7 +642,7 @@ public static class SimplePie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SimplePie(String chartId, Callable callable) { @@ -673,7 +673,7 @@ public static class AdvancedPie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public AdvancedPie(String chartId, Callable> callable) { @@ -717,7 +717,7 @@ public static class DrilldownPie extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public DrilldownPie(String chartId, Callable>> callable) { @@ -766,7 +766,7 @@ public static class SingleLineChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SingleLineChart(String chartId, Callable callable) { @@ -798,7 +798,7 @@ public static class MultiLineChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public MultiLineChart(String chartId, Callable> callable) { @@ -843,7 +843,7 @@ public static class SimpleBarChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public SimpleBarChart(String chartId, Callable> callable) { @@ -881,7 +881,7 @@ public static class AdvancedBarChart extends CustomChart { /** * Class constructor. * - * @param chartId The id of the chart. + * @param chartId The id of the chart. * @param callable The callable which is used to request the chart data. */ public AdvancedBarChart(String chartId, Callable> callable) { diff --git a/pom.xml b/pom.xml index c68cb2b..f8511ac 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 1.4-SNAPSHOT pom - BStats-Metrics + bStats-Metrics The BStats metrics classes for various server implementations 2017 https://bstats.org/ @@ -185,4 +185,4 @@ - \ No newline at end of file +