Class WorldUtil

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

public abstract class WorldUtil extends Object
  • Constructor Details

    • WorldUtil

      public WorldUtil()
  • Method Details

    • setBiome

      public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, 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 @NonNull StringComparison<BlockState>.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<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 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<BlockState> result)
      Get the block at a given location (asynchronously)
      Parameters:
      location - Block location
      result - Result consumer
    • getBlockSynchronous

      @Deprecated public abstract @NonNull 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 CuboidRegion region, @NonNull BiomeType biome)
      Set the biome in a region
      Parameters:
      world - World name
      region - Region
      biome - New biome
    • getWeWorld

      public abstract @NonNull 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<BlockVector2> getChunkChunks(String world)
    • isBlockSame

      public abstract boolean isBlockSame(@NonNull BlockState block1, @NonNull 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<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<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 BlockVector2 chunk)
      Get the tile entity count in a chunk
      Parameters:
      world - World
      chunk - Chunk coordinates
      Returns:
      Tile entity count