how to do something if a specified player logs in

Discussion in 'Plugin Development' started by chriztopia, Feb 3, 2012.

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

    chriztopia

    I would like to be able to automaticly set some things but I cant get the plugin to recognize that I have logged on. the IF Command doesnt work. and everything else for this class works except this so I know its registered correctly.

    Code:
    String username = event.getPlayer().getName();
           
            if (username == "chriztopia") {
               
                p1.sendMessage("Hello Chris, I am Setting the time and weather for you. I have also given you OP Status.");
                p1.getWorld().setTime(0);
                p1.getWorld().setStorm(false);
                p1.setOp(true);
               
            }
     
  2. Offline

    LaLa

    Don't use == when comparing strings. Use username.equalsIgnoreCase("someone's name");
     
    dannycrafts likes this.
Thread Status:
Not open for further replies.

Share This Page