Can sendPluginMessage be used asynchronously

Discussion in 'Spigot Plugin Development' started by Nogtail, May 7, 2015.

  1. Nogtail


    I have an asynchronous event which is called before a user changes server which is used to save data to the database. After this event has completed I then send Bungee the message to send the player to another server.

    Is it safe to use Player.sendPluginMessage in another thread or is it best to call it from the main thread?
  2. @Nogtail it accesses a collection without any synchronization, so it's not completely thread safe. (though I don't get why they didn't just make that Set thread safe...)