Native Velocity 插件版本: 3.3.0-SNAPSHOT
一款 Minecraft Velocity 插件,通过一系列简单命令来管理多个后端服务器。为您的网络中的服务器定义启动脚本,允许玩家在无需您干预的情况下从完全关闭状态启动它们!
为什么选择此插件?
此插件旨在允许 Velocity 服务器网络中的玩家启动后端 Minecraft 服务器,而无需服务器管理员进行手动干预,即使后端服务器已完全关闭也是如此。这是通过定义批处理脚本或任何其他首选程序来运行服务器的 run.bat 文件来实现的。当游戏内玩家使用启动或加入命令时,服务器将被启动,无需任何管理员手动引导服务器。
命令:
- /sc help - 显示帮助菜单
- /sc list - 返回网络上所有服务器的列表
- /sc info [server] - 显示所提供服务器的一些详细信息
- /sc start [server] - 运行给定服务器的启动脚本(如果已定义)
- /sc join [server] - 尝试将执行该命令的玩家重定向到指定服务器。如果服务器未在线,则将运行启动脚本,并在服务器启动后将玩家重定向至该服务器。
- /sc cancel_join - 取消因使用
/sc join 命令而产生的任何待处理的“延迟加入”
- /sc run_as [player] [command] - 以另一名玩家的权限运行 Server Control 命令,但权限检查通过运行
run_as 命令的玩家进行。例如,这允许您将一名玩家发送到特定服务器,即使他们没有所需的权限。
权限:
- servercontrol.base - 使用该插件做任何事情的基本权限;如果玩家没有此权限,他们无法使用
/sc。
- servercontrol.info - 运行
/sc info 命令的权限
- servercontrol.list - 运行
/sc list 命令的权限
- servercontrol.start - 使用
/sc start 启动任何服务器所需的基本权限。如果玩家拥有此权限,他们还不能启动服务器,还需要特定服务器本身的权限。(见下文)
- servercontrol.start.<server> - 允许玩家使用
/sc start <server> 启动指定服务器
- servercontrol.join - 使用
/sc join 加入任何服务器以及使用 /sc cancel_join 所需的基本权限。如果玩家拥有此权限,他们还不能启动服务器,还需要特定服务器本身的权限。(见下文)
- servercontrol.join.<server> - 允许玩家使用
/sc start <server> 加入指定服务器
- servercontrol.run_as - 运行
/sc run_as 命令的权限。所执行命令的权限检查按正常方式处理,仿佛 run_as 命令的原始用户(即不是命令所代表的玩家)使用了该命令。这意味着拥有特定服务器加入权限的玩家,如果他们拥有 run_as 权限,可以让没有这些权限的玩家仍然加入该服务器。
配置
配置文件应该是不言自明的,但如果您不知道如何设置脚本文件,这里有一个示例。将其粘贴到插件的 scripts 文件夹中的文件中,并根据 config.yml 中的 script-pattern 设置命名文件,以便插件可以找到它。
示例服务器启动脚本
@echo off
setlocal enabledelayedexpansion
:: ---
:: 设置
:: ---
:: 唯一服务器名称(用于检查服务器是否已在运行)
set serverName=my_server_name
:: 包含 Minecraft 服务器启动脚本的批处理文件
set batchDir=..\..\..\..\servers\my_server_folder
set batchFile=run.bat
:: !!!
:: 除非您知道自己在做什么,否则不要更改此行以下的任何内容 :)
:: !!!
set "windowName=[server-control] %serverName%"
set outFile=temp_%serverName%.tmp
:: ---
:: 检查服务器是否已在运行
:: ---
powershell -Command "(Get-Process -Name cmd, powershell | Where-Object {$_.MainWindowTitle -eq '%windowName%'}).Count" | findstr /C:"0" >nul
if errorlevel 1 (
echo Server process window is already running, has it crashed?
exit /b 10
)
:: ---
:: 在 batchDir 中启动 batchFile
:: ---
set "originalDir=%cd%"
pushd "%batchDir%"
start /min "%windowName%" cmd /c "%batchFile%
popd
exit /b 0
问题、错误或功能请求?
请使用此插件的 GitHub 仓库获取任何支持、功能请求等,因为我可能不会经常阅读这个 Modrinth 页面。
快速安全提示!
仅使用您自己创建或从可信来源获得的脚本。批处理等脚本语言可能被用来危害您的系统。
Native Velocity plugin version: 3.3.0-SNAPSHOT
A Minecraft Velocity plugin to manage multiple backend servers through a list of simple commands. Define startup scripts for the servers on your network to allow players in game to start them up (from a fully shut down state) without your intervention!
Why this plugin?
This plugin was made to allow players on a Velocity server network to start backend Minecraft servers without the need for manual intervention by a server admin, even if the backend server is completely shut down. This is done by defining a batch script or any other preferred program that will run the servers run.bat file. When an in-game player uses the startup or join commands, the server will be started up without the need for any admin to manually boot the server.
Commands:
- /sc help - Shows a help menu
- /sc list - Returns a list of all the servers on the network
- /sc info [server] - Shows some details about the provided server
- /sc start [server] - Runs the startup script for the given server (if defined)
- /sc join [server] - Tries to redirect the player running the command to the given server. If the server is not online, the startup script will be ran and the player will be redirected to the server once it has started up.
- /sc cancel_join - Cancels any pending "delayed joins" as a result of using the /sc join command
- /sc run_as [player] [command] - Runs a Server Control command as another player but runs the permission checks through the player running the run_as command. This would for example allow you to send a player to a specific server even if they do not have the required permissions.
Permissions:
- servercontrol.base - The basic permission to do anything with the plugin, if a player doesn't have this, they cannot use /sc.
- servercontrol.info - Permission to run the /sc info command
- servercontrol.list - Permission to run the /sc list command
- servercontrol.start - Basic permission needed to start any server with /sc start. If a player has this permission, they cannot yet start a server, they will also need the permission for the specific server itself. (see below)
- servercontrol.start.<server> - Allows the player to start the given server with /sc start <server>
- servercontrol.join - Basic permission needed to join any server with /sc join as well as permission to use /sc cancel_join. If a player has this permission, they cannot yet start a server, they will also need the permission for the specific server itself. (see below)
- servercontrol.join.<server> - Allows the player to join the given server with /sc start <server>
- servercontrol.run_as - Permission to run the /sc run_as command. The permission check for the command that is executed is handled normally as if the original user of the run_as command (so not the player the command is run for) would've used the command. This means that a player with join permissions for a specific server can make a player without those permissions still join that server if they have the run_as permission.
Config
The config should be self explanatory however if you do not know how to setup a script file, here is an example. Paste it in a file within the scripts folder of the plugin and name the file according to the script-pattern setting in the config.yml so the plugin can locate it.
Example server startup script
@echo off
setlocal enabledelayedexpansion
:: ---
:: Settings
:: ---
:: Unique server name (used to check if the server isn't already running)
set serverName=my_server_name
:: The batch file containing the startup script of the minecraft server
set batchDir=..\..\..\..\servers\my_server_folder
set batchFile=run.bat
:: !!!
:: Do not change anything below this line, unless you know what you are doing of course :)
:: !!!
set "windowName=[server-control] %serverName%"
set outFile=temp_%serverName%.tmp
:: ---
:: Check if server isn't already running
:: ---
powershell -Command "(Get-Process -Name cmd, powershell | Where-Object {$_.MainWindowTitle -eq '%windowName%'}).Count" | findstr /C:"0" >nul
if errorlevel 1 (
echo Server process window is already running, has it crashed?
exit /b 10
)
:: ---
:: Start the batchFile in batchDir
:: ---
set "originalDir=%cd%"
pushd "%batchDir%"
start /min "%windowName%" cmd /c "%batchFile%
popd
exit /b 0
Questions, bugs or feature requests?
Please use the github repo for this plugin for any support, feature requests, etc. as I will likely not read this Modrinth page much.
Quick security note!
Only use scripts that you yourself have created or that you have received from trusted sources. Scripting languages such as batch can be used to do harm to your system.
评论 0
登录后参与评分
还没有评论,来抢沙发吧