mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 06:28:49 +00:00
Don't cache any homes if cache size is <= 0
This commit is contained in:
1 parent
f4a6873ed0
commit
f506f0fd00
1 file changed
+4
-1
@@ -98,8 +98,11 @@ public abstract class RandomTeleportEngine {
|
|||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
private void populateCache(@NotNull World world, final int cacheSize) {
|
private void populateCache(@NotNull World world, final int cacheSize) {
|
||||||
|
if (cacheSize <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
final int amountToPopulate = Math.max(1, cacheSize) - cachedPositions.get(world).size();
|
final int amountToPopulate = cacheSize - cachedPositions.get(world).size();
|
||||||
final Location originLocation = new Location(0, 0, 0, world);
|
final Location originLocation = new Location(0, 0, 0, world);
|
||||||
for (int i = 0; i < amountToPopulate; i++) {
|
for (int i = 0; i < amountToPopulate; i++) {
|
||||||
generateRandomLocation(originLocation)
|
generateRandomLocation(originLocation)
|
||||||
|
|||||||
Reference in new issue
Block a user