Skip to content

Commit

Permalink
Fixed dynamic commands
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 31, 2023
1 parent 026bc55 commit ef922f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DelegatedBukkitCommand(
private val delegate: EcoPluginCommand
) : Command(delegate.name), TabCompleter, PluginIdentifiableCommand {
override fun execute(sender: CommandSender, label: String, args: Array<out String>?): Boolean {
return false
return delegate.onCommand(sender, this, label, args)
}

override fun onTabComplete(
Expand All @@ -18,7 +18,7 @@ class DelegatedBukkitCommand(
label: String,
args: Array<out String>?
): List<String> {
return mutableListOf() // Mutable in case bukkit requires this (I haven't checked.)
return delegate.onTabComplete(sender, this, label, args) ?: emptyList()
}

override fun getPlugin() = delegate.plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class EcoPluginCommand(
command.aliases = aliases
}
}

Eco.get().syncCommands()
}

override fun unregister() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ abstract class HandledCommand(
command: Command,
label: String,
args: Array<out String>?
): MutableList<String>? {
return handleTabComplete(sender, args?.toList() ?: listOf()).toMutableList()
): List<String>? {
return handleTabComplete(sender, args?.toList() ?: listOf())
}

override fun getPlugin() = this.plugin
Expand Down

0 comments on commit ef922f6

Please sign in to comment.