HashMap issue

Discussion in 'Spigot Plugin Development' started by XZot1K, May 4, 2015.

  1. Hey so im making a cooldown for lets say 5 tnt before it puts they player in cooldown how can I add to the player ina hash map with this

    Code (Text):
    public HashMap<String, Integer> tnttag = new HashMap<String, Integer>();

    if (tnttag.containsKey(player.getName()) && tnttag.containsValue(plugin.usetnt)) {

                    tntcd.put(player.getName(),
                            Long.valueOf(System.currentTimeMillis()));

                }else{
                   
                    int tnttagint = 0;
                   
                    tnttag.put(player.getName(), tnttagint++);
                   
                }
    I need to make tnttagint not go up so that another player doesn't do it and the value starts at 1
    the value of tnttagint needs to addup and if the int along with playername = the amount (5) then add them to the cooldown (I can't get the tnttag to add to the value how can i)
     
  2. get it, then add 1
     
    • Like Like x 1
  3. got it thanks man :)