-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
There is a operator fun called "invoke"
after simply adding
operator fun <T> T.invoke(block : T.() -> Unit) : T {
return this.apply(block)
}could achieve
player {
displayName = "name"
msg("message")
etc...
}sender {
msg("anything")
}event<PlayerMoveEvent> {
isCancelled = true
player {
msg("You can move yet")
etc...
}
}makes code cleaner, get rid of with(player) or player.apply { }
it works for anything after that three lines but might effect some classes that already have invoke fun
val component = ComponentBuilder()
component {
append("wow")
etc...
}it looks like the component in net.md_5.bungee.api.chat.ComponentBuilder having a dsl support but actually no
marazmarci
Metadata
Metadata
Assignees
Labels
No labels