9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-04 15:41:36 +00:00

Fixes to /skills top

This commit is contained in:
Auxilor
2023-05-14 17:26:12 +01:00
parent f687809d2e
commit 8432c4faf9
2 changed files with 9 additions and 3 deletions

View File

@@ -25,12 +25,18 @@ class CommandTop(plugin: EcoPlugin) :
val pageIndex = if (skill == null) 0 else 1
val page = args.getOrNull(pageIndex)?.toIntOrNull() ?: 1
if (skill == null && args.getOrNull(pageIndex)?.toIntOrNull() == null) {
if (
skill == null
&& args.getOrNull(pageIndex)?.toIntOrNull() == null
&& args.getOrNull(pageIndex)?.isBlank() == false
) {
sender.sendMessage(plugin.langYml.getMessage("invalid-skill"))
return
}
val positions = ((page)..(page + 9)).toList()
val offset = (page - 1) * 10
val positions = ((offset + page)..(offset + page + 9)).toList()
val top = if (skill == null) {
positions.mapNotNull { Skills.getTop(it) }

View File

@@ -22,7 +22,7 @@ learning-skill: "Learning New Skill..."
line-wrap-color: "&8"
top-line-format: "%rank%. %playername% - %level%"
top-line-format: "%rank%. %player% - %level%"
top:
format:
- "---- Skills Leaderboard ----"