How set spawnpoint for player

Discussion in 'Plugin Development' started by LIMPIX31, Jul 14, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    LIMPIX31

    I want to set the player's spawn point at a random location when the player entered the server. I did not find the required method in the Player class.
     
  2. Offline

    KarimAKL

  3. Offline

    LIMPIX31

  4. Offline

    KarimAKL

    @LIMPIX31 Then listen to the PlayerSpawnLocationEvent, just like I mentioned in my previous post.
     
  5. Offline

    LIMPIX31

    But I don't want to listen to other events. How what you said will look like in the code.
     
  6. Offline

    KarimAKL

    @LIMPIX31 Why do you not want to listen to other events?
     
  7. Offline

    LIMPIX31

    Because I want to set the spawn point in random places when the player enters, if he entered for the first time, I am not interested in other events.
     
  8. Offline

    KarimAKL

    @LIMPIX31 But the PlayerSpawnLocationEvent is called when the player joins the server, so you can check if it is the first time they join using OfflinePlayer#hasPlayedBefore(). Listening to multiple events should not be a concern.
     
Thread Status:
Not open for further replies.

Share This Page