New name for the level placeholder; added visited island level placeholder

Implements https://github.com/BentoBoxWorld/Level/issues/103
This commit is contained in:
Florian CUNY 2019-11-23 14:45:21 +01:00
parent 8181fbc431
commit 801bfe6a39
1 changed files with 15 additions and 1 deletions

View File

@ -26,7 +26,6 @@ import world.bentobox.level.placeholders.TopTenPlaceholder;
import world.bentobox.level.requests.LevelRequestHandler;
import world.bentobox.level.requests.TopTenRequestHandler;
/**
* Addon to BSkyBlock/AcidIsland that enables island level scoring and top ten functionality
* @author tastybento
@ -151,6 +150,21 @@ public class Level extends Addon {
getPlugin().getPlaceholdersManager().registerPlaceholder(this, gm.getDescription().getName().toLowerCase() + "-island-level-top-value-" + i, new TopTenPlaceholder(this, gm, i));
getPlugin().getPlaceholdersManager().registerPlaceholder(this, gm.getDescription().getName().toLowerCase() + "-island-level-top-name-" + i, new TopTenNamePlaceholder(this, gm, i));
}
// ---------------------
// Island Level
getPlugin().getPlaceholdersManager().registerPlaceholder(this,
gm.getDescription().getName().toLowerCase() + "_island_level",
user -> getLevelPresenter().getLevelString(getIslandLevel(gm.getOverWorld(), user.getUniqueId())));
// Visited Island Level
getPlugin().getPlaceholdersManager().registerPlaceholder(this,
gm.getDescription().getName().toLowerCase() + "_visited_island_level",
user -> getPlugin().getIslands().getIslandAt(user.getLocation())
.map(island -> getIslandLevel(gm.getOverWorld(), island.getOwner()))
.map(level -> getLevelPresenter().getLevelString(level))
.orElse("0"));
}
});