diff --git a/bot/mcbot.go b/bot/mcbot.go index 93a1638..38eb67d 100644 --- a/bot/mcbot.go +++ b/bot/mcbot.go @@ -12,8 +12,8 @@ import ( pk "github.com/Tnze/go-mc/net/packet" ) -// ProtocalVersion , the protocal version number of minecraft net protocal -const ProtocalVersion = 480 +// ProtocolVersion , the protocol version number of minecraft net protocol +const ProtocolVersion = 480 // PingAndList chack server status and list online player. // Returns a JSON data with server status, and the delay. @@ -30,7 +30,7 @@ func PingAndList(addr string, port int) ([]byte, time.Duration, error) { //Handshake Packet pk.Marshal( 0x00, //Handshake packet ID - pk.VarInt(ProtocalVersion), //Protocal version + pk.VarInt(ProtocolVersion), //Protocol version pk.String(addr), //Server's address pk.UnsignedShort(port), pk.Byte(1), @@ -94,7 +94,7 @@ func (c *Client) JoinServer(addr string, port int) (err error) { //Handshake Packet pk.Marshal( 0x00, //Handshake packet ID - pk.VarInt(ProtocalVersion), //Protocal version + pk.VarInt(ProtocolVersion), //Protocol version pk.String(addr), //Server's address pk.UnsignedShort(port), pk.Byte(2), diff --git a/nbt/read.go b/nbt/read.go index 48fc53e..2a5e953 100644 --- a/nbt/read.go +++ b/nbt/read.go @@ -303,7 +303,7 @@ func (d *Decoder) readTag() (tagType byte, tagName string, err error) { func (d *Decoder) readNByte(n int) (buf []byte, err error) { buf = make([]byte, n) - _, err = d.r.Read(buf) //what happend if (returned n) != (argument n) ? + _, err = d.r.Read(buf) //what happened if (returned n) != (argument n) ? return } diff --git a/net/packet/types.go b/net/packet/types.go index 7d2f2d1..86cb201 100644 --- a/net/packet/types.go +++ b/net/packet/types.go @@ -6,15 +6,18 @@ import ( "math" ) +// A Field is both FieldEncoder and FieldDecoder type Field interface { FieldEncoder FieldDecoder } +// A FieldEncoder can be encode as minecraft protocal used. type FieldEncoder interface { Encode() []byte } +// A FieldDecoder can Decode from minecraft protocal type FieldDecoder interface { Decode(r DecodeReader) error }