Checking when a player is in sunlight

Discussion in 'Plugin Development' started by Ezzy, Jan 7, 2012.

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

    Ezzy

    Hi all,

    I understand the idea of checking whether the player is in the sun or not, that is easy. What I'm trying to get my head around is checking that every tick, for specific players.

    Is this a time to make a custom event or is there another way?

    Thanks to anyone that replies, your time is appreciated.
     
  2. Don't check every tick, every second is just fine, 20 ticks.... with a task ofc.
    In the task just loop through all players and check if any of them fit your criteria OR loop through your own list of strings and get players by name, I dumno which one is faster.

    The onPlayerMove() event is called too many times for this so don't use it.

    @Chiller criptic much ? :p
     
  3. Offline

    Chiller

    Dont know what happen... But ya just do if (tick % 20 == 0) That will be every 20 ticks
     
  4. There's no need ... http://wiki.bukkit.org/Scheduler_Programming

    At OP: If you want to check it for a SPECIFIC player, let the task know which player that is when you create it, instead of all that searching-for-players-in-task rubbish.
     
  5. Offline

    Chiller

    Thats what I was trying to say in my blank post :p
     
Thread Status:
Not open for further replies.

Share This Page