Description
CGUtils Minecraft Forge Mod
1.12+ Minecraft mod.
NOTICE
This mod is no longer maintained. Many of the functionalities of this mod are available in Minecraft 1.16+ and it is recommended to use that instead.
Source Code
/update
The update command is used to download files to the server using http. It can only be used by server admin.
Stacked Commands
Stacked commands are commands that will run a set of commands in series. Stacked commands have individual permission settings and have support for arguments.
/sudo
The sudo command is designed to be used inside stacked commands when a non op player needs to run an admin command or when a fake player (eg: open computers) needs to run an admin command. Permission for this command is specific to each individual player.
Other Features
IP updater
The IP updater can query a web server for the IP address of a server using a HTTP POST request. This is useful if you host a server and your IP address is dynamic.
Update Command
The update command fetches a file from a url and saves it to the server. An example use of this command is updating a minetweaker script while the server is running without needing to access the server. The config is saved in a JSON format and must contain the following fields:
| Field | Description | |--------------|------------------------------------------------------------------| | name | A unique name to reference the download in-game. | | saveLocation | The location the file should be saved at relative to the server. | | url | The URL of the file that should be downloaded | | group | A group name which can be shared with different downloads. |
Downloads can be in different groups. An entire group can be downloaded at once instead of running each command individually. (eg: all minetweaker scripts would share the same group).
Example JSON file for a download:
json
{
"name":"tinkers",
"saveLocation":"scripts/",
"url":"" rel="noopener nofollow" target="_blank">http://example.com/minetweaker_scripts/tinkers.zs",
"group":"minetweaker"
}
The above file could be downloaded using one of the following commands:
/update get tinkers<br />
/update group minetweaker<br />
/update url http://example.com/minetweaker_scripts/tinkers.zs scripts/<br />
Stacked Commands
Stacked commands are customisable commands that run a predefined set of other commands when executed. Thay can also be used to allow non-opped players to run a specific admin command with preset arguments. The command is set in config using a JSON format.
| Field | Description | |------------|----------------------------------------------------------------------------------| | name | A unique name to reference the stacked command in-game. | | requiresop | Boolean value which defines whether the player must be an op to run the command. | | commands | An array of commands which should be run when the stacked command is run. | | group | A group name which can be shared with different downloads. |
Arguments can also be added to the stacked command by inserting {{index}} into the string. The sender's display name can also be used in the command by inserting {{sender}} into the string.
This example will take 3 arguments and print them back into the sender's console as a way of noting down co-oridnates
{
"name":"notecoords",
"requiresop":false,
"commands": [
"tellraw {{sender}} {\"text\":\"Noted Co-Ordinates\"}",
"tellraw {{sender}} {\"text\":\"{{0}}\"}",
"tellraw {{sender}} {\"text\":\"{{1}}\"}",
"tellraw {{sender}} {\"text\":\"{{2}}\"}"
]
}
If the user typed /notecoords 143 67 762 it would output the following to their chat:
Noted Co-Ordinates
143
67
762
Sudo Command
The sudo command allows any command to be run as if it had been typed into the server console. It has player specific permissions and is meant to be used where a player cannot be given permssion to run the command (eg: fake player).
If a non-opped player was given permission to use the sudo command they could do something like the following:
/op logdotzip
> You do not have permission to use this command
/sudo op logdotzip
> opped logdotzip
IP Address Updater
The IP address updater function will send the server IP address to a web server which can store the IP address. It also allows the client to automatically request the IP address and update the servers list.
This function was designed to be used with the Minecraft IP updater tool but can be set up to work with any web server.
Requests to get and set the IP address are HTTP POST requests which are configured in JSON files.
Uploading the Server IP Address
The server URL and additional form data is set in cgutils/upload.json. Form data with the key "address" will be added containing the IP address
{
"url": "Web Server Url",
"formdata": [
["form data", "value"],
["form data 2", "value"]
]
}
optionally an external script can be used to upload the IP address to the server.
{
"command": "shell command"
}
Downloading the Server IP Address The server URL and additional form data is set in cgutils/download.json. The IP address should be the page content. The URL and form data should be in the same format as setting the IP address.
Unlike setting the IP address, an external script or command cannot be used to retrieve the IP address.
The name of the server will be "CGUtils Auto Updating IP Address" when it is first added. It may be modified by the user.
{
"url": "Web Server Url",
"formdata": [
["form data", "value"],
["form data 2", "value"]
]
}


