2020-06-22 02:54:51 +02:00
|
|
|
package world.bentobox.level;
|
|
|
|
|
|
|
|
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.anyInt;
|
|
|
|
import static org.mockito.ArgumentMatchers.anyString;
|
|
|
|
import static org.mockito.ArgumentMatchers.eq;
|
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
|
import static org.mockito.Mockito.verify;
|
|
|
|
import static org.mockito.Mockito.when;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
import java.util.ArrayList;
|
2020-07-26 23:40:17 +02:00
|
|
|
import java.util.Collections;
|
2020-06-22 02:54:51 +02:00
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2020-09-12 17:05:04 +02:00
|
|
|
import java.util.Optional;
|
2020-06-22 02:54:51 +02:00
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
import org.bukkit.inventory.ItemFactory;
|
|
|
|
import org.bukkit.inventory.meta.ItemMeta;
|
|
|
|
import org.bukkit.plugin.PluginManager;
|
2020-09-12 17:05:04 +02:00
|
|
|
import org.bukkit.scheduler.BukkitScheduler;
|
2020-06-22 02:54:51 +02:00
|
|
|
import org.junit.After;
|
|
|
|
import org.junit.Before;
|
|
|
|
import org.junit.BeforeClass;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
2020-09-12 17:05:04 +02:00
|
|
|
import org.mockito.ArgumentCaptor;
|
2020-06-22 02:54:51 +02:00
|
|
|
import org.mockito.Mock;
|
|
|
|
import org.mockito.Mockito;
|
|
|
|
import org.mockito.stubbing.Answer;
|
|
|
|
import org.powermock.api.mockito.PowerMockito;
|
|
|
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
|
|
|
import org.powermock.modules.junit4.PowerMockRunner;
|
|
|
|
import org.powermock.reflect.Whitebox;
|
|
|
|
|
|
|
|
import com.google.common.collect.ImmutableSet;
|
|
|
|
|
|
|
|
import world.bentobox.bentobox.BentoBox;
|
|
|
|
import world.bentobox.bentobox.Settings;
|
|
|
|
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
|
|
|
import world.bentobox.bentobox.api.user.User;
|
|
|
|
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
|
|
|
|
import world.bentobox.bentobox.database.DatabaseSetup;
|
|
|
|
import world.bentobox.bentobox.database.DatabaseSetup.DatabaseType;
|
|
|
|
import world.bentobox.bentobox.database.objects.Island;
|
|
|
|
import world.bentobox.bentobox.managers.IslandWorldManager;
|
2020-06-28 18:42:36 +02:00
|
|
|
import world.bentobox.bentobox.managers.IslandsManager;
|
2020-06-22 02:54:51 +02:00
|
|
|
import world.bentobox.bentobox.managers.PlayersManager;
|
|
|
|
import world.bentobox.level.calculators.Pipeliner;
|
|
|
|
import world.bentobox.level.calculators.Results;
|
|
|
|
import world.bentobox.level.config.ConfigSettings;
|
2020-07-26 23:40:17 +02:00
|
|
|
import world.bentobox.level.objects.IslandLevels;
|
2021-02-28 18:33:11 +01:00
|
|
|
import world.bentobox.level.objects.TopTenData;
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author tastybento
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
@RunWith(PowerMockRunner.class)
|
|
|
|
@PrepareForTest({Bukkit.class, BentoBox.class, DatabaseSetup.class, PanelBuilder.class})
|
|
|
|
public class LevelsManagerTest {
|
|
|
|
|
|
|
|
@Mock
|
|
|
|
private static AbstractDatabaseHandler<Object> handler;
|
|
|
|
@Mock
|
|
|
|
Level addon;
|
|
|
|
@Mock
|
|
|
|
private BentoBox plugin;
|
|
|
|
@Mock
|
|
|
|
private Settings pluginSettings;
|
|
|
|
|
|
|
|
|
|
|
|
// Class under test
|
|
|
|
private LevelsManager lm;
|
|
|
|
@Mock
|
|
|
|
private Island island;
|
|
|
|
@Mock
|
|
|
|
private Pipeliner pipeliner;
|
|
|
|
private CompletableFuture<Results> cf;
|
|
|
|
private UUID uuid;
|
|
|
|
@Mock
|
|
|
|
private World world;
|
|
|
|
@Mock
|
|
|
|
private Player player;
|
|
|
|
@Mock
|
|
|
|
private ConfigSettings settings;
|
|
|
|
@Mock
|
|
|
|
private User user;
|
|
|
|
@Mock
|
|
|
|
private PlayersManager pm;
|
|
|
|
@Mock
|
|
|
|
private Inventory inv;
|
|
|
|
@Mock
|
|
|
|
private IslandWorldManager iwm;
|
|
|
|
@Mock
|
|
|
|
private PluginManager pim;
|
|
|
|
@Mock
|
2020-07-26 23:40:17 +02:00
|
|
|
private IslandLevels levelsData;
|
2020-06-28 18:42:36 +02:00
|
|
|
@Mock
|
|
|
|
private IslandsManager im;
|
2020-09-12 17:05:04 +02:00
|
|
|
@Mock
|
|
|
|
private BukkitScheduler scheduler;
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@BeforeClass
|
|
|
|
public static void beforeClass() {
|
|
|
|
// This has to be done beforeClass otherwise the tests will interfere with each other
|
|
|
|
handler = mock(AbstractDatabaseHandler.class);
|
|
|
|
// Database
|
|
|
|
PowerMockito.mockStatic(DatabaseSetup.class);
|
|
|
|
DatabaseSetup dbSetup = mock(DatabaseSetup.class);
|
|
|
|
when(DatabaseSetup.getDatabase()).thenReturn(dbSetup);
|
|
|
|
when(dbSetup.getHandler(any())).thenReturn(handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws java.lang.Exception
|
|
|
|
*/
|
2020-07-26 23:40:17 +02:00
|
|
|
@SuppressWarnings("unchecked")
|
2020-06-22 02:54:51 +02:00
|
|
|
@Before
|
|
|
|
public void setUp() throws Exception {
|
|
|
|
when(addon.getPlugin()).thenReturn(plugin);
|
|
|
|
// Set up plugin
|
|
|
|
Whitebox.setInternalState(BentoBox.class, "instance", plugin);
|
|
|
|
|
|
|
|
// Bukkit
|
2020-09-12 17:05:04 +02:00
|
|
|
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
|
2020-06-22 02:54:51 +02:00
|
|
|
when(Bukkit.getWorld(anyString())).thenReturn(world);
|
|
|
|
when(Bukkit.getPluginManager()).thenReturn(pim);
|
|
|
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
2020-09-12 17:05:04 +02:00
|
|
|
when(Bukkit.getScheduler()).thenReturn(scheduler);
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
// The database type has to be created one line before the thenReturn() to work!
|
|
|
|
DatabaseType value = DatabaseType.JSON;
|
|
|
|
when(plugin.getSettings()).thenReturn(pluginSettings);
|
|
|
|
when(pluginSettings.getDatabaseType()).thenReturn(value);
|
|
|
|
|
|
|
|
// Pipeliner
|
|
|
|
when(addon.getPipeliner()).thenReturn(pipeliner);
|
|
|
|
cf = new CompletableFuture<>();
|
|
|
|
when(pipeliner.addIsland(any())).thenReturn(cf);
|
|
|
|
|
|
|
|
// Island
|
2020-06-28 18:42:36 +02:00
|
|
|
when(addon.getIslands()).thenReturn(im);
|
2020-06-22 02:54:51 +02:00
|
|
|
uuid = UUID.randomUUID();
|
|
|
|
ImmutableSet<UUID> iset = ImmutableSet.of(uuid);
|
|
|
|
when(island.getMemberSet()).thenReturn(iset);
|
|
|
|
when(island.getOwner()).thenReturn(uuid);
|
|
|
|
when(island.getWorld()).thenReturn(world);
|
2020-07-26 23:40:17 +02:00
|
|
|
when(island.getUniqueId()).thenReturn(UUID.randomUUID().toString());
|
2020-07-03 03:19:26 +02:00
|
|
|
// Default to uuid's being island owners
|
|
|
|
when(im.isOwner(eq(world), any())).thenReturn(true);
|
|
|
|
when(im.getOwner(any(), any(UUID.class))).thenAnswer(in -> in.getArgument(1, UUID.class));
|
Version 2.10.0 (#283)
* Version 2.7.1
* Version 2.7.2
* Use Java 9's takeWhile
* Added placeholder %Level_[gamemode]_rank_value
Fixes https://github.com/BentoBoxWorld/Level/issues/228
* No save on disable (#231)
* Release 2.6.4
* Remove saving to database on disable.
https://github.com/BentoBoxWorld/Level/issues/229
First, the top ten tables are never actually used or loaded. They are
created in memory by loading the island levels. So there is no reason to
keep saving them.
Second, the island level data is saved every time it is changed, so
there is no need to save all of the cache on exit.
* Fixes tests
* Rosestacker (#232)
* Add support for RoseStacker 1.3.0
* Made plugin a Pladdon.
* Version 2.8.0
* Added new placeholders
%Level_%gamemode%_top_island_name_%rank% - lists the island name
%Level_%gamemode%_top_island_members_%rank% - a comma separated list of
team members
https://github.com/BentoBoxWorld/Level/issues/224
https://github.com/BentoBoxWorld/Level/issues/211
https://github.com/BentoBoxWorld/Level/issues/132
https://github.com/BentoBoxWorld/Level/issues/107
https://github.com/BentoBoxWorld/Level/issues/105
* Update to BentoBox API 1.18
* Open up modules for testing access.
* Back support for BentoBox 1.16.5.
* Version 2.8.1
* Speeds up level calculation by doing more chunk scans async.
If chests are scanned, then it will take longer because these have to be
done sync.
https://github.com/BentoBoxWorld/Level/issues/243
* add Vietnamese (#240)
* Raw island level placeholder (#241)
* Changed IslandLevelCalculator minHeight to world minHeight for negative blocks height support since 1.18. (#246)
* Version 2.9.0
* Chinese Translation (#249)
* Translate zh-CN.yml via GitLocalize
* Translate zh-CN.yml via GitLocalize
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: 织梦 <493733933@qq.com>
* Translate id.yml via GitLocalize (#250)
Co-authored-by: Nathan Adhitya <nathanadhitya@outlook.com>
* Translate fr.yml via GitLocalize (#251)
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
* Korean translation (#252)
* Translate ko.yml via GitLocalize
* Translate ko.yml via GitLocalize
Co-authored-by: chickiyeah <ruddls030@naver.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
* German Translation (#253)
* Translate de.yml via GitLocalize
* Update de.yml
Co-authored-by: Rikamo045 <rik.amos.krajinovic@gmail.com>
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
* Translate hu.yml via GitLocalize (#254)
Co-authored-by: András Marczinkó <marczinkoandris@gmail.com>
* Version 2.9.1
* Attempt to handle WildStacker spawners
* Fix error lon loading id locale
* Avoid async chunk snapshotting.
Fixes https://github.com/BentoBoxWorld/Level/issues/256
* Update to BentoBox API 1.20.
Replace plugin.yml with spigot-annotations.
Implement customizable TopLevelPanel.
* Fixes some small issues with TopLevelPanel
Add Utils class that contains some useful things.
* Implement customizable DetailsPanel.
Remove old DetailsGUITab due to new implementation.
* Fix failing test.
* Remove blank file
* Added repo for maven plugin snapshots
* Implement feature that allows to sort items in detail panel. (#259)
Apparently, because it is 2 years old request, it got in a state -> implement or drop.
Fixes #192
* Implement calculated value for blocks. (#260)
It is ~ value, as calculation formula cannot be applied per block. At least I think so.
Part of #192
* Update es.yml (#261)
* Implement customizable Values GUI. (#262)
This GUI shows value to all items in game. It also shows max limit of blocks, if it is set.
Fixes of #192
* Support for AdvancedChests was updated. (#266)
* Implements visit/warp actions in top gui
Add 2 new actions for island buttons in TOP GUI:
- Visit -> allows to visit island, but it requires Visit Addon
- Warp -> allows to warp to island, but it requires Warp Addon
Requested via Discord.
* Fixes a Level addon crash on startup.
Level addon crashed at the startup if Visit or Warps addon were not installed. It happened because Level addon main class were implementing Listener interface.
To avoid it and fix the crash, I moved migration listener to a separate class.
Fixes #2012
* Translate pl.yml via GitLocalize (#269)
Co-authored-by: wiktorm12 <wiktorm12@gmail.com>
* Translate fr.yml via GitLocalize (#272)
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
* Update to Java 17
* Update Github workflow to Java 17
* Adds %Level_[gamemode]_island_level_max% placeholder
This records the lifetime maximum level the island has ever had.
Addresses #271
* Only shows Members or higher in the top members placeholder
Fixes #267
* Add natural log to level-calc formula parsing
Relates to #274
* feat: add island total points + placeholder (#264)
* feat: add island total points + placeholder
* Update IslandLevels.java
* Fix JavaDoc
* Translate zh-CN.yml via GitLocalize (#276)
Co-authored-by: dawnTak <lanlongxiaode@outlook.com>
* Translate nl.yml via GitLocalize (#277)
Co-authored-by: DevSolaris <solaris.dev.2002@gmail.com>
* Add ${argLine} to get jacoco coverage
* Updated Jacoco POM
* Add shulker to in chest count (#275)
* Sonar Cloud code smell clean up (#278)
* Refactor placeholders (#279)
* Update ReadMe
* Fix Jacoco
* Remove unused imports
* Remove placeholders from main class
Created a separate class for cleaner code and added a test class.
* Remove dependency
* Add UltimateStacker hook for stacked blocks (#281)
* Create plugin.yml (#282)
* Create plugin.yml
The annotations do not provide the option to define the version dynamically from maven. This should fix that.
* Remove Spigot Plugin Annotations
* Remove plugin-annotation repo
* Updated dependencies
---------
Co-authored-by: Huynh Tien <huynhqtienvtag@gmail.com>
Co-authored-by: Rubén <44579213+Rubenicos@users.noreply.github.com>
Co-authored-by: Pierre Dedrie <Pirgosth74@gmail.com>
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: 织梦 <493733933@qq.com>
Co-authored-by: Nathan Adhitya <nathanadhitya@outlook.com>
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
Co-authored-by: chickiyeah <ruddls030@naver.com>
Co-authored-by: Rikamo045 <rik.amos.krajinovic@gmail.com>
Co-authored-by: András Marczinkó <marczinkoandris@gmail.com>
Co-authored-by: BONNe <bonne@bonne.id.lv>
Co-authored-by: KrazyxWolf <68208993+KrazyxWolf@users.noreply.github.com>
Co-authored-by: DeadSilenceIV <Barreto-h2@hotmail.com>
Co-authored-by: wiktorm12 <wiktorm12@gmail.com>
Co-authored-by: evlad <emmanuelvlad@gmail.com>
Co-authored-by: dawnTak <lanlongxiaode@outlook.com>
Co-authored-by: DevSolaris <solaris.dev.2002@gmail.com>
Co-authored-by: DevSolaris <105156235+DevSolaris@users.noreply.github.com>
Co-authored-by: ceze88 <dev.ceze@gmail.com>
2023-04-16 01:44:33 +02:00
|
|
|
when(im.getIsland(world, uuid)).thenReturn(island);
|
2020-09-12 17:05:04 +02:00
|
|
|
when(im.getIslandById(anyString())).thenReturn(Optional.of(island));
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
// Player
|
|
|
|
when(player.getUniqueId()).thenReturn(uuid);
|
|
|
|
when(player.hasPermission(anyString())).thenReturn(true);
|
|
|
|
|
|
|
|
// World
|
|
|
|
when(world.getName()).thenReturn("bskyblock-world");
|
|
|
|
|
|
|
|
// Settings
|
|
|
|
when(addon.getSettings()).thenReturn(settings);
|
|
|
|
|
|
|
|
// User
|
|
|
|
when(user.getTranslation(anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
|
|
|
when(user.getTranslation(eq("island.top.gui-heading"), eq("[name]"), anyString(), eq("[rank]"), anyString())).thenReturn("gui-heading");
|
|
|
|
when(user.getTranslation(eq("island.top.island-level"),eq("[level]"), anyString())).thenReturn("island-level");
|
|
|
|
when(user.getPlayer()).thenReturn(player);
|
|
|
|
|
|
|
|
// Player Manager
|
|
|
|
when(addon.getPlayers()).thenReturn(pm);
|
|
|
|
when(pm.getName(any())).thenReturn("player1",
|
|
|
|
"player2",
|
|
|
|
"player3",
|
|
|
|
"player4",
|
|
|
|
"player5",
|
|
|
|
"player6",
|
|
|
|
"player7",
|
|
|
|
"player8",
|
|
|
|
"player9",
|
|
|
|
"player10"
|
|
|
|
);
|
|
|
|
// Mock item factory (for itemstacks)
|
|
|
|
ItemFactory itemFactory = mock(ItemFactory.class);
|
|
|
|
when(Bukkit.getItemFactory()).thenReturn(itemFactory);
|
|
|
|
ItemMeta itemMeta = mock(ItemMeta.class);
|
|
|
|
when(itemFactory.getItemMeta(any())).thenReturn(itemMeta);
|
|
|
|
|
|
|
|
// Has perms
|
|
|
|
when(player.hasPermission(anyString())).thenReturn(true);
|
2020-09-12 17:05:04 +02:00
|
|
|
// Make island levels
|
|
|
|
|
|
|
|
List<Object> islands = new ArrayList<>();
|
2020-06-22 02:54:51 +02:00
|
|
|
for (long i = -5; i < 5; i ++) {
|
2020-09-12 17:05:04 +02:00
|
|
|
IslandLevels il = new IslandLevels(UUID.randomUUID().toString());
|
|
|
|
il.setInitialLevel(3);
|
|
|
|
il.setLevel(i);
|
|
|
|
il.setPointsToNextLevel(3);
|
|
|
|
islands.add(il);
|
2020-06-22 02:54:51 +02:00
|
|
|
}
|
2020-09-12 17:05:04 +02:00
|
|
|
// Supply no island levels first (for migrate), then islands
|
|
|
|
when(handler.loadObjects()).thenReturn(Collections.emptyList(), islands);
|
2020-06-22 02:54:51 +02:00
|
|
|
when(handler.objectExists(anyString())).thenReturn(true);
|
2020-07-26 23:40:17 +02:00
|
|
|
when(levelsData.getLevel()).thenReturn(-5L, -4L, -3L, -2L, -1L, 0L, 1L, 2L, 3L, 4L, 5L, 45678L);
|
2020-06-22 02:54:51 +02:00
|
|
|
when(levelsData.getUniqueId()).thenReturn(uuid.toString());
|
|
|
|
when(handler.loadObject(anyString())).thenReturn(levelsData );
|
|
|
|
|
|
|
|
|
|
|
|
// Inventory GUI
|
|
|
|
when(Bukkit.createInventory(any(), anyInt(), anyString())).thenReturn(inv);
|
|
|
|
|
|
|
|
// IWM
|
|
|
|
when(plugin.getIWM()).thenReturn(iwm);
|
|
|
|
when(iwm.getPermissionPrefix(any())).thenReturn("bskyblock.");
|
|
|
|
|
|
|
|
lm = new LevelsManager(addon);
|
2020-07-26 23:40:17 +02:00
|
|
|
lm.migrate();
|
2020-06-22 02:54:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws java.lang.Exception
|
|
|
|
*/
|
|
|
|
@After
|
|
|
|
public void tearDown() throws Exception {
|
|
|
|
deleteAll(new File("database"));
|
|
|
|
User.clearUsers();
|
|
|
|
Mockito.framework().clearInlineMocks();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void deleteAll(File file) throws IOException {
|
|
|
|
if (file.exists()) {
|
|
|
|
Files.walk(file.toPath())
|
|
|
|
.sorted(Comparator.reverseOrder())
|
|
|
|
.map(Path::toFile)
|
|
|
|
.forEach(File::delete);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#calculateLevel(UUID, world.bentobox.bentobox.database.objects.Island)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testCalculateLevel() {
|
|
|
|
Results results = new Results();
|
|
|
|
results.setLevel(10000);
|
|
|
|
results.setInitialLevel(3);
|
|
|
|
lm.calculateLevel(uuid, island);
|
2020-08-22 01:21:02 +02:00
|
|
|
// Complete the pipelined completable future
|
2020-06-22 02:54:51 +02:00
|
|
|
cf.complete(results);
|
|
|
|
|
2020-07-26 23:40:17 +02:00
|
|
|
assertEquals(10000L, lm.getLevelsData(island).getLevel());
|
2020-06-22 02:54:51 +02:00
|
|
|
//Map<UUID, Long> tt = lm.getTopTen(world, 10);
|
|
|
|
//assertEquals(1, tt.size());
|
|
|
|
//assertTrue(tt.get(uuid) == 10000);
|
Version 2.10.0 (#283)
* Version 2.7.1
* Version 2.7.2
* Use Java 9's takeWhile
* Added placeholder %Level_[gamemode]_rank_value
Fixes https://github.com/BentoBoxWorld/Level/issues/228
* No save on disable (#231)
* Release 2.6.4
* Remove saving to database on disable.
https://github.com/BentoBoxWorld/Level/issues/229
First, the top ten tables are never actually used or loaded. They are
created in memory by loading the island levels. So there is no reason to
keep saving them.
Second, the island level data is saved every time it is changed, so
there is no need to save all of the cache on exit.
* Fixes tests
* Rosestacker (#232)
* Add support for RoseStacker 1.3.0
* Made plugin a Pladdon.
* Version 2.8.0
* Added new placeholders
%Level_%gamemode%_top_island_name_%rank% - lists the island name
%Level_%gamemode%_top_island_members_%rank% - a comma separated list of
team members
https://github.com/BentoBoxWorld/Level/issues/224
https://github.com/BentoBoxWorld/Level/issues/211
https://github.com/BentoBoxWorld/Level/issues/132
https://github.com/BentoBoxWorld/Level/issues/107
https://github.com/BentoBoxWorld/Level/issues/105
* Update to BentoBox API 1.18
* Open up modules for testing access.
* Back support for BentoBox 1.16.5.
* Version 2.8.1
* Speeds up level calculation by doing more chunk scans async.
If chests are scanned, then it will take longer because these have to be
done sync.
https://github.com/BentoBoxWorld/Level/issues/243
* add Vietnamese (#240)
* Raw island level placeholder (#241)
* Changed IslandLevelCalculator minHeight to world minHeight for negative blocks height support since 1.18. (#246)
* Version 2.9.0
* Chinese Translation (#249)
* Translate zh-CN.yml via GitLocalize
* Translate zh-CN.yml via GitLocalize
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: 织梦 <493733933@qq.com>
* Translate id.yml via GitLocalize (#250)
Co-authored-by: Nathan Adhitya <nathanadhitya@outlook.com>
* Translate fr.yml via GitLocalize (#251)
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
* Korean translation (#252)
* Translate ko.yml via GitLocalize
* Translate ko.yml via GitLocalize
Co-authored-by: chickiyeah <ruddls030@naver.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
* German Translation (#253)
* Translate de.yml via GitLocalize
* Update de.yml
Co-authored-by: Rikamo045 <rik.amos.krajinovic@gmail.com>
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
* Translate hu.yml via GitLocalize (#254)
Co-authored-by: András Marczinkó <marczinkoandris@gmail.com>
* Version 2.9.1
* Attempt to handle WildStacker spawners
* Fix error lon loading id locale
* Avoid async chunk snapshotting.
Fixes https://github.com/BentoBoxWorld/Level/issues/256
* Update to BentoBox API 1.20.
Replace plugin.yml with spigot-annotations.
Implement customizable TopLevelPanel.
* Fixes some small issues with TopLevelPanel
Add Utils class that contains some useful things.
* Implement customizable DetailsPanel.
Remove old DetailsGUITab due to new implementation.
* Fix failing test.
* Remove blank file
* Added repo for maven plugin snapshots
* Implement feature that allows to sort items in detail panel. (#259)
Apparently, because it is 2 years old request, it got in a state -> implement or drop.
Fixes #192
* Implement calculated value for blocks. (#260)
It is ~ value, as calculation formula cannot be applied per block. At least I think so.
Part of #192
* Update es.yml (#261)
* Implement customizable Values GUI. (#262)
This GUI shows value to all items in game. It also shows max limit of blocks, if it is set.
Fixes of #192
* Support for AdvancedChests was updated. (#266)
* Implements visit/warp actions in top gui
Add 2 new actions for island buttons in TOP GUI:
- Visit -> allows to visit island, but it requires Visit Addon
- Warp -> allows to warp to island, but it requires Warp Addon
Requested via Discord.
* Fixes a Level addon crash on startup.
Level addon crashed at the startup if Visit or Warps addon were not installed. It happened because Level addon main class were implementing Listener interface.
To avoid it and fix the crash, I moved migration listener to a separate class.
Fixes #2012
* Translate pl.yml via GitLocalize (#269)
Co-authored-by: wiktorm12 <wiktorm12@gmail.com>
* Translate fr.yml via GitLocalize (#272)
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
* Update to Java 17
* Update Github workflow to Java 17
* Adds %Level_[gamemode]_island_level_max% placeholder
This records the lifetime maximum level the island has ever had.
Addresses #271
* Only shows Members or higher in the top members placeholder
Fixes #267
* Add natural log to level-calc formula parsing
Relates to #274
* feat: add island total points + placeholder (#264)
* feat: add island total points + placeholder
* Update IslandLevels.java
* Fix JavaDoc
* Translate zh-CN.yml via GitLocalize (#276)
Co-authored-by: dawnTak <lanlongxiaode@outlook.com>
* Translate nl.yml via GitLocalize (#277)
Co-authored-by: DevSolaris <solaris.dev.2002@gmail.com>
* Add ${argLine} to get jacoco coverage
* Updated Jacoco POM
* Add shulker to in chest count (#275)
* Sonar Cloud code smell clean up (#278)
* Refactor placeholders (#279)
* Update ReadMe
* Fix Jacoco
* Remove unused imports
* Remove placeholders from main class
Created a separate class for cleaner code and added a test class.
* Remove dependency
* Add UltimateStacker hook for stacked blocks (#281)
* Create plugin.yml (#282)
* Create plugin.yml
The annotations do not provide the option to define the version dynamically from maven. This should fix that.
* Remove Spigot Plugin Annotations
* Remove plugin-annotation repo
* Updated dependencies
---------
Co-authored-by: Huynh Tien <huynhqtienvtag@gmail.com>
Co-authored-by: Rubén <44579213+Rubenicos@users.noreply.github.com>
Co-authored-by: Pierre Dedrie <Pirgosth74@gmail.com>
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: 织梦 <493733933@qq.com>
Co-authored-by: Nathan Adhitya <nathanadhitya@outlook.com>
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
Co-authored-by: chickiyeah <ruddls030@naver.com>
Co-authored-by: Rikamo045 <rik.amos.krajinovic@gmail.com>
Co-authored-by: András Marczinkó <marczinkoandris@gmail.com>
Co-authored-by: BONNe <bonne@bonne.id.lv>
Co-authored-by: KrazyxWolf <68208993+KrazyxWolf@users.noreply.github.com>
Co-authored-by: DeadSilenceIV <Barreto-h2@hotmail.com>
Co-authored-by: wiktorm12 <wiktorm12@gmail.com>
Co-authored-by: evlad <emmanuelvlad@gmail.com>
Co-authored-by: dawnTak <lanlongxiaode@outlook.com>
Co-authored-by: DevSolaris <solaris.dev.2002@gmail.com>
Co-authored-by: DevSolaris <105156235+DevSolaris@users.noreply.github.com>
Co-authored-by: ceze88 <dev.ceze@gmail.com>
2023-04-16 01:44:33 +02:00
|
|
|
assertEquals(10000L, lm.getIslandMaxLevel(world, uuid));
|
|
|
|
|
|
|
|
results.setLevel(5000);
|
|
|
|
lm.calculateLevel(uuid, island);
|
|
|
|
// Complete the pipelined completable future
|
|
|
|
cf.complete(results);
|
|
|
|
assertEquals(5000L, lm.getLevelsData(island).getLevel());
|
|
|
|
// Still should be 10000
|
|
|
|
assertEquals(10000L, lm.getIslandMaxLevel(world, uuid));
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getInitialLevel(world.bentobox.bentobox.database.objects.Island)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetInitialLevel() {
|
|
|
|
assertEquals(0,lm.getInitialLevel(island));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getIslandLevel(org.bukkit.World, java.util.UUID)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetIslandLevel() {
|
|
|
|
assertEquals(-5, lm.getIslandLevel(world, uuid));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getPointsToNextString(org.bukkit.World, java.util.UUID)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetPointsToNextString() {
|
2020-07-26 23:40:17 +02:00
|
|
|
// No island player
|
|
|
|
assertEquals("", lm.getPointsToNextString(world, UUID.randomUUID()));
|
|
|
|
// Player has island
|
2020-06-22 02:54:51 +02:00
|
|
|
assertEquals("0", lm.getPointsToNextString(world, uuid));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getIslandLevelString(org.bukkit.World, java.util.UUID)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetIslandLevelString() {
|
|
|
|
assertEquals("-5", lm.getIslandLevelString(world, uuid));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getLevelsData(java.util.UUID)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetLevelsData() {
|
2020-07-26 23:40:17 +02:00
|
|
|
assertEquals(levelsData, lm.getLevelsData(island));
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#formatLevel(long)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testFormatLevel() {
|
|
|
|
assertEquals("123456789", lm.formatLevel(123456789L));
|
|
|
|
when(settings.isShorthand()).thenReturn(true);
|
|
|
|
assertEquals("123.5M", lm.formatLevel(123456789L));
|
|
|
|
assertEquals("1.2k", lm.formatLevel(1234L));
|
|
|
|
assertEquals("123.5G", lm.formatLevel(123456789352L));
|
|
|
|
assertEquals("1.2T", lm.formatLevel(1234567893524L));
|
|
|
|
assertEquals("12345.7T", lm.formatLevel(12345678345345349L));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getTopTen(org.bukkit.World, int)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetTopTenEmpty() {
|
2021-05-02 16:54:28 +02:00
|
|
|
Map<UUID, Long> tt = lm.getTopTen(world, Level.TEN);
|
2020-06-22 02:54:51 +02:00
|
|
|
assertTrue(tt.isEmpty());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getTopTen(org.bukkit.World, int)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetTopTen() {
|
|
|
|
testLoadTopTens();
|
2021-05-02 16:54:28 +02:00
|
|
|
Map<UUID, Long> tt = lm.getTopTen(world, Level.TEN);
|
2020-06-22 02:54:51 +02:00
|
|
|
assertFalse(tt.isEmpty());
|
2020-09-12 17:05:04 +02:00
|
|
|
assertEquals(1, tt.size());
|
2020-06-22 02:54:51 +02:00
|
|
|
assertEquals(1, lm.getTopTen(world, 1).size());
|
|
|
|
}
|
|
|
|
|
2020-07-03 03:19:26 +02:00
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getTopTen(org.bukkit.World, int)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetTopTenNoOwners() {
|
|
|
|
when(im.isOwner(eq(world), any())).thenReturn(false);
|
|
|
|
testLoadTopTens();
|
2021-05-02 16:54:28 +02:00
|
|
|
Map<UUID, Long> tt = lm.getTopTen(world, Level.TEN);
|
2020-07-03 03:19:26 +02:00
|
|
|
assertTrue(tt.isEmpty());
|
|
|
|
}
|
|
|
|
|
2020-06-22 02:54:51 +02:00
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#hasTopTenPerm(org.bukkit.World, java.util.UUID)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testHasTopTenPerm() {
|
|
|
|
assertTrue(lm.hasTopTenPerm(world, uuid));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#loadTopTens()}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testLoadTopTens() {
|
2020-09-12 17:05:04 +02:00
|
|
|
ArgumentCaptor<Runnable> task = ArgumentCaptor.forClass(Runnable.class);
|
2020-06-22 02:54:51 +02:00
|
|
|
lm.loadTopTens();
|
|
|
|
PowerMockito.verifyStatic(Bukkit.class); // 1
|
2020-09-12 17:05:04 +02:00
|
|
|
Bukkit.getScheduler();
|
|
|
|
verify(scheduler).runTaskAsynchronously(eq(plugin), task.capture());
|
|
|
|
task.getValue().run();
|
Version 2.10.0 (#283)
* Version 2.7.1
* Version 2.7.2
* Use Java 9's takeWhile
* Added placeholder %Level_[gamemode]_rank_value
Fixes https://github.com/BentoBoxWorld/Level/issues/228
* No save on disable (#231)
* Release 2.6.4
* Remove saving to database on disable.
https://github.com/BentoBoxWorld/Level/issues/229
First, the top ten tables are never actually used or loaded. They are
created in memory by loading the island levels. So there is no reason to
keep saving them.
Second, the island level data is saved every time it is changed, so
there is no need to save all of the cache on exit.
* Fixes tests
* Rosestacker (#232)
* Add support for RoseStacker 1.3.0
* Made plugin a Pladdon.
* Version 2.8.0
* Added new placeholders
%Level_%gamemode%_top_island_name_%rank% - lists the island name
%Level_%gamemode%_top_island_members_%rank% - a comma separated list of
team members
https://github.com/BentoBoxWorld/Level/issues/224
https://github.com/BentoBoxWorld/Level/issues/211
https://github.com/BentoBoxWorld/Level/issues/132
https://github.com/BentoBoxWorld/Level/issues/107
https://github.com/BentoBoxWorld/Level/issues/105
* Update to BentoBox API 1.18
* Open up modules for testing access.
* Back support for BentoBox 1.16.5.
* Version 2.8.1
* Speeds up level calculation by doing more chunk scans async.
If chests are scanned, then it will take longer because these have to be
done sync.
https://github.com/BentoBoxWorld/Level/issues/243
* add Vietnamese (#240)
* Raw island level placeholder (#241)
* Changed IslandLevelCalculator minHeight to world minHeight for negative blocks height support since 1.18. (#246)
* Version 2.9.0
* Chinese Translation (#249)
* Translate zh-CN.yml via GitLocalize
* Translate zh-CN.yml via GitLocalize
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: 织梦 <493733933@qq.com>
* Translate id.yml via GitLocalize (#250)
Co-authored-by: Nathan Adhitya <nathanadhitya@outlook.com>
* Translate fr.yml via GitLocalize (#251)
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
* Korean translation (#252)
* Translate ko.yml via GitLocalize
* Translate ko.yml via GitLocalize
Co-authored-by: chickiyeah <ruddls030@naver.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
* German Translation (#253)
* Translate de.yml via GitLocalize
* Update de.yml
Co-authored-by: Rikamo045 <rik.amos.krajinovic@gmail.com>
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
* Translate hu.yml via GitLocalize (#254)
Co-authored-by: András Marczinkó <marczinkoandris@gmail.com>
* Version 2.9.1
* Attempt to handle WildStacker spawners
* Fix error lon loading id locale
* Avoid async chunk snapshotting.
Fixes https://github.com/BentoBoxWorld/Level/issues/256
* Update to BentoBox API 1.20.
Replace plugin.yml with spigot-annotations.
Implement customizable TopLevelPanel.
* Fixes some small issues with TopLevelPanel
Add Utils class that contains some useful things.
* Implement customizable DetailsPanel.
Remove old DetailsGUITab due to new implementation.
* Fix failing test.
* Remove blank file
* Added repo for maven plugin snapshots
* Implement feature that allows to sort items in detail panel. (#259)
Apparently, because it is 2 years old request, it got in a state -> implement or drop.
Fixes #192
* Implement calculated value for blocks. (#260)
It is ~ value, as calculation formula cannot be applied per block. At least I think so.
Part of #192
* Update es.yml (#261)
* Implement customizable Values GUI. (#262)
This GUI shows value to all items in game. It also shows max limit of blocks, if it is set.
Fixes of #192
* Support for AdvancedChests was updated. (#266)
* Implements visit/warp actions in top gui
Add 2 new actions for island buttons in TOP GUI:
- Visit -> allows to visit island, but it requires Visit Addon
- Warp -> allows to warp to island, but it requires Warp Addon
Requested via Discord.
* Fixes a Level addon crash on startup.
Level addon crashed at the startup if Visit or Warps addon were not installed. It happened because Level addon main class were implementing Listener interface.
To avoid it and fix the crash, I moved migration listener to a separate class.
Fixes #2012
* Translate pl.yml via GitLocalize (#269)
Co-authored-by: wiktorm12 <wiktorm12@gmail.com>
* Translate fr.yml via GitLocalize (#272)
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
* Update to Java 17
* Update Github workflow to Java 17
* Adds %Level_[gamemode]_island_level_max% placeholder
This records the lifetime maximum level the island has ever had.
Addresses #271
* Only shows Members or higher in the top members placeholder
Fixes #267
* Add natural log to level-calc formula parsing
Relates to #274
* feat: add island total points + placeholder (#264)
* feat: add island total points + placeholder
* Update IslandLevels.java
* Fix JavaDoc
* Translate zh-CN.yml via GitLocalize (#276)
Co-authored-by: dawnTak <lanlongxiaode@outlook.com>
* Translate nl.yml via GitLocalize (#277)
Co-authored-by: DevSolaris <solaris.dev.2002@gmail.com>
* Add ${argLine} to get jacoco coverage
* Updated Jacoco POM
* Add shulker to in chest count (#275)
* Sonar Cloud code smell clean up (#278)
* Refactor placeholders (#279)
* Update ReadMe
* Fix Jacoco
* Remove unused imports
* Remove placeholders from main class
Created a separate class for cleaner code and added a test class.
* Remove dependency
* Add UltimateStacker hook for stacked blocks (#281)
* Create plugin.yml (#282)
* Create plugin.yml
The annotations do not provide the option to define the version dynamically from maven. This should fix that.
* Remove Spigot Plugin Annotations
* Remove plugin-annotation repo
* Updated dependencies
---------
Co-authored-by: Huynh Tien <huynhqtienvtag@gmail.com>
Co-authored-by: Rubén <44579213+Rubenicos@users.noreply.github.com>
Co-authored-by: Pierre Dedrie <Pirgosth74@gmail.com>
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
Co-authored-by: 织梦 <493733933@qq.com>
Co-authored-by: Nathan Adhitya <nathanadhitya@outlook.com>
Co-authored-by: organizatsiya <organizatsiya.wildguns@gmail.com>
Co-authored-by: chickiyeah <ruddls030@naver.com>
Co-authored-by: Rikamo045 <rik.amos.krajinovic@gmail.com>
Co-authored-by: András Marczinkó <marczinkoandris@gmail.com>
Co-authored-by: BONNe <bonne@bonne.id.lv>
Co-authored-by: KrazyxWolf <68208993+KrazyxWolf@users.noreply.github.com>
Co-authored-by: DeadSilenceIV <Barreto-h2@hotmail.com>
Co-authored-by: wiktorm12 <wiktorm12@gmail.com>
Co-authored-by: evlad <emmanuelvlad@gmail.com>
Co-authored-by: dawnTak <lanlongxiaode@outlook.com>
Co-authored-by: DevSolaris <solaris.dev.2002@gmail.com>
Co-authored-by: DevSolaris <105156235+DevSolaris@users.noreply.github.com>
Co-authored-by: ceze88 <dev.ceze@gmail.com>
2023-04-16 01:44:33 +02:00
|
|
|
verify(addon).log("Generating rankings");
|
|
|
|
verify(addon).log("Generated rankings for bskyblock-world");
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#removeEntry(org.bukkit.World, java.util.UUID)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testRemoveEntry() {
|
|
|
|
testLoadTopTens();
|
2021-05-02 16:54:28 +02:00
|
|
|
Map<UUID, Long> tt = lm.getTopTen(world, Level.TEN);
|
2020-06-22 02:54:51 +02:00
|
|
|
assertTrue(tt.containsKey(uuid));
|
|
|
|
lm.removeEntry(world, uuid);
|
2021-05-02 16:54:28 +02:00
|
|
|
tt = lm.getTopTen(world, Level.TEN);
|
2020-06-22 02:54:51 +02:00
|
|
|
assertFalse(tt.containsKey(uuid));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#setInitialIslandLevel(world.bentobox.bentobox.database.objects.Island, long)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testSetInitialIslandLevel() {
|
2021-05-02 16:54:28 +02:00
|
|
|
lm.setInitialIslandLevel(island, Level.TEN);
|
|
|
|
assertEquals(Level.TEN, lm.getInitialLevel(island));
|
2020-06-22 02:54:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#setIslandLevel(org.bukkit.World, java.util.UUID, long)}.
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testSetIslandLevel() {
|
|
|
|
lm.setIslandLevel(world, uuid, 1234);
|
|
|
|
assertEquals(1234, lm.getIslandLevel(world, uuid));
|
2020-07-03 03:19:26 +02:00
|
|
|
|
2020-06-22 02:54:51 +02:00
|
|
|
}
|
|
|
|
|
2021-05-02 16:54:28 +02:00
|
|
|
|
2021-02-28 18:33:11 +01:00
|
|
|
/**
|
|
|
|
* Test method for {@link world.bentobox.level.LevelsManager#getRank(World, UUID)}
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
public void testGetRank() {
|
|
|
|
lm.createAndCleanRankings(world);
|
|
|
|
Map<World, TopTenData> ttl = lm.getTopTenLists();
|
|
|
|
Map<UUID, Long> tt = ttl.get(world).getTopTen();
|
|
|
|
for (long i = 100; i < 150; i++) {
|
2021-05-02 16:54:28 +02:00
|
|
|
tt.put(UUID.randomUUID(), i);
|
2021-02-28 18:33:11 +01:00
|
|
|
}
|
|
|
|
// Put player as lowest rank
|
|
|
|
tt.put(uuid, 10L);
|
|
|
|
assertEquals(51, lm.getRank(world, uuid));
|
|
|
|
// Put player as highest rank
|
|
|
|
tt.put(uuid, 1000L);
|
|
|
|
assertEquals(1, lm.getRank(world, uuid));
|
|
|
|
// Unknown UUID - lowest rank + 1
|
|
|
|
assertEquals(52, lm.getRank(world, UUID.randomUUID()));
|
|
|
|
}
|
2020-06-22 02:54:51 +02:00
|
|
|
|
|
|
|
}
|