Disable join message (null = warning)

Discussion in 'Spigot Plugin Development' started by Iwitrag, Jul 7, 2019.

Thread Status:
Not open for further replies.
  1. This may sound trivial but it confuses me.

    I know how to disable join message...

    Code (Text):
    But when I use null it shows warning


    So I have tried empty string

    Code (Text):
    But then it shows blank line when someone joins the server.

    What is the proper way to disable those messages WITHOUT WARNING?
  2. that's only a warning of intellij, if you do e.setJoinMessage(null); it works without errors
  3. That's warning of IntelliJ IDEA, which was invoked because parameter is annotated by @NotNull - so null should not be used as parameter.

    See Bukkit API:

  4. Just try setting it to null and test it.
  5. People, I know that setting to null disables it completely! Learn to read please!

    I'm wondering what is the "correct" way to disable it completely as joinMessage is annotated with @NotNull !
  6. I don't think there's another way that's recommended or anything like that.
  7. A few months ago, the Bukkit API got @Nullable and @NotNull annotations added (see this commit).
    However, since PlayerList#onPlayerJoin still checks if joinMessage isn't null and is longer than zero characters, both null and "" disable the join message.

    Functionally it doesn't make a difference which one you use (both do the same thing), but it's probably better to obey the @NotNull annotation and use "".
  8. MiniDigger


    seems like an invalid annotation, open a bug report on jira.
    • Agree Agree x 2
  9. Code (Java):
    "Your post is too tiny"
  10. Not true, I have just tried it, empty string leaves empty message in chat (newline added), whereas null completely removes join messages.

    Same as above, try it yourself, it generates empty line in chat.

    No way.
    • Funny Funny x 1
  11. I can't reproduce that (using spigot for mc 1.8.8 and 1.12.2). Both null and "" as the join message result in no message being broadcasted (no new line, just nothing).
    What version are you using? I looked through the source of spigot 1.7 to 1.14 - even craftbukkit 1.2 (from 2012) - and all had the same check (line 134):
    Code (Java):
    if (joinMessage != null && joinMessage.length() > 0) {
    And only if that if statement is true, any message (normal join message, new line or whatever you set the join message to be) is being broadcasted - otherwise: nothing happens.
    Unless I'm missing something: both empty string and null remove the join messages completely.
  12. That's weird, I'm using 1.14.3 and empty line is shown.

    Is it possible that Essentials or Authme mess with it somehow?
  13. Strahan


    Probably. Instead of asking, just go disable them and test, much quicker way to get the answer. I use Essentials and when I set the join msg to "" I get no empty line.

    Seriously? You find it so hard to follow the bug report instructions that you just say fuck it all then? Heh.
  14. I'm sure he's not the only one :x

    jira link btw
  15. Exactly. Why should I bother ? For the chance to be banned if I do something wrong? No tanks. Anyone else can report it though.
    • Funny Funny x 2
  16. Code (Java):
      public void onJoin(PlayerJoinEvent e)
    Just like this, have a nice day, if black message, send your version
  17. The wrong way that may get you banned would be not using the JIRA issue tracker.
  18. Choco


    • Winner Winner x 2
    • Like Like x 1
    • Useful Useful x 1
Thread Status:
Not open for further replies.