Class WorldUtil

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

public abstract class WorldUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    getBiome​(@NonNull String world, int x, int z, @NonNull Consumer<com.sk89q.worldedit.world.biome.BiomeType> result)
    Get the biome in a given chunk, asynchronously
    abstract @NonNull com.sk89q.worldedit.world.biome.BiomeType
    getBiomeSynchronous​(@NonNull String world, int x, int z)
    abstract void
    getBlock​(@NonNull Location location, @NonNull Consumer<com.sk89q.worldedit.world.block.BlockState> result)
    Get the block at a given location (asynchronously)
    abstract @NonNull com.sk89q.worldedit.world.block.BlockState
    getBlockSynchronous​(@NonNull Location location)
    Set<com.sk89q.worldedit.math.BlockVector2>
     
    getClosestBlock​(@NonNull String name)
    Get a string comparison with the closets block state matching a given string
    abstract @org.checkerframework.checker.index.qual.NonNegative int
    getFoodLevel​(@NonNull PlotPlayer<?> player)
    Get the player food level
    abstract @org.checkerframework.checker.index.qual.NonNegative double
    getHealth​(@NonNull PlotPlayer<?> player)
    Get the player health
    abstract void
    getHighestBlock​(@NonNull String world, int x, int z, @NonNull IntConsumer result)
    Get the Y coordinate of the highest non-air block in the world, asynchronously
    abstract @org.checkerframework.checker.index.qual.NonNegative int
    getHighestBlockSynchronous​(@NonNull String world, int x, int z)
    abstract @NonNull String[]
    getSignSynchronous​(@NonNull Location location)
    Deprecated.
    May result in synchronous chunk loading
    abstract @NonNull Location
    getSpawn​(@NonNull String world)
    Get the world spawn location
    abstract @org.checkerframework.checker.index.qual.NonNegative int
    getTileEntityCount​(@NonNull String world, @NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
    Get the tile entity count in a chunk
    abstract @NonNull Collection<com.sk89q.worldedit.world.block.BlockType>
    Get all recognized tile entity types
    abstract @NonNull Set<com.sk89q.worldedit.world.entity.EntityType>
    getTypesInCategory​(@NonNull String category)
    Get all entity types belonging to an entity category
    abstract @NonNull com.sk89q.worldedit.world.World
    getWeWorld​(@NonNull String world)
    Get the WorldEdit World corresponding to a world name
    abstract boolean
    isBlockSame​(@NonNull com.sk89q.worldedit.world.block.BlockState block1, @NonNull com.sk89q.worldedit.world.block.BlockState block2)
    Check if two blocks are the same type)
    abstract boolean
    isWorld​(@NonNull String worldName)
    Check if a given world name corresponds to a real world
    abstract void
    refreshChunk​(int x, int z, String world)
    Refresh (resend) chunk to player.
    abstract void
    saveWorld​(@NonNull String world)
    Save a world
    static void
    setBiome​(String world, int p1x, int p1z, int p2x, int p2z, com.sk89q.worldedit.world.biome.BiomeType biome)
    Set the biome in a region
    abstract void
    setBiomes​(@NonNull String world, @NonNull com.sk89q.worldedit.regions.CuboidRegion region, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
    Set the biome in a region
    abstract void
    setFoodLevel​(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative int foodLevel)
    Set the player food level
    abstract void
    setHealth​(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative double health)
    Set the player health
    abstract void
    setSign​(@NonNull Location location, @NonNull Caption[] lines, @NonNull net.kyori.adventure.text.minimessage.Template... replacements)
    Set the block at the specified location to a sign, with given text
    abstract void
    setSpawn​(@NonNull Location location)
    Set the world spawn location
    void
    upload​(@NonNull Plot plot, @Nullable UUID uuid, @Nullable String file, @NonNull RunnableVal<URL> whenDone)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WorldUtil

      public WorldUtil()
  • Method Details

    • setBiome

      public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, com.sk89q.worldedit.world.biome.BiomeType biome)
      Set the biome in a region
      Parameters:
      world - World name
      p1x - Min X
      p1z - Min Z
      p2x - Max X
      p2z - Max Z
      biome - Biome
    • isWorld

      public abstract boolean isWorld(@NonNull String worldName)
      Check if a given world name corresponds to a real world
      Parameters:
      worldName - World name
      Returns:
      true if there exists a world with the given world name, false if not
    • getSignSynchronous

      @Deprecated public abstract @NonNull String[] getSignSynchronous(@NonNull Location location)
      Deprecated.
      May result in synchronous chunk loading
      Parameters:
      location - Sign location
      Returns:
      Sign content (or an empty string array if the block is not a sign)
    • getSpawn

      public abstract @NonNull Location getSpawn(@NonNull String world)
      Get the world spawn location
      Parameters:
      world - World name
      Returns:
      World spawn location
    • setSpawn

      public abstract void setSpawn(@NonNull Location location)
      Set the world spawn location
      Parameters:
      location - New spawn
    • saveWorld

      public abstract void saveWorld(@NonNull String world)
      Save a world
      Parameters:
      world - World name
    • getClosestBlock

      public abstract StringComparison.ComparisonResult getClosestBlock(@NonNull String name)
      Get a string comparison with the closets block state matching a given string
      Parameters:
      name - Block name
      Returns:
      Comparison result containing the closets matching block
    • setSign

      public abstract void setSign(@NonNull Location location, @NonNull Caption[] lines, @NonNull net.kyori.adventure.text.minimessage.Template... replacements)
      Set the block at the specified location to a sign, with given text
      Parameters:
      location - Block location
      lines - Sign text
      replacements - Text replacements
    • getBiome

      public abstract void getBiome(@NonNull String world, int x, int z, @NonNull Consumer<com.sk89q.worldedit.world.biome.BiomeType> result)
      Get the biome in a given chunk, asynchronously
      Parameters:
      world - World
      x - Chunk X coordinate
      z - Chunk Z coordinate
      result - Result consumer
    • getBiomeSynchronous

      @Deprecated public abstract @NonNull com.sk89q.worldedit.world.biome.BiomeType getBiomeSynchronous(@NonNull String world, int x, int z)
      Get the biome in a given chunk, asynchronously
      Parameters:
      world - World
      x - Chunk X coordinate
      z - Chunk Z coordinate
      Returns:
      Biome
    • getBlock

      public abstract void getBlock(@NonNull Location location, @NonNull Consumer<com.sk89q.worldedit.world.block.BlockState> result)
      Get the block at a given location (asynchronously)
      Parameters:
      location - Block location
      result - Result consumer
    • getBlockSynchronous

      @Deprecated public abstract @NonNull com.sk89q.worldedit.world.block.BlockState getBlockSynchronous(@NonNull Location location)
      Get the block at a given location (synchronously)
      Parameters:
      location - Block location
      Returns:
      Result
    • getHighestBlock

      public abstract void getHighestBlock(@NonNull String world, int x, int z, @NonNull IntConsumer result)
      Get the Y coordinate of the highest non-air block in the world, asynchronously
      Parameters:
      world - World name
      x - X coordinate
      z - Z coordinate
      result - Result consumer
    • getHighestBlockSynchronous

      @Deprecated public abstract @org.checkerframework.checker.index.qual.NonNegative int getHighestBlockSynchronous(@NonNull String world, int x, int z)
      Get the Y coordinate of the highest non-air block in the world, synchronously
      Parameters:
      world - World name
      x - X coordinate
      z - Z coordinate
      Returns:
      Result
    • setBiomes

      public abstract void setBiomes(@NonNull String world, @NonNull com.sk89q.worldedit.regions.CuboidRegion region, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
      Set the biome in a region
      Parameters:
      world - World name
      region - Region
      biome - New biome
    • getWeWorld

      public abstract @NonNull com.sk89q.worldedit.world.World getWeWorld(@NonNull String world)
      Get the WorldEdit World corresponding to a world name
      Parameters:
      world - World name
      Returns:
      World object
    • refreshChunk

      public abstract void refreshChunk(int x, int z, String world)
      Refresh (resend) chunk to player. Usually after setting the biome
      Parameters:
      x - Chunk x location
      z - Chunk z location
      world - World of the chunk
    • upload

      public void upload(@NonNull Plot plot, @Nullable UUID uuid, @Nullable String file, @NonNull RunnableVal<URL> whenDone)
    • getChunkChunks

      public Set<com.sk89q.worldedit.math.BlockVector2> getChunkChunks(String world)
    • isBlockSame

      public abstract boolean isBlockSame(@NonNull com.sk89q.worldedit.world.block.BlockState block1, @NonNull com.sk89q.worldedit.world.block.BlockState block2)
      Check if two blocks are the same type)
      Parameters:
      block1 - First block
      block2 - Second block
      Returns:
      true if the blocks have the same type, false if not
    • getHealth

      public abstract @org.checkerframework.checker.index.qual.NonNegative double getHealth(@NonNull PlotPlayer<?> player)
      Get the player health
      Parameters:
      player - Player
      Returns:
      Non-negative health
    • setHealth

      public abstract void setHealth(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative double health)
      Set the player health
      Parameters:
      player - Player health
      health - Non-negative health
    • getFoodLevel

      public abstract @org.checkerframework.checker.index.qual.NonNegative int getFoodLevel(@NonNull PlotPlayer<?> player)
      Get the player food level
      Parameters:
      player - Player
      Returns:
      Non-negative food level
    • setFoodLevel

      public abstract void setFoodLevel(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative int foodLevel)
      Set the player food level
      Parameters:
      player - Player food level
      foodLevel - Non-negative food level
    • getTypesInCategory

      public abstract @NonNull Set<com.sk89q.worldedit.world.entity.EntityType> getTypesInCategory(@NonNull String category)
      Get all entity types belonging to an entity category
      Parameters:
      category - Entity category
      Returns:
      Set containing all entities belonging to the given category
    • getTileEntityTypes

      public abstract @NonNull Collection<com.sk89q.worldedit.world.block.BlockType> getTileEntityTypes()
      Get all recognized tile entity types
      Returns:
      Collection containing all known tile entity types
    • getTileEntityCount

      public abstract @org.checkerframework.checker.index.qual.NonNegative int getTileEntityCount(@NonNull String world, @NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
      Get the tile entity count in a chunk
      Parameters:
      world - World
      chunk - Chunk coordinates
      Returns:
      Tile entity count