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 floatstatic final floatstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final PSstatic final String -
Method Summary
Modifier and TypeMethodDescription@NotNull Block@NotNull BlockasBukkitBlock(boolean calc) static @NotNull BlockasBukkitBlock(@NotNull PS ps) @NotNull Chunk@NotNull ChunkasBukkitChunk(boolean calc) static @NotNull ChunkasBukkitChunk(@NotNull PS ps) @NotNull Location@NotNull LocationasBukkitLocation(boolean calc) static @NotNull LocationasBukkitLocation(@NotNull PS ps) @NotNull Vector@NotNull VectorasBukkitVelocity(boolean calc) static @NotNull VectorasBukkitVelocity(@NotNull PS ps) @NotNull World@NotNull WorldasBukkitWorld(boolean calc) static @NotNull WorldasBukkitWorld(String world) @NotNull PSBuilderbuilder()static IntegercalcBlockCoord(Double location, Integer block, Integer chunk) static IntegercalcChunkCoord(Double location, Integer block, Integer chunk) intstatic intcalcHashCode(@NotNull PS ps) static DoublecalcLocationCoord(Double location, Integer block, Integer chunk) static Floatstatic DoublecalcVelocityCoord(Double location, Integer block, Integer chunk, Double velocity) static StringcalcWorldName(World world) static FloatintbooleangetBlock()getBlock(boolean calc) static IntegergetBlockCoord(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 IntegergetChunkCoord(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 DoublegetLocationCoord(boolean calc, Double location, Integer block, Integer chunk) getLocationCoords(boolean calc) getLocationX(boolean calc) getLocationY(boolean calc) getLocationZ(boolean calc) getPitch(boolean calc) static FloatgetRegionX(boolean calc) getRegionZ(boolean calc) getVelocity(boolean calc) static DoublegetVelocityCoord(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 FloatinthashCode()static booleaninSameWorld(PS one, PS two) static @Nullable DoublelocationDistance(PS one, PS two) static DoublelocationDistanceSquared(PS one, PS two) plusChunkCoords(int chunkX, int chunkZ) static DoublethrowIfStrange(Double d, String name) static FloatthrowIfStrange(Float f, String name) toString()@NotNull VersionedComponentstatic @NotNull VersionedComponentstatic DoubletrimEntityVelocityY(Double velocityY) static @NotNull PSvalueOf(int chunkX, int chunkZ) static PSvalueOf(com.google.gson.JsonElement jsonElement) static @NotNull PSstatic @NotNull PSvalueOf(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 PSstatic PSstatic PSstatic PSstatic PS@NotNull PSwithBlockX(Integer blockX) @NotNull PSwithBlockY(Integer blockY) @NotNull PSwithBlockZ(Integer blockZ) @NotNull PSwithChunkX(Integer chunkX) @NotNull PSwithChunkZ(Integer chunkZ) @NotNull PSwithLocationX(Double locationX) @NotNull PSwithLocationY(Double locationY) @NotNull PSwithLocationZ(Double locationZ) @NotNull PS@NotNull PSwithVelocityX(Double velocityX) @NotNull PSwithVelocityY(Double velocityY) @NotNull PSwithVelocityZ(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
- Returns:
- a MiniMessage string of the PS using the given format
-
toString
@NotNull public static @NotNull VersionedComponent toString(@Nullable @Nullable PS ps, @NotNull @NotNull PSFormat format) - Returns:
- a MiniMessage string of the PS using the given format
-
locationDistanceSquared
-
locationDistance
-
inSameWorld
-
getDistinctChunks
-
getDistinctWorlds
-
hashCode
public int hashCode() -
calcHashCode
public int calcHashCode() -
calcHashCode
-
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<PS>
-