Class PS
java.lang.Object
com.kamikazejam.kamicommon.util.teleport.ps.PS
- All Implemented Interfaces:
Serializable
,Comparable<PS>
# Introduction
PS stands for PhysicalState.
This class stores data related to just that.
When coding plugins you may find yourself wanting to store a player location.
Another time you may want to store the player location but without the worldName info.
Another time you may want to store pitch and yaw only.
This class is supposed to be usable in all those cases.
Hopefully this class will save you from implementing special classes for all those combinations.
# Field Groups velocity: velocityX, velocityY, velocityZ blockCoords: blockX, blockY, blockZ locationCoords: locationX, locationY, locationZ chunkCoords: chunkX, chunkZ head: pitch, yaw block: world, blockX, blockY, blockZ location: world, locationX, locationY, locationZ, pitch, yaw chunk: world, chunkX, chunkZ entity: world, locationX, locationY, locationZ, pitch, yaw, velocityX, velocityY, velocityZ
# Field Groups velocity: velocityX, velocityY, velocityZ blockCoords: blockX, blockY, blockZ locationCoords: locationX, locationY, locationZ chunkCoords: chunkX, chunkZ head: pitch, yaw block: world, blockX, blockY, blockZ location: world, locationX, locationY, locationZ, pitch, yaw chunk: world, chunkX, chunkZ entity: world, locationX, locationY, locationZ, pitch, yaw, velocityX, velocityY, velocityZ
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
static final float
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final PS
static final String
-
Method Summary
Modifier and TypeMethodDescription@NotNull Block
@NotNull Block
asBukkitBlock
(boolean calc) static @NotNull Block
asBukkitBlock
(@NotNull PS ps) @NotNull Chunk
@NotNull Chunk
asBukkitChunk
(boolean calc) static @NotNull Chunk
asBukkitChunk
(@NotNull PS ps) @NotNull Location
@NotNull Location
asBukkitLocation
(boolean calc) static @NotNull Location
asBukkitLocation
(@NotNull PS ps) @NotNull Vector
@NotNull Vector
asBukkitVelocity
(boolean calc) static @NotNull Vector
asBukkitVelocity
(@NotNull PS ps) @NotNull World
@NotNull World
asBukkitWorld
(boolean calc) static @NotNull World
asBukkitWorld
(String world) @NotNull PSBuilder
builder()
static Integer
calcBlockCoord
(Double location, Integer block, Integer chunk) static Integer
calcChunkCoord
(Double location, Integer block, Integer chunk) int
static int
calcHashCode
(@NotNull PS ps) static Double
calcLocationCoord
(Double location, Integer block, Integer chunk) static Float
static Double
calcVelocityCoord
(Double location, Integer block, Integer chunk, Double velocity) static String
calcWorldName
(World world) static Float
int
boolean
getBlock()
getBlock
(boolean calc) static Integer
getBlockCoord
(boolean calc, Double location, Integer block, Integer chunk) getBlockCoords
(boolean calc) getBlockX
(boolean calc) getBlockY
(boolean calc) getBlockZ
(boolean calc) getChunk()
getChunk
(boolean calc) static Integer
getChunkCoord
(boolean calc, Double location, Integer block, Integer chunk) getChunkCoords
(boolean calc) getChunkX
(boolean calc) getChunkZ
(boolean calc) getDistinctChunks
(@NotNull Collection<PS> pss) getDistinctWorlds
(@NotNull Collection<PS> pss) getEntity
(boolean calc) getHead()
getHead
(boolean calc) getLocation
(boolean calc) static Double
getLocationCoord
(boolean calc, Double location, Integer block, Integer chunk) getLocationCoords
(boolean calc) getLocationX
(boolean calc) getLocationY
(boolean calc) getLocationZ
(boolean calc) getPitch
(boolean calc) static Float
getRegionX
(boolean calc) getRegionZ
(boolean calc) getVelocity
(boolean calc) static Double
getVelocityCoord
(boolean calc, Double location, Integer block, Integer chunk, Double velocity) getVelocityX
(boolean calc) getVelocityY
(boolean calc) getVelocityZ
(boolean calc) getWorld
(boolean calc) getYaw
(boolean calc) static Float
int
hashCode()
static boolean
inSameWorld
(PS one, PS two) static @Nullable Double
locationDistance
(PS one, PS two) static Double
locationDistanceSquared
(PS one, PS two) plusChunkCoords
(int chunkX, int chunkZ) static Double
throwIfStrange
(Double d, String name) static Float
throwIfStrange
(Float f, String name) toString()
static String
static Double
trimEntityVelocityY
(Double velocityY) static @NotNull PS
valueOf
(int chunkX, int chunkZ) static PS
valueOf
(com.google.gson.JsonElement jsonElement) static @NotNull PS
static @NotNull PS
valueOf
(String world, Integer blockX, Integer blockY, Integer blockZ, Double locationX, Double locationY, Double locationZ, Integer chunkX, Integer chunkZ, Float pitch, Float yaw, Double velocityX, Double velocityY, Double velocityZ) static PS
static PS
static PS
static PS
static PS
@NotNull PS
withBlockX
(Integer blockX) @NotNull PS
withBlockY
(Integer blockY) @NotNull PS
withBlockZ
(Integer blockZ) @NotNull PS
withChunkX
(Integer chunkX) @NotNull PS
withChunkZ
(Integer chunkZ) @NotNull PS
withLocationX
(Double locationX) @NotNull PS
withLocationY
(Double locationY) @NotNull PS
withLocationZ
(Double locationZ) @NotNull PS
@NotNull PS
withVelocityX
(Double velocityX) @NotNull PS
withVelocityY
(Double velocityY) @NotNull PS
withVelocityZ
(Double velocityZ) @NotNull PS
@NotNull PS
-
Field Details
-
DEFAULT_BUKKIT_PITCH
public static final float DEFAULT_BUKKIT_PITCH- See Also:
-
DEFAULT_BUKKIT_YAW
public static final float DEFAULT_BUKKIT_YAW- See Also:
-
NAME_SERIALIZED_WORLD
- See Also:
-
NAME_SERIALIZED_BLOCKX
- See Also:
-
NAME_SERIALIZED_BLOCKY
- See Also:
-
NAME_SERIALIZED_BLOCKZ
- See Also:
-
NAME_SERIALIZED_LOCATIONX
- See Also:
-
NAME_SERIALIZED_LOCATIONY
- See Also:
-
NAME_SERIALIZED_LOCATIONZ
- See Also:
-
NAME_SERIALIZED_CHUNKX
- See Also:
-
NAME_SERIALIZED_CHUNKZ
- See Also:
-
NAME_SERIALIZED_PITCH
- See Also:
-
NAME_SERIALIZED_YAW
- See Also:
-
NAME_SERIALIZED_VELOCITYX
- See Also:
-
NAME_SERIALIZED_VELOCITYY
- See Also:
-
NAME_SERIALIZED_VELOCITYZ
- See Also:
-
NAME_FULL_WORLD
- See Also:
-
NAME_FULL_BLOCKX
- See Also:
-
NAME_FULL_BLOCKY
- See Also:
-
NAME_FULL_BLOCKZ
- See Also:
-
NAME_FULL_LOCATIONX
- See Also:
-
NAME_FULL_LOCATIONY
- See Also:
-
NAME_FULL_LOCATIONZ
- See Also:
-
NAME_FULL_CHUNKX
- See Also:
-
NAME_FULL_CHUNKZ
- See Also:
-
NAME_FULL_PITCH
- See Also:
-
NAME_FULL_YAW
- See Also:
-
NAME_FULL_VELOCITYX
- See Also:
-
NAME_FULL_VELOCITYY
- See Also:
-
NAME_FULL_VELOCITYZ
- See Also:
-
NAME_VERBOSE_WORLD
- See Also:
-
NAME_VERBOSE_BLOCKX
- See Also:
-
NAME_VERBOSE_BLOCKY
- See Also:
-
NAME_VERBOSE_BLOCKZ
- See Also:
-
NAME_VERBOSE_LOCATIONX
- See Also:
-
NAME_VERBOSE_LOCATIONY
- See Also:
-
NAME_VERBOSE_LOCATIONZ
- See Also:
-
NAME_VERBOSE_CHUNKX
- See Also:
-
NAME_VERBOSE_CHUNKZ
- See Also:
-
NAME_VERBOSE_PITCH
- See Also:
-
NAME_VERBOSE_YAW
- See Also:
-
NAME_VERBOSE_VELOCITYX
- See Also:
-
NAME_VERBOSE_VELOCITYY
- See Also:
-
NAME_VERBOSE_VELOCITYZ
- See Also:
-
NAME_VERBOOSE_WORLD
Deprecated.- See Also:
-
NAME_VERBOOSE_BLOCKX
Deprecated.- See Also:
-
NAME_VERBOOSE_BLOCKY
Deprecated.- See Also:
-
NAME_VERBOOSE_BLOCKZ
Deprecated.- See Also:
-
NAME_VERBOOSE_LOCATIONX
Deprecated.- See Also:
-
NAME_VERBOOSE_LOCATIONY
Deprecated.- See Also:
-
NAME_VERBOOSE_LOCATIONZ
Deprecated.- See Also:
-
NAME_VERBOOSE_CHUNKX
Deprecated.- See Also:
-
NAME_VERBOOSE_CHUNKZ
Deprecated.- See Also:
-
NAME_VERBOOSE_PITCH
Deprecated.- See Also:
-
NAME_VERBOOSE_YAW
Deprecated.- See Also:
-
NAME_VERBOOSE_VELOCITYX
Deprecated.- See Also:
-
NAME_VERBOOSE_VELOCITYY
Deprecated.- See Also:
-
NAME_VERBOOSE_VELOCITYZ
Deprecated.- See Also:
-
SPACE_WASNT_SET
- See Also:
-
NULL
-
-
Method Details
-
getRegionX
-
getRegionZ
-
withWorld
-
withBlockX
-
withBlockY
-
withBlockZ
-
withLocationX
-
withLocationY
-
withLocationZ
-
withChunkX
-
withChunkZ
-
withPitch
-
withYaw
-
withVelocityX
-
withVelocityY
-
withVelocityZ
-
with
-
plusChunkCoords
-
throwIfStrange
-
throwIfStrange
-
builder
-
valueOf
@Contract("_, _, _, _, _, _, _, _, _, _, _, _, _, _ -> new") @NotNull public static @NotNull PS valueOf(String world, Integer blockX, Integer blockY, Integer blockZ, Double locationX, Double locationY, Double locationZ, Integer chunkX, Integer chunkZ, Float pitch, Float yaw, Double velocityX, Double velocityY, Double velocityZ) -
valueOf
-
valueOf
-
valueOf
-
valueOf
-
valueOf
-
valueOf
-
valueOf
-
valueOf
-
getWorld
-
getBlockX
-
getBlockY
-
getBlockZ
-
getLocationX
-
getLocationY
-
getLocationZ
-
getChunkX
-
getChunkZ
-
getRegionX
-
getRegionZ
-
getPitch
-
getYaw
-
getVelocityX
-
getVelocityY
-
getVelocityZ
-
getBlockCoord
-
getLocationCoord
-
getChunkCoord
-
getPitch
-
getYaw
-
getVelocityCoord
-
calcBlockCoord
-
calcLocationCoord
-
calcChunkCoord
-
calcPitch
-
calcYaw
-
calcVelocityCoord
-
getVelocity
-
getVelocity
-
getBlockCoords
-
getBlockCoords
-
getLocationCoords
-
getLocationCoords
-
getChunkCoords
-
getChunkCoords
-
getHead
-
getHead
-
getBlock
-
getBlock
-
getLocation
-
getLocation
-
getChunk
-
getChunk
-
getEntity
-
getEntity
-
asBukkitWorld
- Throws:
IllegalStateException
-
asBukkitWorld
- Throws:
IllegalStateException
-
asBukkitBlock
- Throws:
IllegalStateException
-
asBukkitBlock
- Throws:
IllegalStateException
-
asBukkitLocation
@Contract(" -> new") @NotNull public @NotNull Location asBukkitLocation() throws IllegalStateException- Throws:
IllegalStateException
-
asBukkitLocation
@Contract("_ -> new") @NotNull public @NotNull Location asBukkitLocation(boolean calc) throws IllegalStateException - Throws:
IllegalStateException
-
asBukkitChunk
- Throws:
IllegalStateException
-
asBukkitChunk
- Throws:
IllegalStateException
-
asBukkitVelocity
@Contract(" -> new") @NotNull public @NotNull Vector asBukkitVelocity() throws IllegalStateException- Throws:
IllegalStateException
-
asBukkitVelocity
@Contract("_ -> new") @NotNull public @NotNull Vector asBukkitVelocity(boolean calc) throws IllegalStateException - Throws:
IllegalStateException
-
asBukkitWorld
@Contract("null -> fail") @NotNull public static @NotNull World asBukkitWorld(String world) throws IllegalStateException, NullPointerException -
asBukkitBlock
@NotNull public static @NotNull Block asBukkitBlock(@NotNull @NotNull PS ps) throws IllegalStateException - Throws:
IllegalStateException
-
asBukkitLocation
@Contract("_ -> new") @NotNull public static @NotNull Location asBukkitLocation(@NotNull @NotNull PS ps) throws IllegalStateException - Throws:
IllegalStateException
-
asBukkitChunk
@NotNull public static @NotNull Chunk asBukkitChunk(@NotNull @NotNull PS ps) throws IllegalStateException - Throws:
IllegalStateException
-
asBukkitVelocity
@Contract("_ -> new") @NotNull public static @NotNull Vector asBukkitVelocity(@NotNull @NotNull PS ps) throws IllegalStateException - Throws:
IllegalStateException
-
calcWorldName
-
trimEntityVelocityY
-
toString
-
toString
-
toString
-
locationDistanceSquared
-
locationDistance
-
inSameWorld
-
getDistinctChunks
-
getDistinctWorlds
-
hashCode
public int hashCode() -
calcHashCode
public int calcHashCode() -
calcHashCode
-
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<PS>
-