Delay action - in miliseconds

Discussion in 'Plugin Development' started by woutwoot, Dec 22, 2011.

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

    woutwoot

    I now have this:
    Code:
        public void onPlayerChat(PlayerChatEvent event){
            if(event.getMessage().equals(plugin.getConfig_message())){
                event.getPlayer().sendMessage(ChatColor.RED + plugin.getConfig_respond() + "(message kwam overeen)");
            }else{
                event.getPlayer().sendMessage(ChatColor.RED + "Message: " + event.getMessage() + " Response: " + plugin.getConfig_respond());
            }
        }
    And it is working perfectly, but in the chat,it looks like the response message is sent to the player before the player sent hes message. I have a setting in my config file to have a delay, so, how can I delay this, and how can it be in milliseconds in my config ?
     
  2. Offline

    unicode21B9

  3. Offline

    woutwoot

    Could you give me a example for the code above ? I tried to implement the code of that wiki page already, but it didn't work. I'm new at plugin developing :).
     
  4. Offline

    Rahazan

    Code:java
    1. plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
    2. {
    3. public void run() {
    4. //What you want to do
    5. }
    6. }, 0, 20)


    For a task that repeats every second.
     
Thread Status:
Not open for further replies.

Share This Page