mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-06-27 15:15:24 +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");
|
||||
handler.loadObjects().forEach(il -> {
|
||||
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()));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ name: Level
|
|||
main: world.bentobox.level.Level
|
||||
version: ${version}${build.number}
|
||||
icon: DIAMOND
|
||||
api-version: 1.16.5
|
||||
api-version: 2.4.0
|
||||
|
||||
authors: tastybento
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
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.getIsland(world, uuid)).thenReturn(island);
|
||||
when(im.getIslandById(anyString())).thenReturn(Optional.of(island));
|
||||
when(im.getIslandById(anyString(), eq(false))).thenReturn(Optional.of(island));
|
||||
|
||||
// Player
|
||||
when(player.getUniqueId()).thenReturn(uuid);
|
||||
|
@ -395,8 +397,8 @@ public class LevelsManagerTest {
|
|||
lm.loadTopTens();
|
||||
PowerMockito.verifyStatic(Bukkit.class); // 1
|
||||
Bukkit.getScheduler();
|
||||
verify(scheduler).runTaskAsynchronously(eq(plugin), task.capture());
|
||||
task.getValue().run();
|
||||
verify(scheduler).runTaskAsynchronously(eq(plugin), task.capture()); // Capture the task in the scheduler
|
||||
task.getValue().run(); // run it
|
||||
verify(addon).log("Generating rankings");
|
||||
verify(addon).log("Generated rankings for bskyblock-world");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user