Join Message

Discussion in 'Plugin Development' started by Ollywood, Aug 2, 2014.

Thread Status:
Not open for further replies.
  1. Hey,
    Im developing join message plugin but I cant get the message to work. When I join my server, the join message is still the normal 'ollirules joined the game' and i want it to say '{+} ollirules joined' which is set in the config.
    Please help. Here is the code:

    Code:java
    1. @EventHandler
    2. public void PlayerJoin(PlayerJoinEvent e) {
    3. Player p = e.getPlayer();
    4. String joinMessageSet = getConfig().getString("message").replaceAll("PLAYERNAME", p.getName());
    5. e.setJoinMessage(joinMessageSet);
    6.  
    7. }
    8.  
    9. @EventHandler
    10. public void PlayerLeave(PlayerQuitEvent e) {
    11. Player p = e.getPlayer();
    12. String leaveMessage = getConfig().getString("leaveMessage").replaceAll("PLAYERNAME", p.getName());
    13. e.setQuitMessage(leaveMessage);
    14. }
     
  2. Offline

    TeeePeee

    Did you register the events?
     
  3. Offline

    mactown21

    Ollywood Theres a few things that you need to check for.

    Your Config is registered, Implemented Listener, Registered events, Make sure your yaml is using correct spacing, Not Tabs.
     
    jthort likes this.
  4. Thank you. Ive solved it. I was very dumb and forgot to implement listener. Thanks mactown21

    Unfortunately, It still does not work. In fact nothing in the events work. I tried sending a message to the player but it wouldn't even do that. Please Help mactown21 TeeePeee

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

    BaranCODE

    Because you had forgotten to implement Listener before, I believe you've probably forgotten to register your events as well (if you tried to register them without implementing Listener, it would have given an error). So now, register the events in your onEnable.
     
  6. BaranCODE Thank you. Works perfectly now!!
     
Thread Status:
Not open for further replies.

Share This Page