Creating a new Thread vs Creating new task for BukkitScheduler

Discussion in 'Plugin Development' started by nala3, Jun 24, 2012.

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

    nala3

    Most people would probably say to just create a new task and let the Bukkit Scheduler handle it, and in most cases I agree. But I am wondering would there ever be a case where it is better to create a new thread?
     
  2. When dealing with thread safe methods from Bukkit and/or methods that are unrelated to the game.
    You can still use Bukkit's scheduler to make an ASync task which runs in a separate thread.
    In the scheduler wiki it specifies which methods are thread safe.

    If you need to make intensive actions that change game stuff (like placing 1 milion blocks) you should optimize it by splitting the actions in more chunks... so for that 1 mil blocks example, you can place 1k blocks per tick and it'll be alot better than placing all 1mil in 1 tick as it will freeze the server.
     
  3. at a bukkit ascry task, the thread get interrupted when the plugin is stopping, at your own thread, you need to do it by your own
     
  4. Offline

    anakatocraft

    how do i create a new thread?
     
  5. Offline

    The_Doctor_123

    anakatocraft
    You create a new Thread object. It takes a Runnable in the constructor.

    Also, nice job on bumping a 1 1/2 year old thread.
     
    Ultimate_n00b likes this.
Thread Status:
Not open for further replies.

Share This Page