WebSocketServices

该插件是一个持续演进的项目,旨在通过 WebSocket 为 Minecraft Bukkit 服务器提供 Web 支持。此 WebSocket 实现设计为轻量级且简单,以降低对游戏服务器本身的开销。支持 WebSocket 的客户端将能够执行简单的信息查询,例如谁在线、服务器运行的是哪个版本等。所有文本结果将以简单的 JSON 格式返回,以确保一致性。
服务
服务是基于文本的方法,客户端脚本可以通过 WebSocketServices 插件调用这些方法,以获取有关 Minecraft 服务器的更多信息。此外,每个服务都可以根据用户的偏好启用或禁用。以下列出的当前可用服务,并且可以通过使用自定义插件进行扩展:
- Info - 有关服务器的信息,如地址、MOTD(每日消息)、版本、游戏模式等。
- WHO - 有关当前在线用户的信息。
- Whitelist - 有关当前白名单用户的信息。
- Plugins - 有关服务器上运行的所有插件的信息。
- OfflinePlayers - 有关所有离线玩家的信息。
- Player - 有关特定玩家的信息。
示例站点
可以在下面列出的 URL 中找到针对此插件运行的客户端脚本实现的示例。该站点使用纯 HTML5 和 JS 运行。请注意,示例站点需要支持 HTML5 和 WebGL 的浏览器。
兼容性说明
本插件仅支持支持 Websockets Protocol 13 RFC 6455 的浏览器。这些浏览器包括:
- Firefox 11+
- Chrome 16+
- Safari 6+
- IE 10+
BUG 通知(1.1.6 及更低版本)
目前 offlinePlayer 服务中存在一个错误,导致对该服务的所有调用都被拒绝。这是一个非常简单的修复,将在 1.1.7 版本中修复。要修复您服务器上的问题,请转到此插件的 config.yml 并将 offlinePlayers 重命名为 offlineplayers。它必须全部为小写,如下所示。对于由此可能造成的任何不便,我深表歉意。
services: ... offlineplayers: true ...
配置
有关服务器配置的详细信息,请参阅此处。
面向非开发者
本插件包含一个客户端包,以示例形式提供。为了使用客户端包,您需要有一个托管网站或博客,以便在其中查看您的服务器信息。
博客实现的示例可以在 找到(如果无法访问该站点,敬请谅解。我目前的主机遇到问题)。
面向开发者
额外的名为 websocketservices.min.js 的客户端库可在 github 上找到,并包含在下载包中。该库应能提供最简单的实现。如果您更喜欢更复杂的内容或希望根据您的喜好定制内容,请阅读以下部分。
客户端开发说明
WebSocketServices API 可以在下面列出的 github wiki 位置找到。
代码实现的示例可以在 github 上的 'examples/client-side/' 中找到,也可以在上面列出的示例站点中找到。
扩展
WebSocketServices 可以通过自定义开发进行扩展。插件可以通过创建自己的 ApplicationLayer 并使用静态方法 WebSocketServices.registerApplicationLayer(Plugin plugin, IApplicationLayer applicationLayer) 进行注册来挂钩到 WebSocketServices 服务器。更多细节将在不久的将来在 github wiki 上发布。
源代码
插件的源代码和进一步开发可以在以下 github 仓库中找到:
WebSocketServices

This plug-in is an ongoing and evolving project with the intent to bring web support, through websockets, to the Minecraft bukkit servers. This implementation of websockets is designed to be light-weight and simple, reducing overhead to the game server itself. Clients that support websockets will have the ability to perform simple informational queries, such as who is online, what version the server is running on, etc. All text base results will be returned in a simple JSON format for consistency.
Services
Services are text-based methods that a client-side script can invoke through the WebSocketServices plug-in in order to retrieve more information about a Minecraft server. Additionally, each service can be enabled or disabled depending on the user's preference. The following services listed below are currently available and can be expanded through the use of custom plugins:
- Info - Information about the server such as the address, MOTD, version, game mode, etc.
- WHO - Information about the users currently online.
- Whitelist - Information about who is currently white-listed.
- Plugins - Information about all the plug-ins running on the server.
- OfflinePlayers - Information about all offline players.
- Player - Information about a specific player.
Sample site
A sample implementation of client-side scripting running against this plugin can be found at the URL listed below. The site is running in pure HTML5 & JS. Please note that the sample site requires an HTML5 & WebGL capable browser.
Compatibility Notes
This plugin is only supported by browsers that support Websockets Protocol 13 RFC 6455. These browsers include:
- Firefox 11+
- Chrome 16+
- Safari 6+
- IE 10+
BUG NOTICE (Versions 1.1.6 and lower)
There is currently a bug in the offlinePlayer service, where all calls to it are rejected. It's a very simple fix and will be fixed in version 1.1.7. To fix the issue on your server, go to config.yml for this plug-in and rename the offlinePlayers to offlineplayers. It must be all lower case, as show below. I apologize for any inconvenience this may be causing at this time.
services: ... offlineplayers: true ...
Configuration
Detailed information about your servers configuration can be found here.
For Non-Developers
A client-side package is included with this plug-in, in the form of an example. In order to use the client-side package, you will have to have either a hosted web-site or a blog, where your server information can be viewed.
An example of a blog implementation can be found at (apologies if the site cannot be reached. I'm currently having problems with my host).
For Developers
An additional client-side library called websocketservices.min.js is available on github and is included in the downloadable package. This library should be able to provide the most simplest of implementations. If you prefer something more complex or something that you'd like to tailor to your tastes, please read the sections below.
Client-Side Development Notes
The WebSocketServices API can be found at the github wiki location listed below.
Samples of code implementation can be found on github under 'examples/client-side/', as well as on the sample site listed above.
Extensions
WebSocketServices can be expanded through the use of custom development. Plug-ins can hook into the WebSocketServices server by creating their own ApplicationLayer and registering with static method WebSocketServices.registerApplicationLayer(Plugin plugin, IApplicationLayer applicationLayer). Further details will be released on the github wiki in the near future.
Source
Source code and further development of the plugin can be found at the following github repo:
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
下载 WebSocketServices
该插件现已包含在一个整合包中,其中包含 jar 文件、客户端库以及一个示例。如果您不想花费时间编写自己的代码或没有相关的技术背景,可以直接使用该示例。以下是对插件和客户端脚本所做的更改。
WebSocketServices 插件版本 2.0.0 更新内容
- 升级至 Spigot 1.8
- 添加了种子服务(seed service)。
- 添加了未记录的 JSON 支持,允许同时调用多个服务。
客户端脚本版本 2.0.0-R12 更新内容
- 支持 Spigot 1.8。BungeeCord 支持尚不完整,已被禁用。
- 新增对种子服务的支持。
- 添加了未记录的 JSON 支持,允许同时发送多条命令及参数,例如 '{ "commands": [{ "command": "info"}, { "command": "seed"}]}'
服务端配置
在您的 config.yml 中,offlineplayer 服务名称必须始终为小写。此插件的旧版本中,offlineplayer 服务的名称使用了大小写混合的形式。
客户端脚本
客户端库将不再随 jar 文件捆绑打包,您可以从以下位置获取:
客户端脚本需要以下库:
- jquery-1.8.2.min.js
其他已知问题
- 3D 头像功能在没有图像代理的情况下,或者直到 Mojang 为 Minecraft 皮肤服务器添加 CORS 支持之前,无法使用 webgl 选项。
- 玩家皮肤以区分大小写的方式存储,而 Bukkit 提供的白名单信息始终返回小写的用户名。如果玩家至少登录过您的服务器一次,则这不是问题。该问题仅出现在从未登录过服务器的白名单玩家身上。这就是为什么您在白名单服务中看到玩家头像显示为 'steve' 的原因。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧