From 8ef1e296e9c0d2a0f8a18beeb6eeed2653e0cf69 Mon Sep 17 00:00:00 2001 From: Tnze Date: Fri, 25 Nov 2022 13:29:07 +0800 Subject: [PATCH] add doc for bot package --- bot/basic/basic.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bot/basic/basic.go b/bot/basic/basic.go index 736caf5..3aa867c 100644 --- a/bot/basic/basic.go +++ b/bot/basic/basic.go @@ -1,3 +1,26 @@ +// Package basic provides some basic packet handler which client needs. +// +// # [Player] +// +// The [Player] is attached to a [Client] by calling [NewPlayer] before the client joins a server. +// +// There is 4 kinds of clientbound packet is handled by this package. +// - LoginPacket, for cache player info. The player info will be stored in [Player.PlayerInfo]. +// - KeepAlivePacket, for avoid the client to be kicked by the server. +// - PlayerPosition, is only received when server teleporting the player. And the confirm packet is automatically sent. +// - Respawn, for updating player info, which may change when player respawned. +// +// # [EventsListener] +// +// Handles some basic event you probably need. +// - GameStart +// - ChatMsg +// - SystemMsg +// - Disconnect +// - HealthChange +// - Death +// +// You must manully attach the [EventsListener] to the [Client] as needed. package basic import (