Skip to content
Advertisement

Is there a client-side version of onPlayerJoin?

Title says it all, I just wanna detect when a player joins a server client-side, and also how would I send a message to the client, not through the server? (the mod is supposed to send a message when the player joins and play a sound when you are not moving on a server like hypixel where it wont have the mod) weird mod, I know (Also this is done in 1.8, if that matters much)

Advertisement

Answer

Two choices, both with some downsides:

  1. ClientConnectedToServerEvent, although it fires on a different thread than usual, and may fire slightly earlier than you want
  2. EntityJoinWorldEvent, although it fires in a lot of other cases too, so you’d have to do some additional checks to make sure it’s actually the player joining that triggered it
Advertisement