mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-09-29 22:27:34 +02:00
Use new BentoBox API to avoid loading islands into cache on startup
Relates to #312
This commit is contained in:
parent
c3e03a4f59
commit
f2da5ba104
@ -414,7 +414,8 @@ public class LevelsManager {
|
|||||||
addon.log("Generating rankings");
|
addon.log("Generating rankings");
|
||||||
handler.loadObjects().forEach(il -> {
|
handler.loadObjects().forEach(il -> {
|
||||||
if (il.getLevel() > 0) {
|
if (il.getLevel() > 0) {
|
||||||
addon.getIslands().getIslandById(il.getUniqueId())
|
// Load islands, but don't cache them
|
||||||
|
addon.getIslands().getIslandById(il.getUniqueId(), false)
|
||||||
.ifPresent(i -> this.addToTopTen(i, il.getLevel()));
|
.ifPresent(i -> this.addToTopTen(i, il.getLevel()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ name: Level
|
|||||||
main: world.bentobox.level.Level
|
main: world.bentobox.level.Level
|
||||||
version: ${version}${build.number}
|
version: ${version}${build.number}
|
||||||
icon: DIAMOND
|
icon: DIAMOND
|
||||||
api-version: 1.16.5
|
api-version: 2.4.0
|
||||||
|
|
||||||
authors: tastybento
|
authors: tastybento
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
@ -165,6 +166,7 @@ public class LevelsManagerTest {
|
|||||||
when(im.hasIsland(eq(world), any(UUID.class))).thenReturn(true);
|
when(im.hasIsland(eq(world), any(UUID.class))).thenReturn(true);
|
||||||
when(im.getIsland(world, uuid)).thenReturn(island);
|
when(im.getIsland(world, uuid)).thenReturn(island);
|
||||||
when(im.getIslandById(anyString())).thenReturn(Optional.of(island));
|
when(im.getIslandById(anyString())).thenReturn(Optional.of(island));
|
||||||
|
when(im.getIslandById(anyString(), eq(false))).thenReturn(Optional.of(island));
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
when(player.getUniqueId()).thenReturn(uuid);
|
when(player.getUniqueId()).thenReturn(uuid);
|
||||||
@ -395,8 +397,8 @@ public class LevelsManagerTest {
|
|||||||
lm.loadTopTens();
|
lm.loadTopTens();
|
||||||
PowerMockito.verifyStatic(Bukkit.class); // 1
|
PowerMockito.verifyStatic(Bukkit.class); // 1
|
||||||
Bukkit.getScheduler();
|
Bukkit.getScheduler();
|
||||||
verify(scheduler).runTaskAsynchronously(eq(plugin), task.capture());
|
verify(scheduler).runTaskAsynchronously(eq(plugin), task.capture()); // Capture the task in the scheduler
|
||||||
task.getValue().run();
|
task.getValue().run(); // run it
|
||||||
verify(addon).log("Generating rankings");
|
verify(addon).log("Generating rankings");
|
||||||
verify(addon).log("Generated rankings for bskyblock-world");
|
verify(addon).log("Generated rankings for bskyblock-world");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user