A pure, functional library for Minecraft development with Scala.
libraryDependencies += "io.typecraft" %% "ender" % "0.1.0"
circe..
import io.typecraft.ender.bukkit.implicits._
import io.circe.generic.auto._
class MyPlugin extends JavaPlugin with ScalaPlugin {
var myConfig: MyConfig = MyConfig.empty
override def onEnable(): Unit = {
// Type `MyConfig` will be auto mapped as yaml
myConfig = readConfig[MyConfig] ?: MyConfig.empty
}
}
- Range
- UUID
doobie..
val getCountry: IO[Option[Country]] =
sql"select * from country where id=$id"
.query[Country] // Type `Country` will be auto mapped
.option
.transact(conn)
- Range
- UUID
WIP
bukkit-view-scala
import io.typecraft.ender.bukkit.implicits._
class MyPlugin extends JavaPlugin with ScalaPlugin {
def asyncAndSleepThenSync: IO[Unit] =
for {
_ <- IO.blocking(println("Here is runTaskAsync!"))
_ <- IO.sleep(5.seconds)
_ <- IO(println("Here is runTask!"))
} yield ()
def runEveryFiveSeconds: IO[Unit] =
for {
_ <- IO(println("Do something..."))
_ <- IO.sleep(5.seconds)
_ <- repeat // recursive
} yield ()
}