Projects
View on GitHub
API
jie65535/gc-opencommand-plugin
About
A plugin that open the GC command execution interface for third-party clients
Other ProjectsMeasured star growth
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README_en-US.md
Originalgc-opencommand-plugin
中文 | English
A plugin that opens the GC command execution interface for third-party clients
Since 1.7.0, multiple commands can be separated by | or newline, for example:
/a 1 | /a 2
/a 3
Invoking ping the response data will contain the plugin version.
Applications using this plug-in
- GrasscutterTools —— Windows Client Tools
- JGrasscutterCommand —— Mirai Plugin, run commands in QQ
- Yunzai-GrasscutterCommand —— Yunzai-bot plugin, execute commands in QQ
- More...
Server installation
- Download the
jarin Release - Put it in the
grasscutter/pluginsfolder - Restart
grasscutterserver
Player
- Fill in the service address in the Tool to check plugin status
- Fill in the UID and send the verification code
- Fill in the 4-digit integer verification code received in the game into the Tool verification
- Enjoy the convenience!
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. (automatically generated when empty is detected) - 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
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
Build
git clone https://github.com/jie65535/gc-opencommand-plugincd gc-opencommand-pluginmkdir libmv path/to/grasscutter-1.x.x-dev.jar ./libgradle build
Multi server
Master server (Dispatch)
- Open
config.jsonin theopencommand-plugindirectory - Modify the
socketPortvalue to an unused port - Set
sockettokenmulti server communication key. It is recommended to use a long random string of at least 32 characters. - Restart the server to make the configuration effective
Sub server (Game)
- Open
config.jsonin theopencommand-plugindirectory - Modify the
sockethostandsocketportvalues to the address and port of the primary server - Set the same value of
sockettokenand the primary server - Set the
socketDisplayNamevalue to your server name (See below for usage Jump) - Restart the server to make the configuration effective
config.json
{
// console connection token (automatically generated when empty is detected)
"consoleToken": "",
// Verification code expiration time (seconds)
"codeExpirationTime_S": 60,
// Temporary token expiration time (seconds)
"tempTokenExpirationTime_S": 300,
// Authorization token last used expiration time (hours)
"tokenLastUseExpirationTime_H": 48,
// Multi-server communication port
"socketPort": 5746,
// Multi-server communication key
"socketToken": "",
// Multi-server Dispatch server address
"socketHost": "127.0.0.1",
// multi-server display name
"socketDisplayName": ""
}
API /opencommand/api
Example
https://127.0.0.1/opencommand/api
Request
public final class JsonRequest {
public String token = "";
public String action = "";
public Seting server = "";
public Object data = null;
}
Response
public final class JsonResponse {
public int retcode = 200;
public String message = "Success";
public Object data;
}
Actions
Test connect
Request
| Request | Request data | type |
|---|---|---|
| action | ping |
String |
Response
| Response | Response data | type |
|---|---|---|
| retcode | 200 |
String |
| message | Success |
String |
| data | null |
null |
Get online players
Request
| Request | Request data | type |
|---|---|---|
| action | online |
String |
Response
| Response | Response data | type |
|---|---|---|
| retcode | 200 |
String |
| message | Success |
String |
| data | {"count": 0, playerList": []} |
JsonObject |
Send code
Request
| Request | Request data | type |
|---|---|---|
| action | sendCode |
String |
| data | uid |
Int |
Response
| Response | Response data | type |
|---|---|---|
| retcode | 200 |
String |
| message | Success |
String |
| data | token |
String |
Verify code
Request
| Request | Request data | type |
|---|---|---|
| action | verify |
String |
| token | token |
String |
| data | code |
Int |
Response
Success
| Response | Response data | type |
|---|---|---|
| retcode | 200 |
String |
| message | Success |
String |
| data | null |
null |
Failed
| Response | Response data | type |
|---|---|---|
| retcode | 400 |
String |
| message | Verification failed |
String |
| data | null |
null |
Run command
Request
| Request | Request data | type |
|---|---|---|
| action | command |
String |
| token | token |
String |
| data | command |
String |
Response
Success
| Response | Response data | type |
|---|---|---|
| retcode | 200 |
String |
| message | Success |
String |
| data | Command return |
String |
Run console command
Get run mode
Request
| Request | Request data | Type |
|---|---|---|
| action | runmode |
String |
| token | token |
String |
Response
Success
| Request | Response data | Type |
|---|---|---|
| retcode | 200 |
Int |
| message | Success |
String |
| data | 1 (Multi server) / 0 (Single server) |
Int |
Get mulit server list
Request
| Request | Request data | Type |
|---|---|---|
| action | server |
String |
| token | token |
String |
Response
Success
| Request | Response data | Type |
|---|---|---|
| retcode | 200 |
Int |
| message | Success |
String |
| data | {} |
JsonObject |
{
"retcode": 200,
"message": "success",
"data": {
// Server UUID
"13d82d0d-c7d9-47dd-830c-76588006ef6e": "2.8.0 Server",
"e6b83224-a761-4023-be57-e054c5bb823a": "2.8.0 Dev server"
}
}
Run command
Request
If it is a single server, there is no need to fill in server UUID.
| Request | Request data | Type |
|---|---|---|
| action | command |
String |
| token | token |
String |
| server | UUID |
String |
| data | command |
String |
Response
Success
| Request | Response data | Type |
|---|---|---|
| retcode | 200 |
Int |
| message | Success |
String |
| data | Command return |
String |
Explore related projects
Loading…