Delay

Discussion in 'Plugin Development' started by Adriani6, Jun 16, 2013.

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

    Adriani6

    Hi. I'm fairly new to Java. Anyway, I have written code which makes you invisible after you die, now what I want it to do is, after two minutes make you back visible...
    I used this code to make dead player invisible.
    Code:java
    1. for (Player players : Bukkit.getOnlinePlayers())
    2. {
    3. players.hidePlayer(p);
    4. }


    Help appreciated. Thanks.
     
  2. Offline

    bennie3211

  3. Offline

    Adriani6

  4. could you show us the rest of the method eg. the player death event listener so i can help more, here is an example of the scheduler running a task.

    Code:java
    1. this.getServer().getScheduler().runTaskLater(this, new Runnable(){
    2.  
    3. @override
    4.  
    5. public void run(){
    6.  
    7. //code here to make player visible
    8.  
    9. }
    10.  
    11. }, 20*20L);
    12.  


    that should run the task 2 mins after it is called to be scheduled.
    hope this helps! :)

    You will probobly need to pass in the player or the player name to the task so that you know what player to unvanish
     
Thread Status:
Not open for further replies.

Share This Page