Bukkit Runnables

Discussion in 'Plugin Development' started by 22vortex22, Oct 20, 2013.

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

    22vortex22

    Ok Im trying to make a runnable or something that removes a player from an Arraylist 45 seconds after they do a command?


    Heres the code for a command and can someone please help me?

    http://pastebin.com/4fbRMbXv

    P.S: Ik what they are and how to use them but I dont know how to implement them. So please dont say look it up
     
  2. Offline

    Skyost

    22vortex22
    Code:
    Bukkit.getScheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
     
       @Override
       public void run() {
          // Your code
       }, 900)); // 45 (sec) * 20 (tick)
    }
     
  3. Offline

    RealDope

    Use BukkitRunnables
    Code:JAVA
    1.  
    2. new BukkitRunnable() {
    3. public void run() {
    4. // Your code to remove them from ArrayList
    5. }
    6. }.runTaskLater(this, 45*20); // If not in your main class arg 1 is an instance of your main class
    7.  
     
  4. Offline

    22vortex22

    This looks like it would run my code every 45 seconds... I want it so when you do /soup it adds you to the array list then starts a 45 second cooldown and then removes them from the array list.

    Can anyone help me? I kinda need this soon

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  5. Offline

    Skyost

    22vortex22 No, it run the code only 1 time.
    Test it and you will see ! (I think I know what I am doing...)

    You have two answers, make a decision !
     
  6. Offline

    22vortex22

    KK Lets im going to test it now :D
     
    Skyost likes this.
Thread Status:
Not open for further replies.

Share This Page