Solved Bukkit.getOnlinePlayers() no such method?

Discussion in 'Plugin Development' started by IkBenHarm, Jun 27, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    IkBenHarm

    So im trying to create a plugin.
    Now i have used the method Bukkit.getOnlinePlayer() in my disable.
    Im getting the following error:

    Code:
    java.lang.NoSuchMethodError: org.bukkit.Server.getOnlinePlayers()Ljava/util/Coll
    ection;
            at me.ikbenharm.hffa.main.Main.onDisable(Main.java:60) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:252) ~[c
    raftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoade
    r.java:348) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManag
    er.java:423) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginMana
    ger.java:416) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.SimplePluginManager.clearPlugins(SimplePluginManage
    r.java:457) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:77
    0) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.Bukkit.reload(Bukkit.java:288) [craftbukkit.jar:git-Bukkit
    -1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    23) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    0) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServe
    r.java:703) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(Craf
    tServer.java:690) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:
    296) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    61) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
    And the piece of code were it all happens:

    Code:java
    1. if(!Bukkit.getOnlinePlayers().isEmpty()){
    2. for(Player p : Bukkit.getOnlinePlayers()){
    3.  
    4. if(ArenaManager.getManager().isInGame(p)){
    5. ArenaManager.getManager().removePlayer(p);
    6. }
    7.  
    8. if(Lobby.getLobby().isPlayerInLobby(p)){
    9. Lobby.getLobby().removePlayer(p);
    10. }
    11.  
    12. }
    13. }


    at line 60:

    Code:java
    1. if(!Bukkit.getOnlinePlayers().isEmpty()){


    does somebody know whats is happening here, or how i can solve it?

    Tnx!
     
  2. Offline

    ZodiacTheories

  3. Offline

    IkBenHarm

    ZodiacTheories
    well, i added that to check if it works then. but it does not matter
     
  4. Offline

    Traks

    Don't use the reload command... Check here for more info. If you get the same error after a server reboot, rebuild the jar file and re-add it to your plugins folder
     
  5. Offline

    IkBenHarm

    Traks
    I do get the same error after server reboot, also if i recreate the jar file.

    For if you'd like to see the error of the stop command:

    Code:
    java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Coll
    ection;
            at me.ikbenharm.hffa.main.Main.onDisable(Main.java:60) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:252) ~[c
    raftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoade
    r.java:348) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManag
    er.java:423) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginMana
    ger.java:416) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.disablePlugins(CraftServer
    .java:397) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.stop(MinecraftServer.jav
    a:385) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :500) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-35-gd6ac518-b3061jnks]
     
  6. Offline

    ferrybig

    Update your server, you craftbukkit at the server has the old getOnlinePlayers method, your bukkit used to code has the new one
     
  7. Offline

    IkBenHarm

    ferrybig
    i have tested that, i have the 1.7.9 bukkit in my jar file and use 1.7.9 craftbukkit in my server
     
  8. IkBenHarm Just switch to the Beta version of craftbukkit/bukkit until they release a stable R0.3 version.
     
  9. Offline

    IkBenHarm

    HeyAwesomePeople
    i do not understand what you mean by giving me this piece of code, could you maybe explain?

    HeyAwesomePeople
    ah nice, that was it! Tnx!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  10. IkBenHarm The code shown was a Craftbukkit commit that messed up or changed somethings with Bukkit.getOnlinePlayers(). Just downgrade to the Beta version(1.7.9 R0.2) for both Craftbukkit and bukkit and it will be fine.

    EDIT: You got it. Please mark as solved.
     
    SDDJ likes this.
  11. Offline

    ChipDev

    Bukkit.getServer().getOnlinePlayers
    Thats what I use for 1.7.9
     
  12. Offline

    Traks

    ChipDev Bukkit#getOnlinePlayers() calls the method getOnlinePlayers() on the object returned by Bukkit#getServer().... Using Bukkit.getServer().getOnlinePlayers() is completely unnecessary and only makes your code less 'clean' in my opinion.
     
    SDDJ and Wingzzz like this.
Thread Status:
Not open for further replies.

Share This Page