Class ResourceManager
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.geo.ResourceManager
The
ResourceManager
is responsible for registering and managing a GEOResource
.
You have to use the ResourceManager
if you want to generate or consume a GEOResource
too.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSupplies
(GEOResource resource, org.bukkit.World world, int x, int z) This method returns the amount of a certainGEOResource
found in a givenChunk
.void
getSuppliesAsync
(GEOResource resource, org.bukkit.Chunk chunk, IAsyncReadCallback<Integer> callback) void
scan
(org.bukkit.entity.Player p, org.bukkit.block.Block block, int page) This method will start a geo-scan at the givenBlock
and display the result of that scan to the givenPlayer
.void
setSupplies
(GEOResource resource, org.bukkit.World world, int x, int z, int value) This method will set the supplies in a givenChunk
to the specified value.
-
Constructor Details
-
ResourceManager
This will create a newResourceManager
.- Parameters:
plugin
- OurSlimefun
instance
-
-
Method Details
-
getSupplies
@Nonnull public OptionalInt getSupplies(@Nonnull GEOResource resource, @Nonnull org.bukkit.World world, int x, int z) This method returns the amount of a certainGEOResource
found in a givenChunk
. The result is anOptionalInt
which will be empty if thisGEOResource
has not been generated at thatLocation
yet.- Parameters:
resource
- TheGEOResource
to queryworld
- TheWorld
of thisLocation
x
- TheChunk
x coordinatez
- TheChunk
z coordinate- Returns:
- An
OptionalInt
, either empty or containing the amount of the givenGEOResource
-
getSuppliesAsync
public void getSuppliesAsync(GEOResource resource, org.bukkit.Chunk chunk, IAsyncReadCallback<Integer> callback) -
setSupplies
public void setSupplies(@Nonnull GEOResource resource, @Nonnull org.bukkit.World world, int x, int z, int value) This method will set the supplies in a givenChunk
to the specified value.- Parameters:
resource
- TheGEOResource
world
- TheWorld
x
- The x coordinate of thatChunk
z
- The z coordinate of thatChunk
value
- The new supply value
-
scan
public void scan(@Nonnull org.bukkit.entity.Player p, @Nonnull org.bukkit.block.Block block, int page) This method will start a geo-scan at the givenBlock
and display the result of that scan to the givenPlayer
. Note that scans are always perChunk
, not perBlock
, theBlock
parameter only determines theLocation
that was clicked but it will still scan the entireChunk
.- Parameters:
p
- ThePlayer
who requested these resultsblock
- TheBlock
which the scan starts atpage
- The zero-based page to display
-