fix code format
This commit is contained in:
@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
"github.com/Tnze/go-mc/data/packetid"
|
||||
"github.com/Tnze/go-mc/net"
|
||||
@ -51,7 +52,7 @@ type MojangLoginHandler struct {
|
||||
|
||||
// AcceptLogin implement LoginHandler for MojangLoginHandler
|
||||
func (d *MojangLoginHandler) AcceptLogin(conn *net.Conn, protocol int32) (name string, id uuid.UUID, profilePubKey *auth.PublicKey, properties []auth.Property, err error) {
|
||||
//login start
|
||||
// login start
|
||||
var p pk.Packet
|
||||
err = conn.ReadPacket(&p)
|
||||
if err != nil {
|
||||
@ -69,7 +70,7 @@ func (d *MojangLoginHandler) AcceptLogin(conn *net.Conn, protocol int32) (name s
|
||||
profileUUID pk.UUID // ignored
|
||||
)
|
||||
err = p.Scan(
|
||||
(*pk.String)(&name), //decode username as pk.String
|
||||
(*pk.String)(&name), // decode username as pk.String
|
||||
&hasPubKey, pk.Opt{
|
||||
Has: &hasPubKey,
|
||||
Field: &pubKey,
|
||||
@ -94,10 +95,10 @@ func (d *MojangLoginHandler) AcceptLogin(conn *net.Conn, protocol int32) (name s
|
||||
return
|
||||
}
|
||||
|
||||
//auth
|
||||
// auth
|
||||
if d.OnlineMode {
|
||||
var resp *auth.Resp
|
||||
//Auth, Encrypt
|
||||
// Auth, Encrypt
|
||||
resp, err = auth.Encrypt(conn, name, pubKey.PubKey)
|
||||
if err != nil {
|
||||
return
|
||||
@ -110,7 +111,7 @@ func (d *MojangLoginHandler) AcceptLogin(conn *net.Conn, protocol int32) (name s
|
||||
id = offline.NameToUUID(name)
|
||||
}
|
||||
|
||||
//set compression
|
||||
// set compression
|
||||
if d.Threshold >= 0 {
|
||||
err = conn.WritePacket(pk.Marshal(
|
||||
packetid.LoginCompression,
|
||||
|
Reference in New Issue
Block a user