Want generate random time + random player

Discussion in 'Bukkit Help' started by coco5843, Jan 2, 2014.

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

    coco5843

    Hello ! Im french excuse me for imperfect english :D
    I expose you my problem :
    I want to generate a random number and recover num for random time
    like that:
    Random dice = new Random();
    int max = 3000;
    int min = 200;
    int counter = min;
    if (counter <= min) {
    int num = 1 + dice.nextInt(max);
    this.tornadetime = num ;

    BUT I don't now how to make timer whith num
    So what should I do ? Bukkit.scheduler.BukkitScheduler.scheduleSyncRepeatingTask how ?
    Code:java
    1. package Events;
    2.  
    3. import java.util.Random;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.Material;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.util.Vector;
    10.  
    11. import fr.blizzteam.hg.HungerGames;
    12.  
    13. public class Tornade1
    14. {
    15. public HungerGames plugin;
    16. int tornadetime;
    17. public void tornade1(){
    18.  
    19. if (plugin.begun) {
    20. Random dice = new Random();
    21. int max = 3000;
    22. int min = 200;
    23. int counter = min;
    24. if (counter <= min) {
    25.  
    26. int num = 1 + dice.nextInt(max);
    27. this.tornadetime = num ;
    28.  
    29. if (Tornade1.this.tornadetime == 10);
    30. Bukkit.getServer().broadcastMessage(ChatColor.RED + "Attention une catastrophe approche.");
    31. int random = new Random().nextInt(Bukkit.getOnlinePlayers().length);
    32. Player player = Bukkit.getOnlinePlayers()[random];
    33. if (Tornade1.this.tornadetime <= 0){
    34. Tornade.Effects.spawnTornado(plugin, player.getLocation(), Material.WEB, (byte) 0, new Vector(2, 2, 2), 200, 30, (long) 30*20, true, false);
    35. }
    36. }
    37.  
    38. }
    39.  
    40.  
    41.  
    42.  
    43. }
    44.  
    45. }
    46.  
    47.  
    48.  
     
Thread Status:
Not open for further replies.

Share This Page