• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Sandertv/mcwss: A websocket server for Minecraft Bedrock Edition

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Sandertv/mcwss

开源软件地址(OpenSource Url):

https://github.com/Sandertv/mcwss

开源编程语言(OpenSource Language):

Go 100.0%

开源软件介绍(OpenSource Introduction):

mcwss

A documentation and implementation of the Minecraft Bedrock Edition websocket protocol.

Minecraft Websockets

Minecraft has websocket connection commands that may be used to connect to a websocket server. These commands are /connect and /wsserver. Both these commands have the same effect. Once connected to a websocket, the connection will last until the server closes it or until the player completely exits the game. The connection will last when a player merely leaves a world, and will thus last when joining a server. Websockets in Minecraft can be used for simple command communication between a player and a server. Additionally, the server can choose to listen for certain events sent by the client and act upon receiving them.

In order to be able to execute the /connect and /wsserver commands, cheats must be enabled. This means that connecting on third party servers is not possible, and only on the dedicated server when cheats are enabled. It is possible to connect on a singleplayer world and join a server after that, but commands executed by the websocket server will not work. Events will still be sent by the client however.

In the settings tab, there is also a setting that enables/disables encrypted websockets. mcwss implements encryption between websockets, so changing this setting will not have an effect on the behaviour of mcwss.

Getting Started

Prerequisites

mcwss is a Go library. To use it, Go must be installed. The library may be downloaded using go get github.com/sandertv/mcwss.

Usage

package main

import (
	"github.com/sandertv/mcwss"
)

func main() {
    // Create a new server using the default configuration. To use specific configuration, pass a *wss.Config{} in here.
    server := mcwss.NewServer(nil)
    
    server.OnConnection(func(player *mcwss.Player){
      // Called when a player connects to the server.
    })
    server.OnDisconnection(func(player *mcwss.Player){
      // Called when a player disconnects from the server.
    })
    // Run the server. (blocking)
    server.Run()
}

The server may now be connected to by joining a singleplayer game and executing the command /connect localhost:8000/ws.

Documentation

https://godoc.org/github.com/Sandertv/mcwss




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap