Add LogoutListener interface - allows a class to call some code on player logout - improved version of logout listeners.
Add StartupListener interface - allows a class to call some code on server startup without adding messy code elsewhere Add ShutdownListener interface - allows a class to call some code on server shutdown without adding messy code elsewhere Add TickListener interface - allows a class to call some code on each tick without adding messy code elsewhere Converted all applicable content over to using these new interfaces
This commit is contained in:
@@ -3,5 +3,10 @@ package api
|
||||
import core.game.node.entity.player.Player
|
||||
|
||||
interface LoginListener {
|
||||
/**
|
||||
* NOTE: This should NOT reference any non-static class-local variables.
|
||||
* If you need to access a player's specific instance, use an attribute.
|
||||
* Alternatively, consider using an [api.events.EventHook] if applicable.
|
||||
*/
|
||||
fun login(player: Player)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package api
|
||||
|
||||
import core.game.node.entity.player.Player
|
||||
|
||||
interface LogoutListener {
|
||||
/**
|
||||
* NOTE: This should NOT reference any non-static class-local variables.
|
||||
* If you need to access a player's specific instance, use an attribute.
|
||||
*/
|
||||
fun logout(player: Player)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package api
|
||||
|
||||
import rs09.game.system.SystemLogger
|
||||
|
||||
interface ShutdownListener {
|
||||
/**
|
||||
* NOTE: This should NOT reference nonstatic class-local variables.
|
||||
*/
|
||||
fun shutdown()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package api
|
||||
|
||||
import rs09.game.system.SystemLogger
|
||||
|
||||
interface StartupListener {
|
||||
/**
|
||||
* NOTE: This should NOT reference nonstatic class-local variables.
|
||||
*/
|
||||
fun startup()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package api
|
||||
|
||||
interface TickListener {
|
||||
/**
|
||||
* NOTE: This should NOT reference nonstatic class-local variables.
|
||||
* TickListeners are generally for NON-player, WORLD tick events.
|
||||
* Examples: Fishing spot rotation, grand exchange updates, puro puro randomization, etc.
|
||||
* If you need something (player/entity)-specific, use an [api.events.EventHook] with the [api.events.TickEvent]
|
||||
*/
|
||||
fun tick()
|
||||
}
|
||||
Reference in New Issue
Block a user