Send message only once

Discussion in 'Plugin Development' started by HackintoshMan, Apr 23, 2013.

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

    HackintoshMan

    So I have a playerMoveEvent method. It checks to see if a player is at a location. If they are at the location, it checks if they are on the correct team. If they are on the wrong team and they try to capture the point, it sends them a message to tell them that they are trying to defend the point. But if they move a small amount, it will spam the chat with the same message. How can I limit the sending of messages?
     
  2. Offline

    HackintoshMan

    bump…
     
  3. Offline

    Technius

    HackintoshMan
    You may want to have a HashMap storing the locations of the players. In your move event method, check to see if the positions are outside of the points and then see if the locations that the players are moving to are inside the points. If that is true, then the message will get sent. Make sure that the players are stored in the HashMap with their locations after each check.
     
  4. Offline

    HackintoshMan

    So how would i check to see if each player is on the point??
     
  5. Offline

    Jake0oo0

    player.getLocation();
     
  6. Offline

    HackintoshMan

    I knew that lol. But how how would I check all of the players locations at once?

    Should I do a async tasks and check all of their locate and compare them?
     
  7. Offline

    Jake0oo0

    You could do that. Or if you wanted you could do an onPlayerMoveEvent, however those aren't very resource efficient I hear.
     
Thread Status:
Not open for further replies.

Share This Page