Skip to main content

Api

The NSG-API contains all interfaces.
These MUST have a default implementation in the Core

!!!!!! DISCLAIMER: ALWAYS PAY ATTENTION TO "val" AND "var" TO ENABLE MAKING THEM MODIFIABLE.!!!!!!

Normal Example#

Interface#

// File: PlayerPool.ktinterface PlayerPool {    fun getPlayer(uuid: UUID): NSGPlayer}

Player interface#

// File: NSGPlayer.ktinterface NSGPlayer {    val uuid: UUID    val coins: Int}

Generic Example + Implementation#

You can also use generics to make the implementation more flexible.

Interface#

// File: PlayerPool.ktinterface PlayerPool<T : NSGPlayer> {    //fun getPlayer(uuid: UUID): T // uncomment, docusaurus will not allow this}

Player interface#

// File: NSGPlayer.ktinterface NSGPlayer {    //val uuid: UUID // uncomment, docusaurus will not allow this    //val coins: Int // uncomment, docusaurus will not allow this}

Implementation#

// File: DefaultPlayerPool.ktclass DefaultPlayerPool : PlayerPool<DefaultNSGPlayer> {    override fun getPlayer(uuid: UUID): DefaultNSGPlayer {        TODO()    }}