mirror of
https://github.com/jie65535/gc-opencommand-plugin.git
synced 2025-12-15 19:31:35 +08:00
2.4 KiB
2.4 KiB
gc-opencommand-plugin
中文 | English
A plugin that opens the GC command execution interface for third-party clients
Server installation
- Download the
jarin Release - Put it in the
pluginsfolder
Console connection
- When starting for the first time, a
opencommand-plugindirectory will be generated under thepluginsdirectory, open and editconfig.json - Set the value of
consoleTokento your connection key. It is recommended to use a long random string of at least 32 characters. - Restart the server to take effect
- Select the console identity in the client, and fill in your
consoleTokento run the command as the console identity
Build
git clone https://github.com/jie65535/gc-opencommand-plugincd gc-opencommand-pluginmkdir libmv path/to/grasscutter-1.x.x-dev.jar ./libgradle build
Player
- Fill in the service address in the client to confirm whether it supports
- Fill in the UID and send the verification code
- Fill in the 4-digit integer verification code received in the game into the client verification
- Enjoy the convenience!
Client request
pingto confirm whether theopencommandplugin is supportedsendCodesends a verification code to the specified player (re-send is not allowed within 1 minute), and save the returnedtoken- Send
verifycheck usingtokenand 4-digit integer verification code - If the verification is passed, you can use the
tokento execute thecommandaction
config.json
{
"consoleToken": "",
"codeExpirationTime_S": 60,
"tempTokenExpirationTime_S": 300,
"tokenLastUseExpirationTime_H": 48
}
API /opencommand/api
Example
https://127.0.0.1/opencommand/api
Request
public final class JsonRequest {
public String token = "";
public String action = "";
public Object data = null;
}
Response
public final class JsonResponse {
public int retcode = 200;
public String message = "success";
public Object data;
}
Actions
ping
data = null
sendCode
Request
data = uid (int)
Response
data = token (string)
verify: Requires token
Request
data = code (int)
Response
Success:
code = 200
Verification failed:
code = 400
command: Requires token
Request
data = command (string)
Response
data = message (string)