typhoon

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: GPL-2.0 Imports: 21 Imported by: 0

README

TyphoonCore

Lightweight minecraft server engine

Build Status stability-wip

Minecraft protocol support
Minecraft Version Protocol Version Supported
1.7.2 to 1.7.5 4 true
1.7.6 to 1.7.10 5 true
1.8 to 1.8.9 47 true
1.9 107 true
1.9.1 108 true
1.9.2 109 true
1.9.3 to 1.9.4 110 true
1.10 to 1.10.2 210 true
1.11 315 true
1.11.1 to 1.11.2 316 true
1.12 335 true
1.12.1 338 true
1.12.2 340 true
1.13 393 true
1.13.1 401 true
1.13.2 404 true
Snapshot support

TyphoonCore is able to load TyphoonDep protocol-map modules to add a partial snapshots support.

All json files are loaded from the "modules" folder in the same directory as the TyphoonLimbo binary.

You can generate a protocol-map module with the fetcher. Just pick the "page" link of your wanted version on wiki.vg as argument of the fecther and the magic will happen.

How to use
go get github.com/TyphoonMC/go.uuid
Example
package main

import (
	"fmt"
	t "github.com/TyphoonMC/TyphoonCore"
)

func main() {
	core := t.Init()
	core.SetBrand("exampleserver")

	core.On(func(e *t.PlayerJoinEvent) {
		msg := t.ChatMessage("Welcome ")
		msg.SetExtra([]t.IChatComponent{
			t.ChatMessage(e.Player.GetName()),
			t.ChatMessage(" !"),
		})
		e.Player.SendMessage(msg)
	})

	core.Start()
}
Roadmap
  • User friendly API
  • World loading
  • Multiworld
  • Entities
  • Physics
  • Biomes
  • Redstone
  • Pistons

Documentation

Index

Constants

View Source
const (
	CommandNodeTypeLiteral
	CommandNodeTypeArgument
)

Variables

View Source
var (
	ChatColorBlack         = ChatColor{0, "black"}
	ChatColorDarkBlue      = ChatColor{1, "dark_blue"}
	ChatColorDarkGreen     = ChatColor{2, "dark_green"}
	ChatColorDarkAqua      = ChatColor{3, "dark_aqua"}
	ChatColorDarkRed       = ChatColor{4, "dark_red"}
	ChatColorDarkPurple    = ChatColor{5, "dark_purple"}
	ChatColorGold          = ChatColor{6, "gold"}
	ChatColorGray          = ChatColor{7, "gray"}
	ChatColorDarkGray      = ChatColor{8, "dark_gray"}
	ChatColorIndigo        = ChatColor{9, "blue"}
	ChatColorGreen         = ChatColor{10, "green"}
	ChatColorAqua          = ChatColor{11, "aqua"}
	ChatColorRed           = ChatColor{12, "red"}
	ChatColorPink          = ChatColor{13, "light_purple"}
	ChatColorYellow        = ChatColor{14, "yellow"}
	ChatColorWhite         = ChatColor{15, "white"}
	ChatStyleObfuscated    = ChatStyle{&ChatColor{'k', "obfuscated"}}
	ChatStyleBold          = ChatStyle{&ChatColor{'l', "bold"}}
	ChatStyleStrikeThrough = ChatStyle{&ChatColor{'m', "strikethrough"}}
	ChatStyleUnderlined    = ChatStyle{&ChatColor{'n', "underlined"}}
	ChatStyleItalic        = ChatStyle{&ChatColor{'o', "italic"}}
)

Functions

func IsCompatible

func IsCompatible(proto Protocol) bool

func JsonEscape

func JsonEscape(s string) string

func JsonMessage

func JsonMessage(s string) json.RawMessage

func PacketTypeHash

func PacketTypeHash(state State, id int) int64

Types

type BossBarAction

type BossBarAction int
const (
	BOSSBAR_ADD BossBarAction = iota
	BOSSBAR_REMOVE
	BOSSBAR_UPDATE_HEALTH
	BOSSBAR_UPDATE_TITLE
	BOSSBAR_UPDATE_STYLE
	BOSSBAR_UPDATE_FLAGS
)

type BossBarColor

type BossBarColor int
const (
	BOSSBAR_COLOR_PINK BossBarColor = iota
	BOSSBAR_COLOR_BLUE
	BOSSBAR_COLOR_RED
	BOSSBAR_COLOR_GREEN
	BOSSBAR_COLOR_YELLOW
	BOSSBAR_COLOR_PURPLE
	BOSSBAR_COLOR_WHITE
)

type BossBarDivision

type BossBarDivision int
const (
	BOSSBAR_NODIVISION BossBarDivision = iota
	BOSSBAR_6NOTCHES
	BOSSBAR_10NOTCHES
	BOSSBAR_12NOTCHES
	BOSSBAR_20NOTCHES
)

type BufferConfig

type BufferConfig struct {
	HandshakeAddress int `json:"handshake_address"`
	PlayerName       int `json:"player_name"`
	ChatMessage      int `json:"chat_message"`
}

type ChatAction

type ChatAction struct {
	Action string      `json:"action"`
	Value  interface{} `json:"value"`
}

func ChatClickRunCommand

func ChatClickRunCommand(command string) *ChatAction

func ChatHoverMessage

func ChatHoverMessage(components []IChatComponent) *ChatAction

func ChatHoverText

func ChatHoverText(component string) *ChatAction

type ChatColor

type ChatColor struct {
	// contains filtered or unexported fields
}

func (*ChatColor) ChatFormat

func (color *ChatColor) ChatFormat() string

func (*ChatColor) GetId

func (color *ChatColor) GetId() byte

func (*ChatColor) GetName

func (color *ChatColor) GetName() string

type ChatComponent

type ChatComponent struct {
	Bold          bool             `json:"bold"`
	Italic        bool             `json:"italic"`
	Underlined    bool             `json:"underlined"`
	StrikeThrough bool             `json:"strikethrough"`
	Obfuscated    bool             `json:"obfuscated"`
	Color         *string          `json:"color,omitempty"`
	Insertion     *string          `json:"insertion,omitempty"`
	ClickEvent    *ChatAction      `json:"clickEvent,omitempty"`
	HoverEvent    *ChatAction      `json:"hoverEvent,omitempty"`
	Extra         []IChatComponent `json:"extra,omitempty"`
}

func (*ChatComponent) AddExtra

func (component *ChatComponent) AddExtra(extra IChatComponent)

func (*ChatComponent) JSON

func (component *ChatComponent) JSON() (string, error)

func (*ChatComponent) SetBold

func (component *ChatComponent) SetBold(bold bool)

func (*ChatComponent) SetClickEvent

func (component *ChatComponent) SetClickEvent(action *ChatAction)

func (*ChatComponent) SetColor

func (component *ChatComponent) SetColor(color *ChatColor)

func (*ChatComponent) SetExtra

func (component *ChatComponent) SetExtra(extra []IChatComponent)

func (*ChatComponent) SetHoverEvent

func (component *ChatComponent) SetHoverEvent(action *ChatAction)

func (*ChatComponent) SetInsertion

func (component *ChatComponent) SetInsertion(insertion string)

func (*ChatComponent) SetItalic

func (component *ChatComponent) SetItalic(italic bool)

func (*ChatComponent) SetObfuscated

func (component *ChatComponent) SetObfuscated(obfuscated bool)

func (*ChatComponent) SetStrikeThrough

func (component *ChatComponent) SetStrikeThrough(strikeThrough bool)

func (*ChatComponent) SetUnderlined

func (component *ChatComponent) SetUnderlined(underlined bool)

type ChatPosition

type ChatPosition uint8
const (
	CHAT_BOX ChatPosition = iota
	SYSTEM
	ACTION_BAR
)

type ChatStyle

type ChatStyle struct {
	*ChatColor
}

func (*ChatStyle) ChatFormat

func (color *ChatStyle) ChatFormat() string

type CommandNode

type CommandNode struct {
	Type         CommandNodeType
	Execute      func(player *Player, args []string)
	Children     []*CommandNode
	RedirectNode *CommandNode
	Name         string
	Parser       CommandParser
}

func CommandNodeArgument

func CommandNodeArgument(
	name string,
	children []*CommandNode,
	parser CommandParser,
	execute func(player *Player, args []string)) *CommandNode

func CommandNodeLiteral

func CommandNodeLiteral(
	name string,
	children []*CommandNode,
	execute func(player *Player, args []string)) *CommandNode

type CommandNodeType

type CommandNodeType uint8

type CommandParser

type CommandParser interface {
	GetId() string
	IsMultiple() bool
	IsValid(string) bool
	IsArrayValid([]string) bool
	GetSuggestion() CommandSuggestionType
	Complete(string) []string
	// contains filtered or unexported methods
}

type CommandParserBool

type CommandParserBool struct{}

func (*CommandParserBool) Complete

func (c *CommandParserBool) Complete(arg string) []string

func (*CommandParserBool) GetId

func (c *CommandParserBool) GetId() string

func (*CommandParserBool) GetSuggestion

func (c *CommandParserBool) GetSuggestion() CommandSuggestionType

func (*CommandParserBool) IsArrayValid

func (c *CommandParserBool) IsArrayValid(arg []string) bool

func (*CommandParserBool) IsMultiple

func (c *CommandParserBool) IsMultiple() bool

func (*CommandParserBool) IsValid

func (c *CommandParserBool) IsValid(arg string) bool

type CommandParserDouble

type CommandParserDouble struct {
	Min OptDouble
	Max OptDouble
}

func (*CommandParserDouble) Complete

func (c *CommandParserDouble) Complete(arg string) []string

func (*CommandParserDouble) GetId

func (c *CommandParserDouble) GetId() string

func (*CommandParserDouble) GetSuggestion

func (c *CommandParserDouble) GetSuggestion() CommandSuggestionType

func (*CommandParserDouble) IsArrayValid

func (c *CommandParserDouble) IsArrayValid(arg []string) bool

func (*CommandParserDouble) IsMultiple

func (c *CommandParserDouble) IsMultiple() bool

func (*CommandParserDouble) IsValid

func (c *CommandParserDouble) IsValid(arg string) bool

type CommandParserFloat

type CommandParserFloat struct {
	Min OptFloat
	Max OptFloat
}

func (*CommandParserFloat) Complete

func (c *CommandParserFloat) Complete(arg string) []string

func (*CommandParserFloat) GetId

func (c *CommandParserFloat) GetId() string

func (*CommandParserFloat) GetSuggestion

func (c *CommandParserFloat) GetSuggestion() CommandSuggestionType

func (*CommandParserFloat) IsArrayValid

func (c *CommandParserFloat) IsArrayValid(arg []string) bool

func (*CommandParserFloat) IsMultiple

func (c *CommandParserFloat) IsMultiple() bool

func (*CommandParserFloat) IsValid

func (c *CommandParserFloat) IsValid(arg string) bool

type CommandParserInteger

type CommandParserInteger struct {
	Min OptInteger
	Max OptInteger
}

func (*CommandParserInteger) Complete

func (c *CommandParserInteger) Complete(arg string) []string

func (*CommandParserInteger) GetId

func (c *CommandParserInteger) GetId() string

func (*CommandParserInteger) GetSuggestion

func (c *CommandParserInteger) GetSuggestion() CommandSuggestionType

func (*CommandParserInteger) IsArrayValid

func (c *CommandParserInteger) IsArrayValid(arg []string) bool

func (*CommandParserInteger) IsMultiple

func (c *CommandParserInteger) IsMultiple() bool

func (*CommandParserInteger) IsValid

func (c *CommandParserInteger) IsValid(arg string) bool

type CommandParserString

type CommandParserString struct {
	Format CommandParserStringFormat
}

func (*CommandParserString) Complete

func (c *CommandParserString) Complete(arg string) []string

func (*CommandParserString) GetId

func (c *CommandParserString) GetId() string

func (*CommandParserString) GetSuggestion

func (c *CommandParserString) GetSuggestion() CommandSuggestionType

func (*CommandParserString) IsArrayValid

func (c *CommandParserString) IsArrayValid(arg []string) bool

func (*CommandParserString) IsMultiple

func (c *CommandParserString) IsMultiple() bool

func (*CommandParserString) IsValid

func (c *CommandParserString) IsValid(arg string) bool

type CommandParserStringFormat

type CommandParserStringFormat int
const (
	CommandParserStringFormatSingleWord CommandParserStringFormat = iota

	CommandParserStringFormatGreedyPhrase
)

type CommandSuggestionType

type CommandSuggestionType string
const (
	CommandSuggestionNone               CommandSuggestionType = ""
	CommandSuggestionAskServer          CommandSuggestionType = "minecraft:ask_server"
	CommandSuggestionAllRecipes         CommandSuggestionType = "minecraft:all_recipes"
	CommandSuggestionAvailableSounds    CommandSuggestionType = "minecraft:available_sounds"
	CommandSuggestionSummonableEntities CommandSuggestionType = "minecraft:summonable_entities"
)

type Config

type Config struct {
	ListenAddress string       `json:"listen_address"`
	MaxPlayers    int          `json:"max_players"`
	Motd          string       `json:"motd"`
	Restricted    bool         `json:"restricted"`
	Logs          bool         `json:"logs"`
	Compression   bool         `json:"enable_compression"`
	Threshold     int          `json:"compression_threshold"`
	BufferConfig  BufferConfig `json:"buffer_config"`
}

type ConnReadWrite

type ConnReadWrite struct {
	// contains filtered or unexported fields
}

func (ConnReadWrite) ReadByte

func (rdrwtr ConnReadWrite) ReadByte() (b byte, err error)

type Content

type Content struct {
	Name     string   `json:"name"`
	Protocol Protocol `json:"protocol"`
	Base     Protocol `json:"base"`
	Map      Map      `json:"map"`
}

type Core

type Core struct {
	// contains filtered or unexported fields
}

func Init

func Init() *Core

func (*Core) CallEvent

func (c *Core) CallEvent(event Event)

func (*Core) DeclareCommand

func (c *Core) DeclareCommand(graph *CommandNode)

func (*Core) GetConfig

func (c *Core) GetConfig(config interface{})

func (*Core) GetPlayerRegistry

func (c *Core) GetPlayerRegistry() *PlayerRegistry

func (*Core) On

func (c *Core) On(handler interface{})

func (*Core) OnPluginMessage

func (c *Core) OnPluginMessage(channel string, handler interface{})

func (*Core) SetBrand

func (c *Core) SetBrand(brand string)

func (*Core) Start

func (c *Core) Start()

type Difficulty

type Difficulty uint8
const (
	PEACEFUL Difficulty = iota
	EASY
	NORMAL
	HARD
)

type Dimension

type Dimension uint32
const (
	NETHER    Dimension = 0xFF
	OVERWORLD Dimension = 0
	END       Dimension = 1
)

type Event

type Event interface{}

type EventCallback

type EventCallback struct {
	Callback interface{}
	MetaData map[string]string
}

type Gamemode

type Gamemode uint8
const (
	SURVIVAL Gamemode = iota
	CREATIVE
	ADVENTURE
	SPECTATOR
)

type IChatComponent

type IChatComponent interface {
	JSON() (string, error)
}

func BukkitMessageConvert

func BukkitMessageConvert(message string) IChatComponent

type InAddr

type InAddr struct {
	// contains filtered or unexported fields
}

type LevelType

type LevelType string
const (
	DEFAULT      LevelType = "default"
	FLAT         LevelType = "flat"
	LARGE_BIOMES LevelType = "largeBiomes"
	AMPLIFIED    LevelType = "amplified"
	DEFAULT_1_1  LevelType = "default_1_1"
)

type Map

type Map struct {
	Clientbound map[string]string `json:"clientbound"`
	Serverbound map[string]string `json:"serverbound"`
}

type Module

type Module struct {
	Type    Type    `json:"type"`
	Content Content `json:"content"`
}

type OptDouble

type OptDouble struct {
	Used  bool
	Value float64
}

type OptFloat

type OptFloat struct {
	Used  bool
	Value float32
}

type OptInteger

type OptInteger struct {
	Used  bool
	Value int32
}

type Packet

type Packet interface {
	Write(*Player) error
	Read(*Player, int) error
	Handle(*Player)
	Id() (int, Protocol)
}

type PacketBossBar

type PacketBossBar struct {
	UUID     uuid.UUID
	Action   BossBarAction
	Title    string
	Health   float32
	Color    BossBarColor
	Division BossBarDivision
	Flags    uint8
}

func (*PacketBossBar) Handle

func (packet *PacketBossBar) Handle(player *Player)

func (*PacketBossBar) Id

func (packet *PacketBossBar) Id() (int, Protocol)

func (*PacketBossBar) Read

func (packet *PacketBossBar) Read(player *Player, length int) (err error)

func (*PacketBossBar) Write

func (packet *PacketBossBar) Write(player *Player) (err error)

type PacketHandshake

type PacketHandshake struct {
	Protocol Protocol
	Address  string
	Port     uint16
	State    State
}

func (*PacketHandshake) Handle

func (packet *PacketHandshake) Handle(player *Player)

func (*PacketHandshake) Id

func (packet *PacketHandshake) Id() (int, Protocol)

func (*PacketHandshake) Read

func (packet *PacketHandshake) Read(player *Player, length int) (err error)

func (*PacketHandshake) Write

func (packet *PacketHandshake) Write(player *Player) (err error)

type PacketLoginDisconnect

type PacketLoginDisconnect struct {
	Component string
}

func (*PacketLoginDisconnect) Handle

func (packet *PacketLoginDisconnect) Handle(player *Player)

func (*PacketLoginDisconnect) Id

func (packet *PacketLoginDisconnect) Id() (int, Protocol)

func (*PacketLoginDisconnect) Read

func (packet *PacketLoginDisconnect) Read(player *Player, length int) (err error)

func (*PacketLoginDisconnect) Write

func (packet *PacketLoginDisconnect) Write(player *Player) (err error)

type PacketLoginStart

type PacketLoginStart struct {
	Username string
}

func (*PacketLoginStart) Handle

func (packet *PacketLoginStart) Handle(player *Player)

func (*PacketLoginStart) Id

func (packet *PacketLoginStart) Id() (int, Protocol)

func (*PacketLoginStart) Read

func (packet *PacketLoginStart) Read(player *Player, length int) (err error)

func (*PacketLoginStart) Write

func (packet *PacketLoginStart) Write(player *Player) (err error)

type PacketLoginSuccess

type PacketLoginSuccess struct {
	UUID     string
	Username string
}

func (*PacketLoginSuccess) Handle

func (packet *PacketLoginSuccess) Handle(player *Player)

func (*PacketLoginSuccess) Id

func (packet *PacketLoginSuccess) Id() (int, Protocol)

func (*PacketLoginSuccess) Read

func (packet *PacketLoginSuccess) Read(player *Player, length int) (err error)

func (*PacketLoginSuccess) Write

func (packet *PacketLoginSuccess) Write(player *Player) (err error)

type PacketPlayChat

type PacketPlayChat struct {
	Message string
}

func (*PacketPlayChat) Handle

func (packet *PacketPlayChat) Handle(player *Player)

func (*PacketPlayChat) Id

func (packet *PacketPlayChat) Id() (int, Protocol)

func (*PacketPlayChat) Read

func (packet *PacketPlayChat) Read(player *Player, length int) (err error)

func (*PacketPlayChat) Write

func (packet *PacketPlayChat) Write(player *Player) (err error)

type PacketPlayDeclareCommands

type PacketPlayDeclareCommands struct {
	Nodes     []commandNode
	RootIndex int
}

func (*PacketPlayDeclareCommands) Handle

func (packet *PacketPlayDeclareCommands) Handle(player *Player)

func (*PacketPlayDeclareCommands) Id

func (packet *PacketPlayDeclareCommands) Id() (int, Protocol)

func (*PacketPlayDeclareCommands) Read

func (packet *PacketPlayDeclareCommands) Read(player *Player, length int) (err error)

func (*PacketPlayDeclareCommands) Write

func (packet *PacketPlayDeclareCommands) Write(player *Player) (err error)

type PacketPlayDisconnect

type PacketPlayDisconnect struct {
	Component string
}

func (*PacketPlayDisconnect) Handle

func (packet *PacketPlayDisconnect) Handle(player *Player)

func (*PacketPlayDisconnect) Id

func (packet *PacketPlayDisconnect) Id() (int, Protocol)

func (*PacketPlayDisconnect) Read

func (packet *PacketPlayDisconnect) Read(player *Player, length int) (err error)

func (*PacketPlayDisconnect) Write

func (packet *PacketPlayDisconnect) Write(player *Player) (err error)

type PacketPlayJoinGame

type PacketPlayJoinGame struct {
	EntityId     uint32
	Gamemode     Gamemode
	Dimension    Dimension
	Difficulty   Difficulty
	MaxPlayers   uint8
	LevelType    LevelType
	ReducedDebug bool
}

func (*PacketPlayJoinGame) Handle

func (packet *PacketPlayJoinGame) Handle(player *Player)

func (*PacketPlayJoinGame) Id

func (packet *PacketPlayJoinGame) Id() (int, Protocol)

func (*PacketPlayJoinGame) Read

func (packet *PacketPlayJoinGame) Read(player *Player, length int) (err error)

func (*PacketPlayJoinGame) Write

func (packet *PacketPlayJoinGame) Write(player *Player) (err error)

type PacketPlayKeepAlive

type PacketPlayKeepAlive struct {
	Identifier int
}

func (*PacketPlayKeepAlive) Handle

func (packet *PacketPlayKeepAlive) Handle(player *Player)

func (*PacketPlayKeepAlive) Id

func (packet *PacketPlayKeepAlive) Id() (int, Protocol)

func (*PacketPlayKeepAlive) Read

func (packet *PacketPlayKeepAlive) Read(player *Player, length int) (err error)

func (*PacketPlayKeepAlive) Write

func (packet *PacketPlayKeepAlive) Write(player *Player) (err error)

type PacketPlayMessage

type PacketPlayMessage struct {
	Component string
	Position  ChatPosition
}

func (*PacketPlayMessage) Handle

func (packet *PacketPlayMessage) Handle(player *Player)

func (*PacketPlayMessage) Id

func (packet *PacketPlayMessage) Id() (int, Protocol)

func (*PacketPlayMessage) Read

func (packet *PacketPlayMessage) Read(player *Player, length int) (err error)

func (*PacketPlayMessage) Write

func (packet *PacketPlayMessage) Write(player *Player) (err error)

type PacketPlayPluginMessage

type PacketPlayPluginMessage struct {
	Channel string
	Data    []byte
}

func (*PacketPlayPluginMessage) Handle

func (packet *PacketPlayPluginMessage) Handle(player *Player)

func (*PacketPlayPluginMessage) Id

func (packet *PacketPlayPluginMessage) Id() (int, Protocol)

func (*PacketPlayPluginMessage) Read

func (packet *PacketPlayPluginMessage) Read(player *Player, length int) (err error)

func (*PacketPlayPluginMessage) Write

func (packet *PacketPlayPluginMessage) Write(player *Player) (err error)

type PacketPlayTabComplete

type PacketPlayTabComplete struct {
	Matches []string
}

func (*PacketPlayTabComplete) Handle

func (packet *PacketPlayTabComplete) Handle(player *Player)

func (*PacketPlayTabComplete) Id

func (packet *PacketPlayTabComplete) Id() (int, Protocol)

func (*PacketPlayTabComplete) Read

func (packet *PacketPlayTabComplete) Read(player *Player, length int) (err error)

func (*PacketPlayTabComplete) Write

func (packet *PacketPlayTabComplete) Write(player *Player) (err error)

type PacketPlayTabCompleteServerbound

type PacketPlayTabCompleteServerbound struct {
	Text          string
	AssumeCommand bool
	Position      Position
}

func (*PacketPlayTabCompleteServerbound) Handle

func (packet *PacketPlayTabCompleteServerbound) Handle(player *Player)

func (*PacketPlayTabCompleteServerbound) Id

func (*PacketPlayTabCompleteServerbound) Read

func (packet *PacketPlayTabCompleteServerbound) Read(player *Player, length int) (err error)

func (*PacketPlayTabCompleteServerbound) Write

func (packet *PacketPlayTabCompleteServerbound) Write(player *Player) (err error)

type PacketPlayerListHeaderFooter

type PacketPlayerListHeaderFooter struct {
	Header *string
	Footer *string
}

func (*PacketPlayerListHeaderFooter) Handle

func (packet *PacketPlayerListHeaderFooter) Handle(player *Player)

func (*PacketPlayerListHeaderFooter) Id

func (packet *PacketPlayerListHeaderFooter) Id() (int, Protocol)

func (*PacketPlayerListHeaderFooter) Read

func (packet *PacketPlayerListHeaderFooter) Read(player *Player, length int) (err error)

func (*PacketPlayerListHeaderFooter) Write

func (packet *PacketPlayerListHeaderFooter) Write(player *Player) (err error)

type PacketPlayerPositionLook

type PacketPlayerPositionLook struct {
	X          float64
	Y          float64
	Z          float64
	Yaw        float32
	Pitch      float32
	Flags      uint8
	TeleportId int
}

func (*PacketPlayerPositionLook) Handle

func (packet *PacketPlayerPositionLook) Handle(player *Player)

func (*PacketPlayerPositionLook) Id

func (packet *PacketPlayerPositionLook) Id() (int, Protocol)

func (*PacketPlayerPositionLook) Read

func (packet *PacketPlayerPositionLook) Read(player *Player, length int) (err error)

func (*PacketPlayerPositionLook) Write

func (packet *PacketPlayerPositionLook) Write(player *Player) (err error)

type PacketSetCompression

type PacketSetCompression struct {
	Threshold int
}

func (*PacketSetCompression) Handle

func (packet *PacketSetCompression) Handle(player *Player)

func (*PacketSetCompression) Id

func (packet *PacketSetCompression) Id() (int, Protocol)

func (*PacketSetCompression) Read

func (packet *PacketSetCompression) Read(player *Player, length int) (err error)

func (*PacketSetCompression) Write

func (packet *PacketSetCompression) Write(player *Player) (err error)

type PacketStatusPing

type PacketStatusPing struct {
	Time uint64
}

func (*PacketStatusPing) Handle

func (packet *PacketStatusPing) Handle(player *Player)

func (*PacketStatusPing) Id

func (packet *PacketStatusPing) Id() (int, Protocol)

func (*PacketStatusPing) Read

func (packet *PacketStatusPing) Read(player *Player, length int) (err error)

func (*PacketStatusPing) Write

func (packet *PacketStatusPing) Write(player *Player) (err error)

type PacketStatusRequest

type PacketStatusRequest struct{}

func (*PacketStatusRequest) Handle

func (packet *PacketStatusRequest) Handle(player *Player)

func (*PacketStatusRequest) Id

func (packet *PacketStatusRequest) Id() (int, Protocol)

func (*PacketStatusRequest) Read

func (packet *PacketStatusRequest) Read(player *Player, length int) (err error)

func (*PacketStatusRequest) Write

func (packet *PacketStatusRequest) Write(player *Player) (err error)

type PacketStatusResponse

type PacketStatusResponse struct {
	Response string
}

func (*PacketStatusResponse) Handle

func (packet *PacketStatusResponse) Handle(player *Player)

func (*PacketStatusResponse) Id

func (packet *PacketStatusResponse) Id() (int, Protocol)

func (*PacketStatusResponse) Read

func (packet *PacketStatusResponse) Read(player *Player, length int) (err error)

func (*PacketStatusResponse) Write

func (packet *PacketStatusResponse) Write(player *Player) (err error)

type PacketUpdateHealth

type PacketUpdateHealth struct {
	Health         float32
	Food           int
	FoodSaturation float32
}

func (*PacketUpdateHealth) Handle

func (packet *PacketUpdateHealth) Handle(player *Player)

func (*PacketUpdateHealth) Id

func (packet *PacketUpdateHealth) Id() (int, Protocol)

func (*PacketUpdateHealth) Read

func (packet *PacketUpdateHealth) Read(player *Player, length int) (err error)

func (*PacketUpdateHealth) Write

func (packet *PacketUpdateHealth) Write(player *Player) (err error)

type Player

type Player struct {
	// contains filtered or unexported fields
}

func (*Player) GetName

func (player *Player) GetName() string

func (*Player) GetUUID

func (player *Player) GetUUID() string

func (*Player) HackClientbound

func (player *Player) HackClientbound(id int, protocol Protocol) int

func (*Player) HackServerbound

func (player *Player) HackServerbound(id int) int

func (*Player) HandlePacket

func (player *Player) HandlePacket(id int, length int) (packet Packet, err error)

func (*Player) Kick

func (player *Player) Kick(s string)

func (*Player) ReadBool

func (player *Player) ReadBool() (b bool, err error)

func (*Player) ReadByte

func (player *Player) ReadByte() (b byte, err error)

func (*Player) ReadByteArray

func (player *Player) ReadByteArray(length int) (data []byte, err error)

func (*Player) ReadFloat32

func (player *Player) ReadFloat32() (i float32, err error)

func (*Player) ReadFloat64

func (player *Player) ReadFloat64() (i float64, err error)

func (*Player) ReadNStringLimited

func (player *Player) ReadNStringLimited(max int) (s string, read int, err error)

func (*Player) ReadPacket

func (player *Player) ReadPacket() (packet Packet, err error)

func (*Player) ReadPacketWithCompression

func (player *Player) ReadPacketWithCompression() (packet Packet, err error)

func (*Player) ReadPacketWithoutCompression

func (player *Player) ReadPacketWithoutCompression() (packet Packet, err error)

func (*Player) ReadPosition

func (player *Player) ReadPosition() (i Position, err error)

func (*Player) ReadString

func (player *Player) ReadString() (s string, err error)

func (*Player) ReadStringLimited

func (player *Player) ReadStringLimited(max int) (s string, err error)

func (*Player) ReadUInt16

func (player *Player) ReadUInt16() (i uint16, err error)

func (*Player) ReadUInt32

func (player *Player) ReadUInt32() (i uint32, err error)

func (*Player) ReadUInt64

func (player *Player) ReadUInt64() (i uint64, err error)

func (*Player) ReadUInt8

func (player *Player) ReadUInt8() (i uint8, err error)

func (*Player) ReadVarInt

func (player *Player) ReadVarInt() (i int, err error)

func (*Player) SendActionBar

func (p *Player) SendActionBar(message IChatComponent)

func (*Player) SendBukkitMessage

func (p *Player) SendBukkitMessage(message string)

func (*Player) SendMessage

func (p *Player) SendMessage(message IChatComponent)

func (*Player) SendRawActionBar

func (p *Player) SendRawActionBar(message string)

func (*Player) SendRawMessage

func (p *Player) SendRawMessage(message string)

func (*Player) WriteBool

func (player *Player) WriteBool(b bool) (err error)

func (*Player) WriteByteArray

func (player *Player) WriteByteArray(data []byte) (err error)

func (*Player) WriteFloat32

func (player *Player) WriteFloat32(i float32) (err error)

func (*Player) WriteFloat64

func (player *Player) WriteFloat64(i float64) (err error)

func (*Player) WritePacket

func (player *Player) WritePacket(packet Packet) (err error)

func (*Player) WritePacketWithCompression

func (player *Player) WritePacketWithCompression(packet Packet) (err error)

func (*Player) WritePacketWithoutCompression

func (player *Player) WritePacketWithoutCompression(packet Packet) (err error)

func (*Player) WritePosition

func (player *Player) WritePosition(i Position) (err error)

func (*Player) WriteString

func (player *Player) WriteString(s string) (err error)

func (*Player) WriteStringRestricted

func (player *Player) WriteStringRestricted(s string, max int) (err error)

func (*Player) WriteUInt16

func (player *Player) WriteUInt16(i uint16) (err error)

func (*Player) WriteUInt32

func (player *Player) WriteUInt32(i uint32) (err error)

func (*Player) WriteUInt64

func (player *Player) WriteUInt64(i uint64) (err error)

func (*Player) WriteUInt8

func (player *Player) WriteUInt8(i uint8) (err error)

func (*Player) WriteUUID

func (player *Player) WriteUUID(uid uuid.UUID) (err error)

func (*Player) WriteVarInt

func (player *Player) WriteVarInt(i int) (err error)

type PlayerChatEvent

type PlayerChatEvent struct {
	Player  *Player
	Message string
}

type PlayerClickType

type PlayerClickType byte
const (
	PlayerRightClick PlayerClickType = iota
	PlayerLeftClick
)

type PlayerInteractEvent

type PlayerInteractEvent struct {
	Player    *Player
	ClickType PlayerClickType
}

type PlayerJoinEvent

type PlayerJoinEvent struct {
	Player *Player
}

type PlayerKickEvent

type PlayerKickEvent struct {
	Player *Player
	Reason string
}

type PlayerQuitEvent

type PlayerQuitEvent struct {
	Player *Player
}

type PlayerRegistry

type PlayerRegistry struct {
	// contains filtered or unexported fields
}

func (*PlayerRegistry) ForEachPlayer

func (registry *PlayerRegistry) ForEachPlayer(fn func(player *Player))

func (*PlayerRegistry) ForEachPlayerAsync

func (registry *PlayerRegistry) ForEachPlayerAsync(fn func(player *Player))

func (*PlayerRegistry) GetPlayerCount

func (registry *PlayerRegistry) GetPlayerCount() int

func (*PlayerRegistry) GetPlayers

func (registry *PlayerRegistry) GetPlayers() []*Player

type PluginMessageEvent

type PluginMessageEvent struct {
	Channel string
	Data    []byte
}

type Position

type Position struct {
	X int
	Y int
	Z int
}

type Protocol

type Protocol uint16
const (
	V1_7_2  Protocol = 4
	V1_7_6  Protocol = 5
	V1_8    Protocol = 47
	V1_9    Protocol = 107
	V1_9_1  Protocol = 108
	V1_9_2  Protocol = 109
	V1_9_3  Protocol = 110
	V1_10   Protocol = 210
	V1_11   Protocol = 315
	V1_11_1 Protocol = 316
	V1_12   Protocol = 335
	V1_12_1 Protocol = 338
	V1_12_2 Protocol = 340
	V1_13   Protocol = 393
	V1_13_1 Protocol = 401
	V1_13_2 Protocol = 404
)

type ScoreboardPosition

type ScoreboardPosition uint8
const (
	LIST ScoreboardPosition = iota
	SIDEBAR
	BELOW_NAME
)

type State

type State int8
const (
	HANDSHAKING State = iota
	STATUS
	LOGIN
	PLAY
)

type StringChatComponent

type StringChatComponent struct {
	Text string `json:"text"`
	*ChatComponent
}

func ChatMessage

func ChatMessage(text string) *StringChatComponent

func (*StringChatComponent) JSON

func (component *StringChatComponent) JSON() (string, error)

func (*StringChatComponent) SetText

func (component *StringChatComponent) SetText(text string)

type Type

type Type struct {
	Name    string `json:"name"`
	Version int    `json:"version"`
}

type VarBuffer

type VarBuffer struct {
	// contains filtered or unexported fields
}

func (*VarBuffer) Bytes

func (buff *VarBuffer) Bytes() []byte

func (*VarBuffer) Len

func (buff *VarBuffer) Len() int

func (*VarBuffer) Read

func (buff *VarBuffer) Read(p []byte) (n int, err error)

func (*VarBuffer) Write

func (buff *VarBuffer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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