Skip to content

Commit

Permalink
Merge pull request #4 from pie-flavor/master
Browse files Browse the repository at this point in the history
Continue to clean up mess
  • Loading branch information
ItsDoot authored Apr 15, 2019
2 parents 54964ee + 6294e8d commit ec3cdf5
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 223 deletions.
220 changes: 0 additions & 220 deletions src/main/kotlin/frontier/skc/CommandMappingParser.kt

This file was deleted.

11 changes: 10 additions & 1 deletion src/main/kotlin/frontier/skc/ParameterMapping.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package frontier.skc

import frontier.skc.util.ConstantNoUsageCommandElement
import org.spongepowered.api.command.args.CommandElement
import org.spongepowered.api.text.Text
import kotlin.reflect.KClass
import kotlin.reflect.KParameter

typealias ParameterMapping = (KParameter) -> ((Text) -> CommandElement)?
typealias ParameterMapping = (KParameter) -> ((Text) -> CommandElement)?

class ObjectInstanceParameterMapping(private val clazz: KClass<*>, private val instance: Any) : ParameterMapping {
override fun invoke(parameter: KParameter): ((Text) -> CommandElement)? = when (parameter.type.classifier) {
clazz -> { key -> ConstantNoUsageCommandElement(key, instance) }
else -> null
}
}
Loading

0 comments on commit ec3cdf5

Please sign in to comment.