PlayerMoveEvent vs. Scheduler

Discussion in 'Plugin Development' started by Zupsub, Jun 12, 2014.

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

    Zupsub

    I just created a plugin, one thing I needed was to get notified when a player moves into a certain area.

    So what is the best practice for this?
    Of course, I can just use a PlayerMoveEvent and check whether the player is in the certain region.
    OR I launch a tasktimer to check every second whether one player is in the area.

    So what do you think is better? Since on larger servers there will be at least a few players moving so the even will be triggered very often, won't it? So if I can live with that second delay would it be more performant to launch that repeating runnable?

    Thanks for any suggestions
     
  2. Offline

    Mrawesomecookie

    Zupsub
    I really don't recommend using a repeating timer since it uses up a lot more CPU (and ram depending on what you are doing). To check the region you could use WorldEdit's API, however its not a very good API, and it can be confusing. I don't know if its possible, but you could listen in a separate thread.
     
Thread Status:
Not open for further replies.

Share This Page