简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM