5 second countdown timer to target player

Discussion in 'Plugin Development' started by coolmonkeyguy, May 31, 2013.

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

    coolmonkeyguy

    I am making a plugin and when i went to test it it displayed it all at once but what i want is to display each line 1 second later. please respond!
    What it does when i type /bbsword is it displays all the count messages all at once instead of counting from 5 to 1 in 5 seconds, which i want.

    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args) {
       
          if (CommandLabel.equalsIgnoreCase("bbsword")) {
              }
                  if(args.length == 1) {
                        Player player = (Player) sender;
                        if(player.hasPermission("BBJailGuard.sword")){
                      Player targetPlayer = player.getServer().getPlayer(args[0]);
                    player.sendMessage(ChatColor.GREEN + "Message sent to" + " " + ChatColor.GRAY + targetPlayer);
                      targetPlayer.sendMessage(ChatColor.RED + "[BBJailGuard]"+ " " +  ChatColor.GOLD + "Please Give your Sword to " + player + ChatColor.GOLD + "You have 5 Seconds or Jail");
                      targetPlayer.sendMessage(ChatColor.RED + "[BBJailGuard]"+ " " + ChatColor.GOLD + " 5... " );
                      targetPlayer.sendMessage(" ");
                      targetPlayer.sendMessage(ChatColor.RED + "[BBJailGuard]"+ " " + ChatColor.GOLD + " 4... " );
                      targetPlayer.sendMessage(" ");
                      targetPlayer.sendMessage(ChatColor.RED + "[BBJailGuard]"+ " " + ChatColor.GOLD + " 3... " );
                      targetPlayer.sendMessage(" ");
                      targetPlayer.sendMessage(ChatColor.RED + "[BBJailGuard]"+ " " + ChatColor.GOLD + " 2... " );
                      targetPlayer.sendMessage(" ");
                      targetPlayer.sendMessage(ChatColor.RED + "[BBJailGuard]"+ " " + ChatColor.GOLD + " 1... " );
                   
                      player.sendMessage(ChatColor.GREEN + "Count down finished");
                   
                        }
     
Thread Status:
Not open for further replies.

Share This Page