Class RespawnLocation

java.lang.Object
org.bukkit.Location
org.mvplugins.multiverse.inventories.util.RespawnLocation
All Implemented Interfaces:
io.papermc.paper.math.FinePosition, io.papermc.paper.math.Position, Cloneable, org.bukkit.configuration.serialization.ConfigurationSerializable

@AvailableSince("5.2") public class RespawnLocation extends org.bukkit.Location
Location information with respawn type. See also RespawnLocation.RespawnLocationType.
TODO: This should extend UnloadedWorldLocation, but that class is currently a final class!!!
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The type of respawn location.
  • Field Summary

    Fields inherited from interface io.papermc.paper.math.Position

    BLOCK_ZERO, FINE_ZERO
  • Constructor Summary

    Constructors
    Constructor
    Description
    RespawnLocation(String worldName, double x, double y, double z, float yaw, float pitch, RespawnLocation.RespawnLocationType respawnType)
     
    RespawnLocation(String worldName, double x, double y, double z, RespawnLocation.RespawnLocationType respawnType)
     
    RespawnLocation(org.bukkit.Location location, RespawnLocation.RespawnLocationType respawnType)
     
    RespawnLocation(org.bukkit.World world, double x, double y, double z, float yaw, float pitch, RespawnLocation.RespawnLocationType respawnType)
     
    RespawnLocation(org.bukkit.World world, double x, double y, double z, RespawnLocation.RespawnLocationType respawnType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.Location
    Required method for deserialization
    boolean
     
    Gets the respawn location type.
    org.bukkit.World
     
     
    int
     
    boolean
    Checks if the respawn location is valid based on the respawn type.
     
    void
    Sets the respawn location type.
    void
    setWorld(org.bukkit.World world)
     
    void
    setWorldName(String worldName)
     
    org.bukkit.Location
    Makes a bukkit Location copy from this SpawnLocation.
     

    Methods inherited from class org.bukkit.Location

    add, add, add, add, addRotation, addRotation, checkFinite, clone, createExplosion, createExplosion, createExplosion, createExplosion, createExplosion, createExplosion, distance, distanceSquared, getBlock, getBlockX, getBlockY, getBlockZ, getChunk, getDirection, getNearbyEntities, getNearbyEntitiesByType, getNearbyEntitiesByType, getNearbyEntitiesByType, getNearbyEntitiesByType, getNearbyEntitiesByType, getNearbyEntitiesByType, getNearbyLivingEntities, getNearbyLivingEntities, getNearbyLivingEntities, getNearbyLivingEntities, getNearbyLivingEntities, getNearbyLivingEntities, getNearbyPlayers, getNearbyPlayers, getNearbyPlayers, getNearbyPlayers, getNearbyPlayers, getNearbyPlayers, getPitch, getRotation, getX, getY, getYaw, getZ, isChunkLoaded, isFinite, isGenerated, isWorldLoaded, length, lengthSquared, locToBlock, multiply, normalizePitch, normalizeYaw, set, setDirection, setPitch, setRotation, setRotation, setX, setY, setYaw, setZ, subtract, subtract, subtract, subtract, subtractRotation, subtractRotation, toBlockKey, toBlockLocation, toCenterLocation, toHighestLocation, toHighestLocation, toLocation, toVector, x, y, z, zero

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.papermc.paper.math.FinePosition

    blockX, blockY, blockZ, isBlock, isFine, offset, offset, toBlock

    Methods inherited from interface io.papermc.paper.math.Position

    toCenter
  • Constructor Details

  • Method Details

    • toBukkitLocation

      public org.bukkit.Location toBukkitLocation()
      Makes a bukkit Location copy from this SpawnLocation.
      Returns:
      The bukkit location
    • setWorldName

      public void setWorldName(@Nullable String worldName)
    • getWorldName

      @Nullable public String getWorldName()
    • setWorld

      public void setWorld(@Nullable org.bukkit.World world)
      Overrides:
      setWorld in class org.bukkit.Location
    • getWorld

      @Nullable public org.bukkit.World getWorld()
      Overrides:
      getWorld in class org.bukkit.Location
    • serialize

      @NotNull public Map<String,Object> serialize()
      Specified by:
      serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializable
      Overrides:
      serialize in class org.bukkit.Location
    • deserialize

      @NotNull public static org.bukkit.Location deserialize(@NotNull Map<String,Object> args)
      Required method for deserialization
      Parameters:
      args - map to deserialize
      Returns:
      deserialized location
      Throws:
      IllegalArgumentException - if the world don't exists
      See Also:
      • ConfigurationSerializable
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class org.bukkit.Location
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.bukkit.Location
    • toString

      public String toString()
      Overrides:
      toString in class org.bukkit.Location
    • isValidRespawnLocation

      @AvailableSince("5.2") public boolean isValidRespawnLocation()
      Checks if the respawn location is valid based on the respawn type.
      For RespawnLocation.RespawnLocationType.BED, checks if the block at the location is a bed block.
      For RespawnLocation.RespawnLocationType.ANCHOR, checks if the block at the location is a respawn anchor block.
      Returns:
      true if the respawn location is valid, false otherwise.
    • getRespawnType

      @AvailableSince("5.2") @NotNull public RespawnLocation.RespawnLocationType getRespawnType()
      Gets the respawn location type.
      Returns:
      the respawn location type
    • setRespawnType

      @AvailableSince("5.2") public void setRespawnType(@NotNull RespawnLocation.RespawnLocationType respawnType)
      Sets the respawn location type.
      Parameters:
      respawnType - the respawn location type