mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-12-24 18:17:41 +01:00
Fixes placeholders.
This commit is contained in:
parent
fe6ad81141
commit
a5abd10678
@ -282,6 +282,7 @@ public class Level extends Addon {
|
||||
}
|
||||
|
||||
private String getVisitedIslandLevel(GameModeAddon gm, User user) {
|
||||
if (!gm.inWorld(user.getLocation())) return "";
|
||||
return getIslands().getIslandAt(user.getLocation())
|
||||
.map(island -> getLevelPresenter().getLevelString(getIslandLevel(gm.getOverWorld(), island.getOwner())))
|
||||
.orElse("0");
|
||||
|
@ -53,6 +53,7 @@ public class TopTen implements Listener {
|
||||
World world = Bukkit.getWorld(tt.getUniqueId());
|
||||
if (world != null) {
|
||||
topTenList.put(world, tt);
|
||||
addon.log("Loaded TopTen for " + world.getName());
|
||||
} else {
|
||||
addon.logError("TopTen world " + tt.getUniqueId() + " is not known on server. Skipping...");
|
||||
}
|
||||
@ -156,8 +157,7 @@ public class TopTen implements Listener {
|
||||
*/
|
||||
@NonNull
|
||||
public TopTenData getTopTenList(World world) {
|
||||
topTenList.putIfAbsent(world, new TopTenData());
|
||||
return topTenList.get(world);
|
||||
return topTenList.computeIfAbsent(world, k -> new TopTenData());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ public class TopTenData implements DataObject {
|
||||
*/
|
||||
public long getTopTenLevel(int rank) {
|
||||
Map<UUID, Long> tt = getTopTen();
|
||||
return tt.size() < rank ? (long)tt.values().toArray()[(rank-1)] : 0;
|
||||
return rank <= tt.size() ? (long)tt.values().toArray()[(rank-1)] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ public class TopTenData implements DataObject {
|
||||
@Nullable
|
||||
public UUID getTopTenUUID(int rank) {
|
||||
Map<UUID, Long> tt = getTopTen();
|
||||
return tt.size() < rank ? (UUID)tt.keySet().toArray()[(rank-1)] : null;
|
||||
return rank <= tt.size() ? (UUID)tt.keySet().toArray()[(rank-1)] : null;
|
||||
}
|
||||
|
||||
public void setTopTen(Map<UUID, Long> topTen) {
|
||||
|
Loading…
Reference in New Issue
Block a user