Skip to content

Commit

Permalink
Factor out the reload literal
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlgo committed Jul 15, 2022
1 parent 2822ca8 commit 35d1988
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.bukkit.command.TabCompleter
internal class DefaultCommandHandler(private val config: IConfig) : CommandExecutor, TabCompleter {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (args.size != 1) return false
if (!args[0].equals("reload", true)) return false
if (!args[0].equals(reloadLiteral, true)) return false
config.reload()
sender.sendMessage("${ChatColor.DARK_GREEN}Successfully Reloaded!")
return true
Expand All @@ -21,6 +21,10 @@ internal class DefaultCommandHandler(private val config: IConfig) : CommandExecu
): MutableList<String> {
if (args.size != 1) return mutableListOf()
if (!"reload".startsWith(args[0], true)) return mutableListOf()
return mutableListOf("reload")
return mutableListOf(reloadLiteral)
}

companion object {
private const val reloadLiteral = "reload"
}
}

0 comments on commit 35d1988

Please sign in to comment.