Chat Messages (Help)

Discussion in 'Plugin Development' started by RazorFlint, Jul 24, 2012.

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

    RazorFlint

    Hi, I haven't coded in about a year now and I'm pretty dumbfounded why this doesn't work, could someone help me out?
    http://pastebin.com/YVdrrBwH

    Thanks :D
     
  2. Offline

    rjVapes

    Your event handling is just setup incorrectly.
    Code:
    import org.bukkit.plugin.java.JavaPlugin;
    
    import org.bukkit.event.Listener;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerLoginEvent;
     
    public class LoginPlugin extends JavaPlugin implements Listener {
    
    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    }
     
    @EventHandler
    public void normalLogin(PlayerLoginEvent event) {
    // Some code here
    }
    }
    
     
  3. Offline

    chaseoes

  4. Offline

    RazorFlint

    Thank you! And much appreciated!

    chaseoes Another thing, why won't this and operator work in this if statement?

    if(lc.contains("who") && ("is")){
    //some code here
    }

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  5. Offline

    WarmakerT

    lc.contains("who") returns true or false, while ("is") isn't a statement. You need to use lc.contains("is")

    Statement && Statement
     
  6. Offline

    lololmaker

    Does that even work ?

    Maybe like this:
    if(lc.contains("who") && lc.contains("is")){
    //some code here
    }
     
  7. Offline

    RazorFlint

    Yes, I'm a bit of an idiot to forget about that, thanks WarmakerT :)
     
  8. Offline

    WarmakerT

    No problem =)
     
Thread Status:
Not open for further replies.

Share This Page