Solved Integer going up by 2 instead of 1

Discussion in 'Plugin Development' started by DoctorDark, Feb 18, 2014.

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

    DoctorDark

    So whenever someone successfully hits a person from an arrow shot with their bow; I need to set the integer of a "Arrows Hit" value +1, however the integer adds 2 every time.

    I removed the event to make sure no other events were modifying the integer and it was going up by 0, meaning this is the only event changing the integer value;

    Here's the code I am using currently;
    Code:java
    1. @EventHandler
    2. public void onDamage(EntityDamageByEntityEvent e) {
    3.  
    4. if (e.getEntity() instanceof Player) {
    5.  
    6. if (e.getEntity() instanceof Player) {
    7. Arrow a = (Arrow) e.getDamager();
    8. if (a.getShooter() instanceof Player) {
    9. Player shooter = (Player) a.getShooter();
    10. Main.stnmgr.getArrowsHitData().set(shooter.getName(), Main.stnmgr.getArrowsHitData().getInt(shooter.getName()) + 1);
    11. Main.stnmgr.saveArrowsHitData();
    12. }
    13. }
    14.  
    15. }
    16.  
    17. }


    And how I'm grabbing the integer;
    Code:
    Main.stnmgr.getArcherArrowData().getInt(p.getName());
    Any help is appreciated.

    Thanks
     
  2. Offline

    superguy9

    May we see the rest of your code that had anything todo with this chunk?
     
  3. Offline

    MrInspector

    err he already marked this as solved. :p
     
  4. Offline

    superguy9

    They must've done that after I asked, because it didn't say that when I posted it. :)
     
  5. Offline

    MrInspector

    I've seen it since a few days ago.. since I was about to post on here. But what ever. :p

    I really dunno.
     
  6. Offline

    DoctorDark

    Just to clarify, it is solved, yes. Thanks anyway.
     
Thread Status:
Not open for further replies.

Share This Page