Solved Timer errors help

Discussion in 'Plugin Development' started by Covrigel, Aug 1, 2014.

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

    Covrigel

    Code:java
    1. public void smecherie() {
    2. Bukkit.getServer().getScheduler()
    3. .scheduleSyncRepeatingTask(this, new Runnable() {
    4.  
    5. public void run() {
    6. for (Player player : Bukkit.getServer()
    7. .getOnlinePlayers()) {
    8. if (player.getLevel() < 20)
    9. player.giveExpLevels(1);
    10.  
    11. if (player.getInventory().getHelmet() != null)
    12. player.getInventory().getHelmet()
    13. .setDurability((short) 0);
    14.  
    15. if (player.getInventory().getChestplate() != null)
    16. player.getInventory().getChestplate()
    17. .setDurability((short) 0);
    18.  
    19. if (player.getInventory().getLeggings() != null)
    20. player.getInventory().getLeggings()
    21. .setDurability((short) 0);
    22.  
    23. if (player.getInventory().getBoots() != null)
    24. player.getInventory().getBoots()
    25. .setDurability((short) 0);
    26.  
    27. if (player.getItemInHand() != null)
    28. player.getItemInHand().setDurability((short) 0);
    29. }
    30. }
    31. }, 10L, 10L);
    32. }

    That's my code and that's the error:
    Code:
    02.08 00:51:04 [Server] INFO at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260) [craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:600) [craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345) [craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftTask.run(CraftTask.java:53) ~[craftbukkit-1.7.9-R0.1.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    02.08 00:51:04 [Server] INFO at me.nastasescu.KitPVP.main$1.run(main.java:88) ~[?:?]
    02.08 00:51:04 [Server] INFO java.lang.NoSuchMethodError: org.bukkit.Server.getOnlinePlayers()Ljava/util/Collection;
     
  2. Offline

    TheMcScavenger

    I love it when people provide a stack trace without specifying which line is which.. Either post your full code, or indicate actual line numbers.
     
  3. Offline

    Covrigel

    TheMcScavenger the line 88 is the publicvoid run(){, where is the error.

     
  4. Offline

    TheMcScavenger

  5. Offline

    Niknea

    Covrigel Also, your timer will be executed after 1/2 of a second, if you'd like it to be executed after 10 seconds, times 10 by 20, 20 representing the amount of ticks per second.
     
  6. Offline

    TheMcScavenger

    I'm guessing the idea behind the repeating task is to make it seem as if the items don't get damaged, and the user keeps his XP. In which case, it may be more efficient (almost positive...) to use event handlers.
     
  7. Offline

    Covrigel

    Niknea i want to execute in every 1/2 seconds.
    Also what is the resolve to the getHealth() ambigous?

    Resolved!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
Thread Status:
Not open for further replies.

Share This Page