修改错误的版本号

This commit is contained in:
Tnze
2019-07-20 10:54:06 +08:00
parent a1cc368be2
commit 927de56d35
5 changed files with 23 additions and 11 deletions

View File

@ -1,6 +1,6 @@
# Go-MC # Go-MC
![](https://img.shields.io/badge/Minecraft-1.14.4-blue.svg) ![](https://img.shields.io/badge/Minecraft-1.14.4-blue.svg)
![](https://img.shields.io/badge/Protocol-497-blue.svg) ![](https://img.shields.io/badge/Protocol-498-blue.svg)
[![GoDoc](https://godoc.org/github.com/Tnze/go-mc?status.svg)](https://godoc.org/github.com/Tnze/go-mc) [![GoDoc](https://godoc.org/github.com/Tnze/go-mc?status.svg)](https://godoc.org/github.com/Tnze/go-mc)
[![Go Report Card](https://goreportcard.com/badge/github.com/Tnze/go-mc)](https://goreportcard.com/report/github.com/Tnze/go-mc) [![Go Report Card](https://goreportcard.com/badge/github.com/Tnze/go-mc)](https://goreportcard.com/report/github.com/Tnze/go-mc)
[![Build Status](https://travis-ci.org/Tnze/go-mc.svg?branch=master)](https://travis-ci.org/Tnze/go-mc) [![Build Status](https://travis-ci.org/Tnze/go-mc.svg?branch=master)](https://travis-ci.org/Tnze/go-mc)

View File

@ -24,8 +24,8 @@ import (
// return int(math.Floor(p.X)), int(math.Floor(p.Y)), int(math.Floor(p.Z)) // return int(math.Floor(p.X)), int(math.Floor(p.Y)), int(math.Floor(p.Z))
// } // }
// HandleGame recive server packet and response them correctly. // HandleGame receive server packet and response them correctly.
// Note that HandleGame will block if you don't recive from Events. // Note that HandleGame will block if you don't receive from Events.
func (c *Client) HandleGame() error { func (c *Client) HandleGame() error {
for { for {
select { select {
@ -212,7 +212,7 @@ func handleSetSlotPacket(c *Client, p pk.Packet) error {
} }
// func handleMultiBlockChangePacket(c *Client, p pk.Packet) error { // func handleMultiBlockChangePacket(c *Client, p pk.Packet) error {
// if !c.settings.ReciveMap { // if !c.settings.ReceiveMap {
// return nil // return nil
// } // }
@ -253,7 +253,7 @@ func handleSetSlotPacket(c *Client, p pk.Packet) error {
// } // }
// func handleBlockChangePacket(c *Client, p pk.Packet) error { // func handleBlockChangePacket(c *Client, p pk.Packet) error {
// if !c.settings.ReciveMap { // if !c.settings.ReceiveMap {
// return nil // return nil
// } // }
// var pos pk.Position // var pos pk.Position
@ -435,7 +435,7 @@ func handleHeldItemPacket(c *Client, p pk.Packet) error {
} }
func handleChunkDataPacket(c *Client, p pk.Packet) error { func handleChunkDataPacket(c *Client, p pk.Packet) error {
if !c.settings.ReciveMap { if !c.settings.ReceiveMap {
return nil return nil
} }
var ( var (

View File

@ -13,7 +13,7 @@ import (
) )
// ProtocolVersion , the protocol version number of minecraft net protocol // ProtocolVersion , the protocol version number of minecraft net protocol
const ProtocolVersion = 497 const ProtocolVersion = 498
// PingAndList check server status and list online player. // PingAndList check server status and list online player.
// Returns a JSON data with server status, and the delay. // Returns a JSON data with server status, and the delay.

View File

@ -8,7 +8,7 @@ type Settings struct {
ChatColors bool //聊天颜色 ChatColors bool //聊天颜色
DisplayedSkinParts uint8 //皮肤显示 DisplayedSkinParts uint8 //皮肤显示
MainHand int //主手 MainHand int //主手
ReciveMap bool //接收地图数据 ReceiveMap bool //接收地图数据
} }
/* /*
@ -32,5 +32,5 @@ var DefaultSettings = Settings{
ChatMode: 0, ChatMode: 0,
DisplayedSkinParts: Jacket | LeftSleeve | RightSleeve | LeftPantsLeg | RightPantsLeg | Hat, DisplayedSkinParts: Jacket | LeftSleeve | RightSleeve | LeftPantsLeg | RightPantsLeg | Hat,
MainHand: 1, MainHand: 1,
ReciveMap: true, ReceiveMap: true,
} }

View File

@ -1,10 +1,12 @@
package main package main
import ( import (
"bytes"
"log" "log"
"github.com/Tnze/go-mc/bot" "github.com/Tnze/go-mc/bot"
"github.com/Tnze/go-mc/chat" "github.com/Tnze/go-mc/chat"
pk "github.com/Tnze/go-mc/net/packet"
// "github.com/Tnze/go-mc/authenticate" // "github.com/Tnze/go-mc/authenticate"
) )
@ -26,7 +28,7 @@ func main() {
} }
log.Println("Login success") log.Println("Login success")
//Regist event handlers //Register event handlers
c.Events.GameStart = onGameStart c.Events.GameStart = onGameStart
c.Events.ChatMsg = onChatMsg c.Events.ChatMsg = onChatMsg
c.Events.Disconnect = onDisconnect c.Events.Disconnect = onDisconnect
@ -55,6 +57,16 @@ func onDisconnect(c chat.Message) error {
} }
func onPluginMessage(channel string, data []byte) error { func onPluginMessage(channel string, data []byte) error {
switch channel {
case "minecraft:brand":
var brand pk.String
if err := brand.Decode(bytes.NewReader(data)); err != nil {
return err
}
log.Println("Server brand is:", brand)
default:
log.Println("PluginMessage", channel, data) log.Println("PluginMessage", channel, data)
}
return nil return nil
} }