Interface ChunkManager
chunks for a ServerWorld.-
Method Summary
Modifier and TypeMethodDescriptionGets all currently activetickets.findTickets(TicketType type) Gets all currently activeticketsthat are of the providedTicketType.findTickets(Vector3i chunkOrigin) Gets all currently activeticketsthat have the given chunk origin.default CompletableFuture<Boolean> regenerateChunk(int cx, int cy, int cz) Regenerates a chunk at the given chunk coordinates.regenerateChunk(int cx, int cy, int cz, ChunkRegenerateFlag flag) Regenerates a chunk at the given chunk coordinates.default CompletableFuture<Boolean> regenerateChunk(Vector3i chunkPosition) Regenerates a chunk at the given chunk coordinate position.default CompletableFuture<Boolean> regenerateChunk(Vector3i chunkPosition, ChunkRegenerateFlag flag) Regenerates a chunk at the given chunk coordinate position.booleanreleaseTicket(Ticket ticket) Releases the providedTicket, allowing the chunk position represented by the given ticket to be unloaded (if it is not being kept loaded by other means).booleanrenewTicket(Ticket ticket) Attempts to renew this ticket, resetting the lifetime to the default.requestTicket(TicketType type, Vector3i chunkOrigin, int radius) Request aTicketfor the givenTicketType.Gets theTicksremaining on the supplied ticket.booleanChecks if the providedTicketis valid for the world this manager represents.world()Gets theServerWorldthis manager operates upon.
-
Method Details
-
world
ServerWorld world()Gets theServerWorldthis manager operates upon.- Returns:
- The
ServerWorld
-
valid
Checks if the providedTicketis valid for the world this manager represents.- Parameters:
ticket- The ticket to check.- Returns:
- true if so
-
timeLeft
Gets theTicksremaining on the supplied ticket.- Returns:
- The
Ticks
-
requestTicket
Request aTicketfor the givenTicketType.- Parameters:
type- The type of ticket to request.chunkOrigin- The chunk co-ordinates of the centralWorldChunkaffected by thisTicketradius- The radius of the area, in chunks, that thisTicketaffects.- Returns:
- The ticket, if granted.
-
renewTicket
Attempts to renew this ticket, resetting the lifetime to the default.If this ticket is no longer valid, it cannot be renewed. Instead, you should
requestTicket(TicketType, Vector3i, int)a new one.- Parameters:
ticket- The ticket to attempt to renew- Returns:
trueif successful
-
releaseTicket
Releases the providedTicket, allowing the chunk position represented by the given ticket to be unloaded (if it is not being kept loaded by other means).- Parameters:
ticket- The ticket to release.
-
findTickets
Gets all currently activeticketsthat have the given chunk origin.- Parameters:
chunkOrigin- The chunk co-ordinates of the origin.- Returns:
- A
Collectionoftickets
-
findTickets
Gets all currently activeticketsthat are of the providedTicketType.- Parameters:
type- TheTicketTypeto retrieve tickets for- Returns:
- A
Collectionoftickets
-
findTickets
Collection<Ticket> findTickets()Gets all currently activetickets.- Returns:
- A
Collectionoftickets
-
regenerateChunk
Regenerates a chunk at the given chunk coordinate position.Care should be taken to check the result of the future, as an exception may be provided if the regeneration was not successful.
Users must not use
getorjoinon this future. Doing so may end up causing a deadlock on the server.- Parameters:
chunkPosition- The chunk position to regenerate- Returns:
- The regenerated chunk, if available
-
regenerateChunk
Regenerates a chunk at the given chunk coordinates.Care should be taken to check the result of the future, as an exception may be provided if the regeneration was not successful.
Users must not use
getorjoinon this future. Doing so may end up causing a deadlock on the server.- Parameters:
cx- The chunk x coordinatecy- The chunk y coordinatecz- The chunk z coordinate- Returns:
- The regenerated chunk, if available
-
regenerateChunk
default CompletableFuture<Boolean> regenerateChunk(Vector3i chunkPosition, ChunkRegenerateFlag flag) Regenerates a chunk at the given chunk coordinate position.Care should be taken to check the result of the future, as an exception may be provided if the regeneration was not successful.
Users must not use
getorjoinon this future. Doing so may end up causing a deadlock on the server.- Parameters:
chunkPosition- The chunk position to regenerateflag- The chunk regenerate flag to use- Returns:
- The regenerated chunk, if available
-
regenerateChunk
Regenerates a chunk at the given chunk coordinates.Care should be taken to check the result of the future, as an exception may be provided if the regeneration was not successful.
Users must not use
getorjoinon this future. Doing so may end up causing a deadlock on the server.- Parameters:
cx- The chunk x coordinatecy- The chunk y coordinatecz- The chunk z coordinateflag- The chunk regenerate flag to use- Returns:
- The regenerated chunk, if available
-