Solved Is this code all right?

Discussion in 'Spigot Plugin Development' started by Bruce0203, Oct 6, 2019.

  1. Code (Java):
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        if (player.hasPlayedBefore())
            event.setJoinMessage(player.getDisplayName()+" joined the game first");
        else
            event.setJoinMessage(player.getDisplayName()+" joined the game");
    }
     
  2. 1) You should use the correct forum Spigot Plugin Development
    2) You should put code in a code block to make it readable
    3) Have you tested? If you didn't test it, I'm not really sure what the point of this thread is?!?! Rather than creating a thread to have someone check over your code, test it on a test server first, and then ask questions if you have an issue, not create a thread to verify if your code is correct.
     
  3. Okey I thought about that. I got it thanks
     
  4. Choco

    Moderator

    Thread moved.

    Edited

    Agreed. Though @OP, yes, your code should work fine assuming your listeners are registered.
     
    • Friendly Friendly x 1