chat

package
v1.14.5-0...-43f7235 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package chat implements Minecraft's chat message encoding system.

The type Message is the Minecraft chat message. Can be encode as JSON or net/packet.Field .

It's very recommended that use SetLanguage before using Message.String or Message.ClearString, or the translate message will be ignore. Note: The package of data/lang/... will SetLanguage on theirs init() so you don't need do again.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLanguage

func SetLanguage(trans map[string]string)

SetLanguage set the translate map to this map.

Types

type Message

type Message jsonChat

Message is a message sent by other

func (Message) ClearString

func (m Message) ClearString() string

ClearString return the message String without escape sequence for ansi color.

func (*Message) Decode

func (m *Message) Decode(r pk.DecodeReader) error

Decode for a ChatMsg packet

func (Message) Encode

func (m Message) Encode() []byte

Encode for a ChatMsg packet

func (Message) String

func (m Message) String() string

String return the message string with escape sequence for ansi color. To convert Translated Message to string, you must set On windows, you may want print this string using github.com/mattn/go-colorable.

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(jsonMsg []byte) (err error)

UnmarshalJSON decode json to Message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL