Skip to content

SpencerSharkey/gomc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Go

Build Status Coverage Status Maintainability HitCount

Introduction

Go (golang) library for Minecraft utilities.

The only functionality currently implemented is a query client compatible with the vanilla Minecraft query protocol.

Planned packages:

Note: This package is being developed for use within the spencersharkey/mcapi application, aimed at exposing an HTTP client for various Minecraft-related utilities.

"query" Package Documentation

(*query.Request) Simple()

type SimpleResponse struct {
	Hostname   string `json:"hostname"`
	GameType   string `json:"gametype"`
	Map        string `json:"map"`
	NumPlayers int    `json:"numplayers"`
	MaxPlayers int    `json:"maxplayers"`
	HostPort   int16  `json:"hostport"`
	HostIP     string `json:"hostip"`
}

Simple request example:

req := query.NewRequest()
err := req.Connect("127.0.0.1:25565")
res, err := req.Simple()
{
  "hostname": "Revive Minecraft! http://revive.gg/chat",
  "gametype": "SMP",
  "map": "world",
  "numplayers": 4,
  "maxplayers": 128,
  "hostport": 25565,
  "hostip": "127.0.0.1"
}

(*query.Request) Full()

Note: FullResponse embeds the SimpleResponse struct

type FullResponse struct {
	SimpleResponse
	Info    map[string]string `json:"info"`
	Players []string          `json:"players"`
}

Full request example:

req := query.NewRequest()
err := req.Connect("127.0.0.1:25565")
res, err := req.Full()
{
  "hostname": "Revive Minecraft! http://revive.gg/chat",
  "gametype": "SMP",
  "map": "world",
  "numplayers": 4,
  "maxplayers": 128,
  "hostport": 25565,
  "hostip": "127.0.0.1",
  "info": {
    "game_id": "MINECRAFT",
    "plugins": "",
    "version": "1.12.2"
  },
  "players": [
    "SpencerSharkey",
    "RumBull",
    "lonemajestyk",
    "nakkirakki"
  ]
}

Releases

No releases published

Packages

No packages published

Languages