mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-03 06:12:21 +00:00
Added page number tab completion
This commit is contained in:
@@ -34,6 +34,17 @@ public class TabCompleteHelper {
|
||||
"10"
|
||||
);
|
||||
|
||||
/**
|
||||
* Numbers.
|
||||
*/
|
||||
public static final List<String> NUMBERS = Arrays.asList(
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5"
|
||||
);
|
||||
|
||||
/**
|
||||
* Update lists.
|
||||
*/
|
||||
|
||||
@@ -86,6 +86,15 @@ class CommandRank(plugin: EcoPlugin) :
|
||||
return@TabCompleteHandler completions
|
||||
}
|
||||
|
||||
if (args.size == 2) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[1],
|
||||
TabCompleteHelper.NUMBERS,
|
||||
completions
|
||||
)
|
||||
return@TabCompleteHandler completions
|
||||
}
|
||||
|
||||
return@TabCompleteHandler emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@ package com.willfp.ecoskills.commands
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.command.CommandHandler
|
||||
import com.willfp.eco.core.command.TabCompleteHandler
|
||||
import com.willfp.eco.core.command.impl.Subcommand
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.ecoskills.data.LeaderboardHandler
|
||||
import com.willfp.ecoskills.data.savedDisplayName
|
||||
import com.willfp.ecoskills.getTotalSkillLevel
|
||||
import com.willfp.ecoskills.util.TabCompleteHelper
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.util.StringUtil
|
||||
|
||||
|
||||
class CommandTop(plugin: EcoPlugin) :
|
||||
@@ -54,4 +57,21 @@ class CommandTop(plugin: EcoPlugin) :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTabCompleter(): TabCompleteHandler {
|
||||
return TabCompleteHandler { _, args ->
|
||||
val completions = mutableListOf<String>()
|
||||
|
||||
if (args.size == 1) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[0],
|
||||
TabCompleteHelper.NUMBERS,
|
||||
completions
|
||||
)
|
||||
return@TabCompleteHandler completions
|
||||
}
|
||||
|
||||
return@TabCompleteHandler emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user