public class PaperLib
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static BlockStateSnapshotResult |
getBlockState(org.bukkit.block.Block block,
boolean useSnapshot)
Get's a BlockState, optionally not using a snapshot
|
static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> |
getChunkAtAsync(org.bukkit.Location loc)
Gets the chunk at the target location, loading it asynchronously if needed.
|
static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> |
getChunkAtAsync(org.bukkit.Location loc,
boolean gen)
Gets the chunk at the target location, loading it asynchronously if needed.
|
static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> |
getChunkAtAsync(org.bukkit.World world,
int x,
int z)
Gets the chunk at the target location, loading it asynchronously if needed.
|
static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> |
getChunkAtAsync(org.bukkit.World world,
int x,
int z,
boolean gen)
Gets the chunk at the target location, loading it asynchronously if needed.
|
static Environment |
getEnvironment()
Gets a reference to the current environment.
|
static int |
getMinecraftPatchVersion()
Gets the current Minecraft Patch version.
|
static int |
getMinecraftVersion()
Gets the current Minecraft Minor version.
|
static boolean |
isChunkGenerated(org.bukkit.Location loc)
Checks if the chunk has been generated or not.
|
static boolean |
isChunkGenerated(org.bukkit.World world,
int x,
int z)
Checks if the chunk has been generated or not.
|
static boolean |
isPaper()
Check if the server has access to the Paper API
|
static boolean |
isSpigot()
Check if the server has access to the Spigot API
|
static boolean |
isVersion(int minor)
Detects if the current MC version is at least the following version.
|
static boolean |
isVersion(int minor,
int patch)
Detects if the current MC version is at least the following version.
|
static void |
setCustomEnvironment(Environment environment)
If you have need to inject a custom Environment, such as running on your own fork, or unit tests, do it here.
|
static void |
suggestPaper(org.bukkit.plugin.Plugin plugin)
Can be called during plugin initialization to inform the server owner they should switch to Paper
If you do not mind helping spread Paper, please call this in your plugin onEnable to help spread
awareness about Paper, and encourage them that your plugin is better when used with Paper!
|
static java.util.concurrent.CompletableFuture<java.lang.Boolean> |
teleportAsync(org.bukkit.entity.Entity entity,
org.bukkit.Location location)
Teleports an Entity to the target location, loading the chunk asynchronously first if needed.
|
static java.util.concurrent.CompletableFuture<java.lang.Boolean> |
teleportAsync(org.bukkit.entity.Entity entity,
org.bukkit.Location location,
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
Teleports an Entity to the target location, loading the chunk asynchronously first if needed.
|
@Nonnull public static Environment getEnvironment()
public static void setCustomEnvironment(@Nonnull
Environment environment)
environment - Custom Environment@Nonnull
public static java.util.concurrent.CompletableFuture<java.lang.Boolean> teleportAsync(@Nonnull
org.bukkit.entity.Entity entity,
@Nonnull
org.bukkit.Location location)
entity - The Entity to teleportlocation - The Location to Teleport to@Nonnull
public static java.util.concurrent.CompletableFuture<java.lang.Boolean> teleportAsync(@Nonnull
org.bukkit.entity.Entity entity,
@Nonnull
org.bukkit.Location location,
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
entity - The Entity to teleportlocation - The Location to Teleport tocause - The cause for the teleportation@Nonnull
public static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> getChunkAtAsync(@Nonnull
org.bukkit.Location loc)
loc - Location to get chunk for@Nonnull
public static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> getChunkAtAsync(@Nonnull
org.bukkit.Location loc,
boolean gen)
loc - Location to get chunk forgen - Should the chunk generate or not. Only respected on some MC versions, 1.13 for CB, 1.12 for Paper@Nonnull
public static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> getChunkAtAsync(@Nonnull
org.bukkit.World world,
int x,
int z)
world - World to load chunk forx - X coordinate of the chunk to loadz - Z coordinate of the chunk to load@Nonnull
public static java.util.concurrent.CompletableFuture<org.bukkit.Chunk> getChunkAtAsync(@Nonnull
org.bukkit.World world,
int x,
int z,
boolean gen)
world - World to load chunk forx - X coordinate of the chunk to loadz - Z coordinate of the chunk to loadgen - Should the chunk generate or not. Only respected on some MC versions, 1.13 for CB, 1.12 for Paperpublic static boolean isChunkGenerated(@Nonnull
org.bukkit.Location loc)
loc - Location to check if the chunk is generatedpublic static boolean isChunkGenerated(@Nonnull
org.bukkit.World world,
int x,
int z)
world - World to check forx - X coordinate of the chunk to checkz - Z coordinate of the chunk to checl@Nonnull public static BlockStateSnapshotResult getBlockState(@Nonnull org.bukkit.block.Block block, boolean useSnapshot)
block - The block to get a State ofuseSnapshot - Whether or not to use a snapshot when supportedpublic static boolean isVersion(int minor)
minor - Min Minor Versionpublic static boolean isVersion(int minor,
int patch)
minor - Min Minor Versionpatch - Min Patch Versionpublic static int getMinecraftVersion()
public static int getMinecraftPatchVersion()
public static boolean isSpigot()
public static boolean isPaper()
public static void suggestPaper(@Nonnull
org.bukkit.plugin.Plugin plugin)
plugin - Your plugin object