Development Assistance Magic Clock Not Working?

Discussion in 'Plugin Help/Development/Requests' started by kaleb712, Nov 29, 2014.

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

    kaleb712

    I coded a "Magic Clock" for a hub server, the thing that toggles player visibility on and off, and it's giving me java errors in the console when I click the clock. If I remove the for loop, the error goes away, but then renders the plugin useless.

    Code:java
    1. @EventHandler
    2. public void onTogglePlayer(PlayerInteractEvent e) {
    3. if (e.getPlayer().getItemInHand().getTypeId() == 347) {
    4. if (playersenabled.get(e.getPlayer()) == true ) {
    5. playersenabled.put(e.getPlayer(), false);
    6. e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.NOTE_PLING, 10, 1);
    7. e.getPlayer().sendMessage("§9Player Visibility> §8Invisible");
    8. for (Player pl : Bukkit.getOnlinePlayers()) {
    9. e.getPlayer().hidePlayer(pl);
    10. }
    11.  
    12. } else if (playersenabled.get(e.getPlayer()) == false ) {
    13. playersenabled.put(e.getPlayer(), true);
    14. e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.NOTE_PLING, 10, 1);
    15. e.getPlayer().sendMessage("§9Player Visibility> §8Visible");
    16. for (Player pl : Bukkit.getOnlinePlayers()) {
    17. e.getPlayer().showPlayer(pl);
    18. }
    19. }
    20. }
    21. }


    Error Message:
    [04:37:06 ERROR]: Could not pass event PlayerInteractEvent to Hub v1
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:294) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:216) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-g
    a6e0bfd-b3095jnks]
    at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:186) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-g
    a6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java
    :605) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.a(SourceFile:60)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.handle(SourceFile
    :9) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157
    ) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craf
    tbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:6
    67) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    60) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    Caused by: java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljav
    a/util/Collection;
    at flame.mc.hub.listen.onTogglePlayer(listen.java:129) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
    _25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
    _25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_25]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-1-ga6e0bfd-b3095jnks]
    ... 15 more
     
  2. Offline

    timtower Administrator Moderator

    kaleb712 Then please post the errors as well and tell us which line it is.
     
  3. Offline

    kaleb712

    Edit: Posted Error (Repeats The Same One)
     
  4. Offline

    timtower Administrator Moderator

    kaleb712 Please use http://pastebin.com for your logs.
    java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljav a/util/Collection;
    Your bukkit and craftbukkit versions probably aren't the same.
     
  5. Offline

    kaleb712

    They aren't the same, but everything else works fine. I downloaded a magic clock plugin off the bukkit dev that uses the same method (Bukkit.getOnlinePlayers()), and it works. Mine does not.
     
  6. Offline

    timtower Administrator Moderator

    Try to use the same craftbukkit / bukkit versions, it will save you loads of hassle.
     
Thread Status:
Not open for further replies.

Share This Page