diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-08-02 10:58:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 10:58:16 +0200 |
commit | 0dd320def6e7cec44e360de1f098805402fd8936 (patch) | |
tree | 8d9cc651f9795b39178f39a090064c606d14293a /src/main/java | |
parent | 80f09d2de3b32935f8b6646353d807f037ba25bb (diff) | |
download | skyhanni-0dd320def6e7cec44e360de1f098805402fd8936.tar.gz skyhanni-0dd320def6e7cec44e360de1f098805402fd8936.tar.bz2 skyhanni-0dd320def6e7cec44e360de1f098805402fd8936.zip |
Fix: /shcommands empty page (#2287)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt index 9bd3afce4..4d4c5d341 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.chat.Text.style import at.hannibal2.skyhanni.utils.chat.Text.suggest import net.minecraft.util.EnumChatFormatting import net.minecraft.util.IChatComponent +import kotlin.math.ceil object HelpCommand { @@ -50,7 +51,7 @@ object HelpCommand { val filtered = commands.filter { it.name.contains(search, ignoreCase = true) || it.description.contains(search, ignoreCase = true) } - val maxPage = filtered.size / COMMANDS_PER_PAGE + 1 + val maxPage = ceil(filtered.size.toDouble() / COMMANDS_PER_PAGE).toInt() val page = page.coerceIn(1, maxPage) val title = if (search.isEmpty()) "§6SkyHanni Commands" else "§6SkyHanni Commands matching '$search'" |