Metrics by Hidendra is outdated - getOnlinePlayers deprecated
oddare opened this issue ยท 3 comments
[06:35:47] [Craft Scheduler Thread - 50/WARN]: Exception in thread "Craft Scheduler Thread - 50" [06:35:47] [Craft Scheduler Thread - 50/WARN]: org.apache.commons.lang.UnhandledException: Plugin ecoCreature v0.3.2-SNAPSHOT-b475 generated an exception while executing task 16 at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NoSuchMethodError: org.bukkit.Server.getOnlinePlayers()[Lorg/bukkit/entity/Player; at se.crafted.chrisb.mcstats.Metrics.postPlugin(Metrics.java:335) at se.crafted.chrisb.mcstats.Metrics.access$400(Metrics.java:57) at se.crafted.chrisb.mcstats.Metrics$1.run(Metrics.java:223) at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftTask.run(CraftTask.java:71) at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) ... 3 more
I'm going over all my plugins to weed out errors and the likes, and this is one of the more annoying one. Though it only happens every 15th, as I believe requested somewhere within the code, it is still throwing up the "WARN" and, as such, giving issues while looking through logs and the likes, if not being rather annoying in general.
I've looked around the configuration, and on the Bukkit page, but I found nothing that would tell me how I could disable it. Nor do I want to delete the "mcstats" folder within the plugin in case that might give more WARNings.
Any way to disable it? Or maybe consider deprecating the metrics, as many other developers are doing?
The main issue here is the usage of the "getOnlinePlayers" which was deprecated somewhere around 1.9.
I haven't been very good about updating bukkitdev with the latest version. However, you are welcome to download the latest from here - which supports 1.10.
Uh, I did a stupid there and didn't list the version.
I have that version, the #475, but the issue is that as far as I'm aware, you're using Hidendra's mcstats (Metrics) hook (?), which hasn't been updated since Spigot/Bukkit/Everyone deprecated "getOnlinePlayers". It still works, but it gives the issue I just listed every time it is run.
And since it appears as though Hidendra is no longer updating it, multiple developers have removed it, or are telling the users to remove it if they can. For your plugin however, it appears as though it doesn't look at my "OptOut" for the plugin, nor is it asking about it itself.