kr.summitsystems.springbukkit.command.convert.support.PlayerCommandArgumentConverter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-bukkit-command Show documentation
Show all versions of spring-bukkit-command Show documentation
Springframework based Bukkit plugin development kit.
The newest version!
package kr.summitsystems.springbukkit.command.convert.support
import kr.summitsystems.springbukkit.command.CommandArgument
import kr.summitsystems.springbukkit.command.convert.CommandArgumentConverter
import org.bukkit.Server
import org.bukkit.entity.Player
class PlayerCommandArgumentConverter(private val server: Server) : CommandArgumentConverter {
override fun provideCompletes(): Collection {
return server.onlinePlayers.map { player ->
player.name
}
}
override fun convert(source: CommandArgument): Player {
val value = source.value
return server.onlinePlayers.single { player ->
player.name == value
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy