Passing code from a non-main thread into the main thread

Discussion in 'Plugin Development' started by leduyquang753, Aug 29, 2017.

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

    leduyquang753

    I'm developing a plugin that uses timings, and in order to do that I implemented a Runnable that sends commands to the plugin every seconds. But I have a problem. That when it executes commands (such as calling a function), it seems to run in that thread, not the main thread, so when I run the plugin inside Bukkit it is not thread-safe. So is there any way to pass this call to the main thread?

    I didn't use async because I want my task to stop some time, so I implemented a Runnable running in a different thread...
     
    Last edited: Aug 30, 2017
  2. Online

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page