aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt
index bf4428211..070ab478e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt
@@ -15,6 +15,24 @@ object PlayerTabComplete {
private val config get() = SkyHanniMod.feature.misc.commands.tabComplete
private var vipVisits = listOf<String>()
+ private val ignoredCommandCategories = mapOf(
+ "f" to listOf(PlayerCategory.FRIENDS),
+ "friend" to listOf(PlayerCategory.FRIENDS),
+
+ "msg" to listOf(),
+ "w" to listOf(),
+ "tell" to listOf(),
+ "boop" to listOf(),
+
+ "visit" to listOf(),
+ "invite" to listOf(),
+ "ah" to listOf(),
+
+ "pv" to listOf(), // NEU's Profile Viewer
+ "shmarkplayer" to listOf(), // SkyHanni's Mark Player
+
+ "trade" to listOf(PlayerCategory.FRIENDS, PlayerCategory.PARTY),
+ )
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
@@ -34,41 +52,21 @@ object PlayerTabComplete {
}
fun handleTabComplete(command: String): List<String>? {
- val commands = mapOf(
- "f" to listOf(PlayerCategory.FRIENDS),
- "friend" to listOf(PlayerCategory.FRIENDS),
-
- "msg" to listOf(),
- "w" to listOf(),
- "tell" to listOf(),
- "boop" to listOf(),
-
- "visit" to listOf(),
- "invite" to listOf(),
- "ah" to listOf(),
-
- "pv" to listOf(), // NEU's Profile Viewer
- "shmarkplayer" to listOf(), // SkyHanni's Mark Player
-
- "trade" to listOf(PlayerCategory.FRIENDS, PlayerCategory.PARTY)
- )
- val ignored = commands[command] ?: return null
+ val ignoredCategories = ignoredCommandCategories[command] ?: return null
return buildList {
- if (config.friends && PlayerCategory.FRIENDS !in ignored) {
- FriendAPI.getAllFriends()
- .filter { it.bestFriend || !config.onlyBestFriends }
- .forEach { add(it.name) }
+ if (config.friends && PlayerCategory.FRIENDS !in ignoredCategories) {
+ FriendAPI.getAllFriends().filter { it.bestFriend || !config.onlyBestFriends }.forEach { add(it.name) }
}
- if (config.islandPlayers && PlayerCategory.ISLAND_PLAYERS !in ignored) {
+ if (config.islandPlayers && PlayerCategory.ISLAND_PLAYERS !in ignoredCategories) {
for (entity in EntityUtils.getPlayerEntities()) {
add(entity.name)
}
}
- if (config.party && PlayerCategory.PARTY !in ignored) {
+ if (config.party && PlayerCategory.PARTY !in ignoredCategories) {
for (member in PartyAPI.partyMembers) {
add(member)
}