Hey guys, I tried to make it so that every x mins a sound plays to all the players on the server. Here's the code I am currently using: Spoiler: Code Code (Text): Player[] arrayOfPlayer; int j = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length; for (int i = 0; i < j; i++) { Player p = arrayOfPlayer[i]; p.playSound(p.getLocation(), Sound.CLICK, 10.0F, 1.0F); Spoiler: Error Code (Text): [10:02:51] [Server thread/ERROR]: Could not load 'plugins/autobroadcast.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.Error: Unresolved compilation problems: The type com.avaje.ebean.EbeanServer cannot be resolved. It is indirectly referenced from required .class files Type mismatch: cannot convert from Collection<capture#1-of ? extends Player> to Player[] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:739) [spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigott.jar:git-Spigot-db6de12-18fbb24] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_71] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_71] at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigott.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigott.jar:git-Spigot-db6de12-18fbb24] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_71] Caused by: java.lang.Error: Unresolved compilation problems: The type com.avaje.ebean.EbeanServer cannot be resolved. It is indirectly referenced from required .class files Type mismatch: cannot convert from Collection<capture#1-of ? extends Player> to Player[] at me.prine.broadcaster.main.<init>(main.java:1) ~[?:?] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_71] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_71] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_71] at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_71] at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_71] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigott.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigott.jar:git-Spigot-db6de12-18fbb24] ... 21 more Could someone help me or give me a piece of code that should work? Regards
Or just go for the "for" loop and use it like this: for (Object name : getAllOnlinePlayers) { playSound for name } Put that in a runnable and you'll be fine
@TheBlackTeddy This is the exact way array loops are compiled by java. No one makes their array loops like this. @Pr0totype2 didn't say it was bad, though .
Don't ever use the Eclipse compiler. Compiling with errors is possibly the worst thing you could do. Besides the fact that you are clearly using decompiled code, the method signature of Bukkit.getOnlinePlayers() changed in a recent update from [Lorg/bukkit/entity/Player to a Collection.