Class BlockStorage

java.lang.Object
me.mrCookieSlime.Slimefun.api.BlockStorage

public class BlockStorage extends Object
  • Constructor Details

    • BlockStorage

      public BlockStorage(World w)
  • Method Details

    • getStorage

      @Nullable public static BlockStorage getStorage(@Nonnull World world)
    • getOrCreate

      @Nonnull public static BlockStorage getOrCreate(@Nonnull World world)
    • computeChanges

      public void computeChanges()
    • getChanges

      public int getChanges()
    • save

      public void save()
    • saveAndRemove

      public void saveAndRemove()
    • isMarkedForRemoval

      public boolean isMarkedForRemoval()
    • saveChunks

      public static void saveChunks()
    • getRawStorage

      @Nonnull public Map<Location,Config> getRawStorage()
      This will return an ImmutableMap of the underline Map<String, Config> of this worlds BlockStorage.
      Returns:
      An ImmutableMap of the raw data.
    • getRawStorage

      @Nullable public static Map<Location,Config> getRawStorage(@Nonnull World world)
      This will return an ImmutableMap of the underline Map<String, Config> of this worlds BlockStorage. If there is no registered world then this will return null.
      Parameters:
      world - The world of which to fetch the data from.
      Returns:
      An ImmutableMap of the raw data or null if the world isn't registered.
    • store

      public static void store(Block block, ItemStack item)
    • store

      public static void store(Block block, String item)
    • retrieve

      @Nullable public static ItemStack retrieve(@Nonnull Block block)
      Retrieves the SlimefunItem's ItemStack from the specified Block. If the specified Block is registered in BlockStorage, its data will be erased from it, regardless of the returned value.
      Parameters:
      block - the block to retrieve the ItemStack from
      Returns:
      the SlimefunItem's ItemStack corresponding to the block if it has one, otherwise null
    • getLocationInfo

      @Nonnull public static Config getLocationInfo(Location l)
    • getLocationInfo

      public static String getLocationInfo(Location l, String key)
    • addBlockInfo

      public static void addBlockInfo(Location l, String key, String value)
    • addBlockInfo

      public static void addBlockInfo(Block block, String key, String value)
    • addBlockInfo

      public static void addBlockInfo(Block block, String key, String value, boolean updateTicker)
    • addBlockInfo

      public static void addBlockInfo(Location l, String key, String value, boolean updateTicker)
    • hasBlockInfo

      public static boolean hasBlockInfo(Block block)
    • hasBlockInfo

      public static boolean hasBlockInfo(Location l)
    • setBlockInfo

      public static void setBlockInfo(Block b, String json, boolean updateTicker)
    • setBlockInfo

      public static void setBlockInfo(Location l, String json, boolean updateTicker)
    • clearBlockInfo

      public static void clearBlockInfo(Block block)
    • clearBlockInfo

      public static void clearBlockInfo(Location l)
    • clearBlockInfo

      public static void clearBlockInfo(Block b, boolean destroy)
    • clearBlockInfo

      public static void clearBlockInfo(Location l, boolean destroy)
    • clearAllBlockInfoAtChunk

      public static void clearAllBlockInfoAtChunk(Chunk chunk, boolean destroy)
    • clearAllBlockInfoAtChunk

      public static void clearAllBlockInfoAtChunk(World world, int chunkX, int chunkZ, boolean destroy)
    • deleteLocationInfoUnsafely

      public static void deleteLocationInfoUnsafely(Location l, boolean destroy)
      Do not call this method!. This method is used for internal purposes only.
      Parameters:
      l - The Location
      destroy - Whether to completely destroy the block data
    • moveBlockInfo

      @ParametersAreNonnullByDefault public static void moveBlockInfo(Location from, Location to)
    • moveLocationInfoUnsafely

      @ParametersAreNonnullByDefault public static void moveLocationInfoUnsafely(Location from, Location to)
      Do not call this method!. This method is used for internal purposes only.
      Parameters:
      from - The origin Location
      to - The destination Location
    • check

      @Nullable public static SlimefunItem check(@Nonnull Block b)
    • check

      @Nullable public static SlimefunItem check(@Nonnull Location l)
    • check

      public static boolean check(Block block, String slimefunItem)
    • checkID

      @Nullable public static String checkID(@Nonnull Block b)
    • checkID

      @Nullable public static String checkID(@Nonnull Location l)
    • check

      public static boolean check(@Nonnull Location l, @Nullable String slimefunItem)
    • isWorldLoaded

      public static boolean isWorldLoaded(@Nonnull World world)
    • loadInventory

      public BlockMenu loadInventory(Location l, BlockMenuPreset preset)
    • reloadInventory

      public void reloadInventory(Location l)
      Reload a BlockMenu based on the preset. This method is solely for if you wish to reload based on data from the preset.
      Parameters:
      l - The location of the Block.
    • clearInventory

      public void clearInventory(Location l)
    • hasInventory

      public boolean hasInventory(Location l)
    • hasUniversalInventory

      public static boolean hasUniversalInventory(String id)
    • getUniversalInventory

      public static UniversalBlockMenu getUniversalInventory(Block block)
    • getUniversalInventory

      public static UniversalBlockMenu getUniversalInventory(Location l)
    • getUniversalInventory

      public static UniversalBlockMenu getUniversalInventory(String id)
    • getInventory

      public static BlockMenu getInventory(Block b)
    • hasInventory

      public static boolean hasInventory(Block b)
    • getInventory

      public static BlockMenu getInventory(Location l)
    • getChunkInfo

      public static Config getChunkInfo(World world, int x, int z)
    • setChunkInfo

      public static void setChunkInfo(World world, int x, int z, String key, String value)
    • hasChunkInfo

      public static boolean hasChunkInfo(World world, int x, int z)
    • getChunkInfo

      public static String getChunkInfo(World world, int x, int z, String key)
    • getBlockInfoAsJson

      public static String getBlockInfoAsJson(Block block)
    • getBlockInfoAsJson

      public static String getBlockInfoAsJson(Location l)
    • hasUniversalInventory

      public boolean hasUniversalInventory(Block block)
    • hasUniversalInventory

      public boolean hasUniversalInventory(Location l)