Skip to content

Commit

Permalink
fix: 🐛 コマンド引数のサジェストがうまく機能しない不具合
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSheep2804 committed Jul 19, 2023
1 parent f3d71e9 commit 00add08
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class JapanizeCommand : ICommand {

override fun suggest(sender: SeleneChatPlayer, args: Array<String>): List<String> {
return when (args.size) {
1 -> listOf("on", "off")
1 -> listOf("on", "off").filter { it.startsWith(args[0]) || args[0] == "" }
else -> emptyList()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class MessageCommand : ICommand {

override fun suggest(sender: SeleneChatPlayer, args: Array<String>): List<String> {
return when (args.size) {
1 -> SeleneChat.plugin.getAllPlayers().map { it.displayName }
else -> listOf()
1 -> (SeleneChat.plugin.getAllPlayers().map { it.displayName }).filter { it.startsWith(args[0]) || args[0] == "" }
else -> emptyList()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ class SeleneChatCommand : ICommand {
}

override fun suggest(sender: SeleneChatPlayer, args: Array<String>): List<String> {
if (args.size == 1) {
return listOf("reload")
} else {
return emptyList()
return when (args.size) {
1 -> listOf("reload").filter { it.startsWith(args[0]) || args[0] == "" }
else -> emptyList()
}
}

Expand Down

0 comments on commit 00add08

Please sign in to comment.