Part of refactor

This commit is contained in:
Tnze
2021-02-27 20:20:17 +08:00
parent 918fffed1f
commit fb1d3a3506
6 changed files with 57 additions and 50 deletions

View File

@ -3,7 +3,6 @@ package basic
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
"log"
)
func (p Player) handleKeepAlivePacket(packet pk.Packet) error {
@ -54,7 +53,6 @@ func (p *Player) handlePlayerPositionAndLook(packet pk.Packet) error {
return Error{err}
}
p.isSpawn = true
log.Print("Position confirmed")
}
return nil

View File

@ -8,8 +8,8 @@ type Settings struct {
ChatColors bool //聊天颜色
DisplayedSkinParts uint8 //皮肤显示
MainHand int //主手
ReceiveMap bool //接收地图数据
Brand string // The brand string presented to the server.
Brand string // The brand string presented to the server.
}
/*
@ -33,6 +33,6 @@ var DefaultSettings = Settings{
ChatMode: 0,
DisplayedSkinParts: Jacket | LeftSleeve | RightSleeve | LeftPantsLeg | RightPantsLeg | Hat,
MainHand: 1,
ReceiveMap: true,
Brand: "vanilla",
Brand: "vanilla",
}

View File

@ -1,15 +1,15 @@
package bot
import (
"log"
"encoding/hex"
"fmt"
"github.com/Tnze/go-mc/offline"
"github.com/Tnze/go-mc/yggdrasil"
"log"
)
func ExamplePingAndList() {
resp, delay, err := PingAndList("localhost", 25565)
resp, delay, err := PingAndList("localhost:25565")
if err != nil {
log.Fatalf("ping and list server fail: %v", err)
}
@ -54,8 +54,8 @@ func ExampleClient_JoinServer_online() {
panic(err)
}
c.Auth.UUID, c.Name = auth.SelectedProfile()
c.AsTk = auth.AccessToken()
c.Auth.UUID, c.Auth.Name = auth.SelectedProfile()
c.Auth.AsTk = auth.AccessToken()
//Connect server
err = c.JoinServer("127.0.0.1")
@ -76,10 +76,3 @@ func ExampleClient_JoinServer_online() {
log.Fatal(err)
}
}
func ExampleOfflineUUID() {
fmt.Println(offline.NameToUUID("Tnze"))
// output:
// c7b9eece-2f2e-325c-8da8-6fc8f3d0edb0
}