(1.9) Using deprecated getOnlinePlayers()
gjerm opened this issue ยท 5 comments
MCTowns generates this exception on 1.9:
[18:26:27] [Craft Scheduler Thread - 9/WARN]: Exception in thread "Craft Scheduler Thread - 9"
[18:26:27] [Craft Scheduler Thread - 9/WARN]: org.apache.commons.lang.UnhandledException: Plugin MCTowns v2.4.0-6650f896d5e388047388965084ae7cf0282086da generated an exception while executing task 39
at org.bukkit.craftbukkit.v1_9_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 net.jmhertlein.mctowns.shaded.mcstats.Metrics.postPlugin(Metrics.java:357)
at net.jmhertlein.mctowns.shaded.mcstats.Metrics.access$400(Metrics.java:64)
at net.jmhertlein.mctowns.shaded.mcstats.Metrics$1.run(Metrics.java:245)
at org.bukkit.craftbukkit.v1_9_R1.scheduler.CraftTask.run(CraftTask.java:71)
at org.bukkit.craftbukkit.v1_9_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3 more
It's expecting getOnlinePlayers() to return a Player[], instead this was dropped in Bukkit 1.9 to return a Collection<? extends Player>.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Bukkit.html#getOnlinePlayers%28%29
I'll take a look at this tonight. Shouldn't be too much of an issue.
Shame that this is probably going to hose a lot of existing plugins that aren't being maintained anymore.
http://dev.bukkit.org/bukkit-plugins/mctowns/files/53-mctowns-v2-4-1/
Let me know how this works for you.
Yup, been working on upgrading a server to 1.9.. So many old plugins that worked just fine with 1.8 are broken with this change.
Just to note, you can always fix the getOnlinePlayers() issue by running the SpecialSources jar as detailed here: https://www.spigotmc.org/threads/minecraft-1-9-release.127186/ for any plugins not updated.