Plugin Help Delaying an Event Handler

Discussion in 'Plugin Help/Development/Requests' started by EpicBlue11, Mar 21, 2016.

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

    EpicBlue11

    Hey, I'm having a bit of trouble with my anti curse plugin. Basically, I'm trying to figure out how to make it so that after a player chats (the event handler runs) then that player must wait 3 seconds until they can send another message.

    I can figure out the player chatting and the messages and everything, all I need help with is adding the delay. Thanks a bunch for any help or suggestions :)
     
  2. Offline

    Scorpionvssub

    1 of the ways to do this is adding them to a list then starting a timer of 3 seconds or set ticks, after those are over remove em, then in the chat event if they are on the list cancel the chat msg
     
  3. Offline

    drew6017

    Make a list of UUID's. If list contains UUID of player, send message wait 3 more seconds, set canceled, return, add player's uuid to list, bukkit delayed task for 60 ticks (3 seconds), in runnable remove player's uuid from list. This is simple, easy, and it does not create threads for every single persons chat message delay because it is run on the main server thread.
     
Thread Status:
Not open for further replies.

Share This Page