java - Why doesn't this work - JOptionPane - Reading Integer Value -


so i'm working on project , want implement commands such "/heal value" when debug code prints input in console not effect given? doing correctly?

here full class

import javax.swing.joptionpane;  public class commands {   //variables   string command; //the variable controls each command   int[] blockname; //each block int[]   string number; //the block stack amount number - need worry /heal   string amount; //the amount of health want give player   public static boolean open = false; //detects whether command window open    public commands() {   }    public void tick() {     if(open) {       //create joptionpane can enter command       command = joptionpane.showinputdialog("please enter command");       //should check see if command matchs of commands       loadcommands();       //prints command input       if(command != "" || command != null) {          system.out.println(component.username + ": " + command + " called");       }       //then sets open false joptionpane. dont need worry       open = false;     }   }    public void loadcommands() {     //this list of commands     try {       //this /give command       if(command.equals("/give " + blockname + " " + number)) {         component.inventory.holdingid = blockname;         component.inventory.holdingidstack = integer.parseint(number);         system.out.println(command);       }        //this /heal command using debug       if(command.equals("/heal " + amount)) {         component.character.health += integer.parseint(amount);         system.out.println(command);       }       //this the/kill command kill play not work?       if(command.equals("/kill ")) {         component.character.hurt(999);         system.out.println(command);       }     } catch(nullpointerexception e) {        /*this here because without nullpointerexception appears in console , joptionpane can't closed */     }   }  /* how know doesn't work because doesnt print out command twice  * meant to...  */  } 


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -