{"id":35165194,"url":"https://github.com/eterline/go-mc-smp","last_synced_at":"2026-04-29T07:32:17.291Z","repository":{"id":329956670,"uuid":"1120462909","full_name":"eterline/go-mc-smp","owner":"eterline","description":"Go client for Minecraft JSON-RPC","archived":false,"fork":false,"pushed_at":"2025-12-23T11:41:44.000Z","size":290,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-24T00:47:54.296Z","etag":null,"topics":["json","json-rpc2","minecraft","minecraft-server","rpc","rpc-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eterline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-21T09:14:10.000Z","updated_at":"2025-12-23T11:41:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/eterline/go-mc-smp","commit_stats":null,"previous_names":["eterline/go-mc-smp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/eterline/go-mc-smp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgo-mc-smp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgo-mc-smp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgo-mc-smp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgo-mc-smp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eterline","download_url":"https://codeload.github.com/eterline/go-mc-smp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eterline%2Fgo-mc-smp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32416145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","json-rpc2","minecraft","minecraft-server","rpc","rpc-client"],"created_at":"2025-12-28T19:27:26.088Z","updated_at":"2026-04-29T07:32:17.285Z","avatar_url":"https://github.com/eterline.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# go-mc-smp\n\nGo client for Minecraft JSON-RPC\n\n\n## Installation\n\n```bash\ngo get github.com/eterline/go-mc-smp\n```\n\n## Features\n\n- Players management: list, kick\n- Allowlist management: get, add, remove, clear\n- Server control: status, save, stop, system messages\n- Gamerules: list, update\n- Fully asynchronous JSON-RPC over WebSocket\n- Context support and configurable call timeout\n- Server notification event listening\n\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/eterline/go-mc-smp\"\n)\n\nfunc main() {\n\tsmp, err := gomcsmp.NewClient(\"127.0.0.1\", 9100, \"YOUR_RPC_TOKEN\", gomcsmp.WithCallTimeout(10*time.Second))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer smp.Close()\n\n\tmsg := gomcsmp.SystemMessage{\n\t\tReceivingPlayers: []gomcsmp.Player{gomcsmp.NewPlayer(\"EterLine\")},\n\t\tOverlay:          false,\n\t\tMessage:          gomcsmp.NewMessage(\"hello\", \"hello\"),\n\t}\n\n\tsent, err := smp.ServerSystemMessage(context.Background(), msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Message sent:\", sent)\n}\n```\nSending a System Message\n![Use Screen](./screen/system_message.png)\n\n## Usage with notification events\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\tgomcsmp \"github.com/eterline/go-mc-smp\"\n)\n\nfunc main() {\n\tsmp, err := gomcsmp.NewClient(\"127.0.0.1\", 9100, \"YOUR_RPC_TOKEN\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer smp.Close()\n\n\tctx := context.TODO()\n\n\t// USE WITH NEW CHANNEL CREATE!\n\t// IF YOU WILL USE THAT IN for{}!\n\t// THAT CAN CAUSE GORUTINES LEAK!\n\tgamerulesCh := smp.NotifyGamerulesUpdates(ctx)\n\tplayersJoinedCh := smp.NotifyPlayersJoined(ctx)\n\tplayersLeftCh := smp.NotifyPlayersLeft(ctx)\n\tserverSavedCh := smp.NotifyServerSaved(ctx)\n\n\tfor {\n\t\tselect {\n\t\tcase u, ok := \u003c-gamerulesCh:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(\"gamerule update\", u.Key, u.Value)\n\n\t\tcase p, ok := \u003c-playersJoinedCh:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(\"player joined\", p.Name, p.ID)\n\n\t\tcase p, ok := \u003c-playersLeftCh:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(\"player left\", p.Name, p.ID)\n\n\t\tcase \u003c-serverSavedCh:\n\t\t\tfmt.Println(\"server saved world\")\n\t\t}\n\t}\n}\n```\n\n![Use Screen](./screen/server_events.png)\n![Use Screen](./screen/image.png)\n\n## DTO library schemas\n\n\n### Untyped Game Rule\n| Field |  Type  |\n|-------|--------|\n| value | string |\n| key   | string |\n\n### Typed Game Rule\n| Field | Type                          |\n|-------|-------------------------------|\n| type  | string (\"integer\", \"boolean\") |\n| value | string                        |\n| key   | string                        |\n\n```go\ntype GameRuleType string\n\nconst (\n\tUntypedGameRule GameRuleType = \"\"\n\tIntegerGameRule GameRuleType = \"integer\"\n\tBooleanGameRule GameRuleType = \"boolean\"\n)\n\n// GameRule - represents a game rule key-value pair in the server.\ntype GameRule struct {\n\tType  GameRuleType `json:\"type,omitempty\"`\n\tValue string       `json:\"value\"`\n\tKey   string       `json:\"key\"`\n}\n```\n\n### Incoming IP Ban\n| Field  | Type   |\n|--------|--------|\n| reason | string |\n| expires| string |\n| ip     | string |\n| source | string |\n| player | Player |\n\n```go\ntype IncomingIPBan struct {\n\tReason  string `json:\"reason\"`\n\tExpires string `json:\"expires\"`\n\tIP      string `json:\"ip\"`\n\tSource  string `json:\"source\"`\n\tPlayer  Player `json:\"player\"`\n}\n```\n\n### System Message\n| Field            | Type          |\n|------------------|---------------|\n| receivingPlayers | Array\u003cPlayer\u003e |\n| overlay          | boolean       |\n| message          | Message       |\n\n```go\ntype SystemMessage struct {\n\tReceivingPlayers *PlayerRegistry `json:\"receivingPlayers\"`\n\tOverlay          bool            `json:\"overlay\"`\n\tMessage          Message         `json:\"message\"`\n}\n\n```\n\n### Kick Player\n| Field  | Type    |\n|--------|---------|\n| player | Player  |\n| message| Message |\n\n```go\ntype KickPlayer struct {\n\tPlayer  Player  `json:\"player\"`\n\tMessage Message `json:\"message\"`\n}\n```\n\n### IP Ban\n| Field  | Type   |\n|--------|--------|\n| reason | string |\n| expires| string |\n| ip     | string |\n| source | string |\n\n```go\ntype IPBan struct {\n\tReason  string `json:\"reason\"`\n\tExpires string `json:\"expires\"`\n\tIP      string `json:\"ip\"`\n\tSource  string `json:\"source\"`\n}\n```\n\n### User Ban\n| Field  | Type   |\n|--------|--------|\n| reason | string |\n| expires| string |\n| source | string |\n| player | Player |\n\n```go\ntype UserBan struct {\n\tReason  string `json:\"reason\"`\n\tExpires string `json:\"expires\"`\n\tSource  string `json:\"source\"`\n\tPlayer  Player `json:\"player\"`\n}\n```\n\n### Message\n| Field               | Type           |\n|---------------------|----------------|\n| translatable        | string         |\n| translatableParams  | Array\u003cstring\u003e  |\n| literal             | string         |\n\n```go\ntype Message struct {\n\tTranslatable       string   `json:\"translatable\"`\n\tTranslatableParams []string `json:\"translatableParams\"`\n\tLiteral            string   `json:\"literal\"`\n}\n```\n\n### Version\n| Field    | Type    |\n|----------|---------|\n| protocol | integer |\n| name     | string  |\n\n```go\ntype Version struct {\n\tProtocol int    `json:\"protocol\"`\n\tName     string `json:\"name\"`\n}\n```\n\n### Server State\n| Field   | Type          |\n|---------|---------------|\n| players | Array\u003cPlayer\u003e |\n| started | boolean       |\n| version | Version       |\n\n```go\ntype ServerState struct {\n\tPlayers *PlayerRegistry `json:\"players\"`\n\tStarted bool            `json:\"started\"`\n\tVersion Version         `json:\"version\"`\n}\n```\n\n### Operator\n| Field               | Type    |\n|---------------------|---------|\n| permissionLevel     | integer |\n| bypassesPlayerLimit | boolean |\n| player              | Player  |\n\n```go\ntype Operator struct {\n\tPermission          int    `json:\"permissionLevel\"`\n\tBypassesPlayerLimit bool   `json:\"bypassesPlayerLimit\"`\n\tPlayer              Player `json:\"player\"`\n}\n```\n\n### Player\n| Field | Type   |\n|-------|--------|\n| name  | string |\n| id    | string |\n\n```go\ntype Player struct {\n\tName string     `json:\"name\"`\n\tID   *uuid.UUID `json:\"id,omitempty\"`\n}\n```\nAll upper schemas includes `*PlayerRegistry`\nThis structure Marshals and Unarshals as `[]Player` in JSON\n```go\nfunc NewPlayerRegistry(players []Player) *PlayerRegistry // player slice to registry\nfunc (r *PlayerRegistry) Players() []Player // getter for player slice\nfunc (r *PlayerRegistry) IDs() []uuid.UUID // returns only existed ids\n```\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feterline%2Fgo-mc-smp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feterline%2Fgo-mc-smp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feterline%2Fgo-mc-smp/lists"}