Solved Public int again

Discussion in 'Plugin Development' started by NoSpanMan, Apr 5, 2015.

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

    NoSpanMan

    I have:
    Code:
     if ((args[0].equalsIgnoreCase("ready")) && (
          (p.hasPermission("test.test")) || (p.isOp())))
             {
      if (inlobby.contains(p.getName())) {
             p.sendMessage(ChatColor.BLUE + "You are ready!");
             ready++;
    
    but i can typ this 1000 times and the public int stays counting i want that you can typ 1 time it because now everyone can typ it 100 times and the int is then counting.

    I fixed it with a hashmap but when i typ it the secondary time he says you are not in a lobby but i want he says you can't typ ready 2 times:

    Code:
     if ((args[0].equalsIgnoreCase("ready")) && (
          (p.hasPermission("test.ready")) || (p.isOp())))
             {
         if (!readytyped.contains(p.getName())) {
      if (inlobby.contains(p.getName())) {
             p.sendMessage(fk + "You are ready!");
             ready++;
             readytyped.add(p.getName());
             if (ready >= 2) {
                 p.sendMessage(fk + "All the players are ready");
             }
             return true;
      }else {
         p.sendMessage("You can't typ 2 times ready");          <---i want that he says the secondary time i typed /ready 
      }
         }else {
           p.sendMessage("You are not in a lobby!");               <------ but he says this
           }
          } else {
             p.sendMessage(fk + "You dont have permissions to do this!");
             }
             }
       return false;
       }
    }
    
     
    Last edited by a moderator: Apr 5, 2015
Thread Status:
Not open for further replies.

Share This Page