Solved Thread with arguments

Discussion in 'Plugin Help/Development/Requests' started by Gorbit99, Dec 12, 2015.

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

    Gorbit99

    I want to animate something inside an inventory. There will be a stained glass planes rotating around, like in a slot machine .I figured, that the best way to do this is using threads (correct me if I'm wrong), but there is a problem: I can't create a thread with arguments, and I need to have variable amount of plane types. How could I solve this, or what's another way of creating animated GUIs?

    -Gorbit99
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Gorbit99 BukkitRunnable is better then threads for this.
     
  3. Offline

    Gorbit99

    @timtower Thank you for pointing that out, but my problem still stands, I don't know, how to pass arguments to a thread
     
  4. Offline

    timtower Administrator Administrator Moderator

    @Gorbit99 BukkitRunnables are able to access plugins / variables.
    You can also extend it and add a constructor to it.
     
    Gorbit99 likes this.
  5. Offline

    Gorbit99

    @timtower Can you give me an example, or link one, so I can see, how it works?

    EDIT: found a tutorial, thank you for helping

    EDIT2: @timtower Ok, I have one more question, it seems like, that Thread.sleep doesn't work inside bukkitrunnable(Strops the whole server). What can I use to get the same effect inside a Bukkitrunnable?
     
    Last edited: Dec 12, 2015
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page