Solved Help

Discussion in 'Plugin Development' started by Wantsome909, Dec 27, 2013.

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

    Wantsome909

    Hello i am trying to make a tokens plugin and i'm making great success. But i need help
    i made a player death event and i'm adding 1 token to every kill someone gets but it just put 1 and doesn't add or go up like 1+1 = 2+1 =3 and so on

    here code:
    Code:java
    1. @EventHandler
    2. public void onPlayerDeath(PlayerDeathEvent e){
    3. Player p = e.getEntity().getKiller();
    4. if(e.getEntity().getKiller() instanceof Player){
    5. tokenss.put(p.getName(), +1);
    6. p.sendMessage("You gain 1 token!");
    7. }
    8. }
     
  2. Offline

    xTigerRebornx

    Wantsome909 You are just setting it to "+1", not, "previous value +1". You need to get the ammount of tokens they have before you add some to it
     
  3. Offline

    Wantsome909

    xTigerRebornx oh thanks you i thought that all you have to do. it works thank you :)
     
Thread Status:
Not open for further replies.

Share This Page