Class BukkitUtil

java.lang.Object
com.plotsquared.core.util.WorldUtil
com.plotsquared.bukkit.util.BukkitUtil

public class BukkitUtil extends com.plotsquared.core.util.WorldUtil
  • Field Details

    • BUKKIT_AUDIENCES

      public static final net.kyori.adventure.platform.bukkit.BukkitAudiences BUKKIT_AUDIENCES
    • LEGACY_COMPONENT_SERIALIZER

      public static final net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER
    • MINI_MESSAGE

      public static final net.kyori.adventure.text.minimessage.MiniMessage MINI_MESSAGE
  • Constructor Details

    • BukkitUtil

      public BukkitUtil()
  • Method Details

    • adapt

      public static @NonNull BukkitPlayer adapt(@NonNull Player player)
      Turn a Bukkit Player into a PlotSquared PlotPlayer
      Parameters:
      player - Bukkit player
      Returns:
      PlotSquared player
    • adapt

      public static @NonNull com.plotsquared.core.location.Location adapt(@NonNull Location location)
      Turn a Bukkit Location into a PlotSquared Location. This only copies the 4-tuple (world,x,y,z) and does not include the yaw and the pitch
      Parameters:
      location - Bukkit location
      Returns:
      PlotSquared location
    • adaptComplete

      public static @NonNull com.plotsquared.core.location.Location adaptComplete(@NonNull Location location)
      Turn a Bukkit Location into a PlotSquared Location. This copies the entire 6-tuple (world,x,y,z,yaw,pitch).
      Parameters:
      location - Bukkit location
      Returns:
      PlotSquared location
    • adapt

      public static @NonNull Location adapt(@NonNull com.plotsquared.core.location.Location location)
      Turn a PlotSquared Location into a Bukkit Location. This only copies the 4-tuple (world,x,y,z) and does not include the yaw and the pitch
      Parameters:
      location - PlotSquared location
      Returns:
      Bukkit location
    • getWorld

      public static @Nullable World getWorld(@NonNull String string)
      Get a Bukkit World from its name
      Parameters:
      string - World name
      Returns:
      World if it exists, or null
    • isBlockSame

      public boolean isBlockSame(@NonNull BlockState block1, @NonNull BlockState block2)
      Specified by:
      isBlockSame in class com.plotsquared.core.util.WorldUtil
    • isWorld

      public boolean isWorld(@NonNull String worldName)
      Specified by:
      isWorld in class com.plotsquared.core.util.WorldUtil
    • getBiome

      public void getBiome(@NonNull String world, int x, int z, @NonNull Consumer<BiomeType> result)
      Specified by:
      getBiome in class com.plotsquared.core.util.WorldUtil
    • getBiomeSynchronous

      public @NonNull BiomeType getBiomeSynchronous(@NonNull String world, int x, int z)
      Specified by:
      getBiomeSynchronous in class com.plotsquared.core.util.WorldUtil
    • getHighestBlock

      public void getHighestBlock(@NonNull String world, int x, int z, @NonNull IntConsumer result)
      Specified by:
      getHighestBlock in class com.plotsquared.core.util.WorldUtil
    • getHighestBlockSynchronous

      public @org.checkerframework.checker.index.qual.NonNegative int getHighestBlockSynchronous(@NonNull String world, int x, int z)
      Specified by:
      getHighestBlockSynchronous in class com.plotsquared.core.util.WorldUtil
    • getSignSynchronous

      public @NonNull String[] getSignSynchronous(@NonNull com.plotsquared.core.location.Location location)
      Specified by:
      getSignSynchronous in class com.plotsquared.core.util.WorldUtil
    • getSpawn

      public @NonNull com.plotsquared.core.location.Location getSpawn(@NonNull String world)
      Specified by:
      getSpawn in class com.plotsquared.core.util.WorldUtil
    • setSpawn

      public void setSpawn(@NonNull com.plotsquared.core.location.Location location)
      Specified by:
      setSpawn in class com.plotsquared.core.util.WorldUtil
    • saveWorld

      public void saveWorld(@NonNull String worldName)
      Specified by:
      saveWorld in class com.plotsquared.core.util.WorldUtil
    • setSign

      public void setSign(@NonNull com.plotsquared.core.location.Location location, @NonNull com.plotsquared.core.configuration.caption.Caption[] lines, @NonNull net.kyori.adventure.text.minimessage.Template... replacements)
      Specified by:
      setSign in class com.plotsquared.core.util.WorldUtil
    • getClosestBlock

      public @NonNull com.plotsquared.core.util.StringComparison<BlockState>.com.plotsquared.core.util.StringComparison.ComparisonResult getClosestBlock(@NonNull String name)
      Specified by:
      getClosestBlock in class com.plotsquared.core.util.WorldUtil
    • setBiomes

      public void setBiomes(@NonNull String worldName, @NonNull CuboidRegion region, @NonNull BiomeType biomeType)
      Specified by:
      setBiomes in class com.plotsquared.core.util.WorldUtil
    • getWeWorld

      public @NonNull World getWeWorld(@NonNull String world)
      Specified by:
      getWeWorld in class com.plotsquared.core.util.WorldUtil
    • refreshChunk

      public void refreshChunk(int x, int z, String world)
      Specified by:
      refreshChunk in class com.plotsquared.core.util.WorldUtil
    • getBlock

      public void getBlock(@NonNull com.plotsquared.core.location.Location location, @NonNull Consumer<BlockState> result)
      Specified by:
      getBlock in class com.plotsquared.core.util.WorldUtil
    • getBlockSynchronous

      public @NonNull BlockState getBlockSynchronous(@NonNull com.plotsquared.core.location.Location location)
      Specified by:
      getBlockSynchronous in class com.plotsquared.core.util.WorldUtil
    • getHealth

      public @org.checkerframework.checker.index.qual.NonNegative double getHealth(@NonNull com.plotsquared.core.player.PlotPlayer<?> player)
      Specified by:
      getHealth in class com.plotsquared.core.util.WorldUtil
    • getFoodLevel

      public @org.checkerframework.checker.index.qual.NonNegative int getFoodLevel(@NonNull com.plotsquared.core.player.PlotPlayer<?> player)
      Specified by:
      getFoodLevel in class com.plotsquared.core.util.WorldUtil
    • setHealth

      public void setHealth(@NonNull com.plotsquared.core.player.PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative double health)
      Specified by:
      setHealth in class com.plotsquared.core.util.WorldUtil
    • setFoodLevel

      public void setFoodLevel(@NonNull com.plotsquared.core.player.PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative int foodLevel)
      Specified by:
      setFoodLevel in class com.plotsquared.core.util.WorldUtil
    • getTypesInCategory

      public @NonNull Set<EntityType> getTypesInCategory(@NonNull String category)
      Specified by:
      getTypesInCategory in class com.plotsquared.core.util.WorldUtil
    • getTileEntityTypes

      public @NonNull Collection<BlockType> getTileEntityTypes()
      Specified by:
      getTileEntityTypes in class com.plotsquared.core.util.WorldUtil
    • getTileEntityCount

      public @org.checkerframework.checker.index.qual.NonNegative int getTileEntityCount(@NonNull String world, @NonNull BlockVector2 chunk)
      Specified by:
      getTileEntityCount in class com.plotsquared.core.util.WorldUtil
    • getChunkChunks

      public Set<BlockVector2> getChunkChunks(String world)
      Overrides:
      getChunkChunks in class com.plotsquared.core.util.WorldUtil