Solved amount not working correctly

Discussion in 'Spigot Plugin Development' started by Ean244, May 31, 2017.

  1. I'm making a gui and i have a double value which is amount of money.the default value of it is 50;
    on clicking a green block it will add 50
    on clicking a red block it will minus 50
    the code is here:
    Code (Text):
    @EventHandler
        public void onInventoryClick(InventoryClickEvent event) {
                  double amount = 50;
                 if(i.equals("greenblock")) {//     <--  an example
                         amount = amount + 50;
                }
               
               if(i.equals("redblock")) {//     <--  an example
                         amount = amount - 50;
                }
     
    something like that , i tested it out,
    1) I click the green button first(amount became 100, which is correct)
    2)I clicked the red button(Ammount became 0, idk why, it should be 50)
    3) Clicked green again, became 100??
    4) Clicked red became 0!!

    i know what i say is a bit confusing, but i hope someone could help
     
  2. why cant amount change??
     
  3. Sry solved, silly me