Solved how often to schedule checking location without slowing things down

Discussion in 'Plugin Development' started by torpkev, Dec 14, 2018.

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

    torpkev

    I have a region (though I could have multiple) set up that is basically a cube. When someone steps into that cube, I'd like to display a welcome message.

    I suspect the easiest approach would be to schedule a check every second, loop through all online players, loop through a list of regions and if they're inside, send the message.

    However, I really don't have a good handle on the scheduling side of things - I worry that with a decent number of players I'll drag things down some.

    The code really isn't going to be much more complicated than that - I'd appreciate any advice on when scheduling something like that becomes too much or too often. Or am I just worrying needlessly?
     
  2. @torpkev

    I think you should use PlayerMoveEvent instead of scheduling a check every second.
     
  3. Online

    timtower Administrator Administrator Moderator

  4. Offline

    torpkev

    huh.. I would have thought that'd be firing off all the time, so less efficient than just checking once a second.

    That makes life a fair bit easier for me though.. thanks guys, appreciate the help
     
  5. Online

    timtower Administrator Administrator Moderator

    It does fire a lot, but there are a lot of optimizations that can be made.
     
Thread Status:
Not open for further replies.

Share This Page