Class ChunkCache

java.lang.Object
ua.mcchickenstudio.opencreative.utils.world.cache.ChunkCache

public class ChunkCache extends Object

ChunkCache

This class saves the state of the chunk in the cache so as not to overload the memory.
Author:
Sasha Kireiko
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isChunkGenerated(@NotNull org.bukkit.World world, int x, int z)
    Checks whether chunk is generated.
    static void
    load(@NotNull org.bukkit.World world, int x, int z)
    Saves chunk's hashcode into map.
    static void
    preLoad(@NotNull org.bukkit.World world, int x, int z)
    Preloads chunk and saves it's hashcode into map.
    static void
    unload(@NotNull org.bukkit.World world, int x, int z)
    Marks chunk as unloaded.

    Methods inherited from class Object

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

    • ChunkCache

      public ChunkCache()
  • Method Details

    • isChunkGenerated

      public static boolean isChunkGenerated(@NotNull @NotNull org.bukkit.World world, int x, int z)
      Checks whether chunk is generated.
      Parameters:
      world - world with chunk.
      x - x coordinate of chunk.
      z - z coordinate of chunk.
      Returns:
      true - chunk is generated, false - not generated.
    • preLoad

      public static void preLoad(@NotNull @NotNull org.bukkit.World world, int x, int z)
      Preloads chunk and saves it's hashcode into map.
      Parameters:
      world - world with chunk.
      x - x coordinate of chunk.
      z - z coordinate of chunk.
    • load

      public static void load(@NotNull @NotNull org.bukkit.World world, int x, int z)
      Saves chunk's hashcode into map.
      Parameters:
      world - world with chunk.
      x - x coordinate of chunk.
      z - z coordinate of chunk.
    • unload

      public static void unload(@NotNull @NotNull org.bukkit.World world, int x, int z)
      Marks chunk as unloaded.
      Parameters:
      world - world with chunk.
      x - x coordinate of chunk.
      z - z coordinate of chunk.