Class PlayerSetSpawnEvent


public class PlayerSetSpawnEvent extends PlayerEvent
This event is fired when a player's spawn point is set or reset.
The event can be canceled, which will prevent the spawn point from being changed.
  • Field Details

    • spawnLevel

      private final ResourceKey<Level> spawnLevel
    • forced

      private final boolean forced
    • newSpawn

      @Nullable private final @Nullable BlockPos newSpawn
  • Constructor Details

    • PlayerSetSpawnEvent

      public PlayerSetSpawnEvent(Player player, ResourceKey<Level> spawnLevel, @Nullable @Nullable BlockPos newSpawn, boolean forced)
  • Method Details

    • isForced

      public boolean isForced()
    • getNewSpawn

      @Nullable public @Nullable BlockPos getNewSpawn()
      The new spawn position, or null if the spawn position is being reset.
    • getSpawnLevel

      public ResourceKey<Level> getSpawnLevel()