MinecraftREST
MinecraftREST 的第一个稳定版本,这是一个用于 Minecraft 服务器的强大 REST API 接口,为服务器管理和玩家互动提供安全的端点。
? 功能特性
- ? 安全的 JWT 身份验证
- ? 用于服务器管理的 RESTful API 端点
- ? 玩家管理(踢出、游戏模式、消息发送)
- ? 服务器信息和统计信息
- ⚡ 速率限制保护
- ? 实时玩家和世界数据
? 要求
- Java 17 或更高版本
- Spigot/Paper 服务器 1.20.4
? 安装
- 从此发布页面下载
minecraft-rest-1.0.0.jar
- 将其放入服务器的
plugins 文件夹中
- 启动/重启服务器
- 在
plugins/MinecraftREST/config.yml 中配置插件
配置
插件会在 plugins/MinecraftREST/ 目录下创建 config.yml 文件,包含以下选项:
# API 配置
api-port: 4567 # HTTP API 运行的端口
# 安全配置
security:
jwt-secret: "your-secret-key-here" # 请更改为安全的随机字符串
max-requests-per-minute: 60 # 速率限制阈值
admin-credentials:
username: "admin" # 请更改为安全的用户名
password: "change-this-password" # 请更改为安全的密码
⚠️ 重要提示:在生产环境中使用前,请更改默认的安全设置!
API 文档
API 使用 OpenAPI (Swagger) 规范进行文档化。您可以在以下位置找到完整的 API 文档:
api-docs/swagger.yaml - OpenAPI 3.0 规范文件
- 将此文件导入到以下工具中:
API 快速概览
除 /api/auth/login 外,所有端点都需要通过 Bearer token 进行 JWT 身份验证。
-
身份验证
POST /api/auth/login - 获取 JWT 令牌
-
服务器管理
GET /api/server/info - 获取服务器信息
POST /api/server/command - 执行控制台命令
POST /api/broadcast - 广播消息
-
玩家管理
GET /api/players - 列出在线玩家
POST /api/player/message - 向玩家发送消息
POST /api/player/kick - 踢出玩家
POST /api/player/gamemode - 更改玩家游戏模式
MinecraftREST
The first stable release of MinecraftREST, a powerful REST API interface for Minecraft servers that provides secure endpoints for server management and player interactions.
? Features
- ? Secure JWT Authentication
- ? RESTful API endpoints for server management
- ? Player management (kick, gamemode, messaging)
- ? Server information and statistics
- ⚡ Rate limiting protection
- ? Real-time player and world data
? Requirements
- Java 17 or higher
- Spigot/Paper server 1.20.4
? Installation
- Download the
minecraft-rest-1.0.0.jar from this release
- Place it in your server's
plugins folder
- Start/restart your server
- Configure the plugin in
plugins/MinecraftREST/config.yml
Configuration
The plugin creates a config.yml file in plugins/MinecraftREST/ with the following options:
# API Configuration
api-port: 4567 # The port on which the HTTP API will run
# Security Configuration
security:
jwt-secret: "your-secret-key-here" # Change this to a secure random string
max-requests-per-minute: 60 # Rate limiting threshold
admin-credentials:
username: "admin" # Change this to a secure username
password: "change-this-password" # Change this to a secure password
⚠️ Important: Change the default security settings before using in production!
API Documentation
The API is documented using the OpenAPI (Swagger) specification. You can find the full API documentation in:
api-docs/swagger.yaml - OpenAPI 3.0 specification file
- Import this file into tools like:
Quick API Overview
All endpoints except /api/auth/login require JWT authentication via Bearer token.
-
Authentication
POST /api/auth/login - Get JWT token
-
Server Management
GET /api/server/info - Get server information
POST /api/server/command - Execute console command
POST /api/broadcast - Broadcast message
-
Player Management
GET /api/players - List online players
POST /api/player/message - Send message to player
POST /api/player/kick - Kick player
POST /api/player/gamemode - Change player gamemode
评论 0
登录后参与评分
还没有评论,来抢沙发吧