-
Notifications
You must be signed in to change notification settings - Fork 0
CLI Module
mega12345mega edited this page Jul 26, 2025
·
2 revisions
This module allows you to interface with both local and remote databases via a CLI. The nbtdatabase-cli-<version>-all.jar has all of the dependencies included, so it can be executed directly (java -jar nbtdatabase-cli-<version>-all.jar).
-
create <file>: Create a database file-
--overwrite/-o: Overwrite the file if it already exists instead of returning an error
-
-
open (local <file>) | (remote <ip> <port>): Open a database file or connect to a server -
close: Close the current database file or server connection -
server (start <port>) | stop: Start or stop a server (the server will automatically be stopped if the connection it is hosting is closed) -
config list | (<key> <value>): View the config or edit specific options -
entry:-
entry add <name> <file> <type> <data_version> <author_uuid> <author_username>: Add an entry-
--unverified/-uv: Set verified to false
-
-
entry edit <id>: Edit an entry-
--name/-n=<name>: Edit the name -
--file/-f=<file>: Edit the NBT -
--type/-t=<type>: Edit the type -
--data_version/-d=<data_version>: Edit the data version -
--author_uuid/-au=<author_uuid>: Edit the author UUID -
--author_username/-an=<author_username>: Edit the author username -
--verified/-v=<verified>: Edit the verified boolean
-
-
entry remove <id>: Remove an entry -
entry get <id>: Search for an entry with the specific id, setting the internal results list to only the result-
--verbose/-v: Show more information about the entry
-
-
entry export <id> <file>: Write an entry's NBT to a file-
--overwrite/-o: Overwrite the file if it already exists instead of returning an error
-
-
entry list: Search for entries, setting the internal results list to the results-
--name/-n=<query>: Search by name (looks for names containing the query) -
--nbt_length/-l=<query>: Search for entries with a specific number of bytes -
--nbt_length_min/-lmin=<query>: Search for entries with a minimum number of bytes -
--nbt_length_max/-lmax=<query>: Search for entries with a maximum number of bytes -
--type/-t=<query>: Search by entry type -
--data_version/-d=<query>: Search for entries with a specific data version -
--data_version_min/-dmin=<query>: Search for entries with a minimum data version -
--data_version_max/-dmax=<query>: Search for entries with a maximum data version -
--author_uuid/-au=<query>: Search by author UUID (looks for exact matches) -
--author_username/-an=<query>: Search by author username (looks for usernames containing the query) -
--tags/-g=<query>: Search by comma separated tags (the tag names have to match exactly, but this will return entries with additional tags) -
--order/-o=<query>: Specify the order of the results (name, nbt_length, data_version, author_uuid, author_username, created, modified) - `--reversed_order/-r: Return results in the reverse order
-
--offset/-f=<offset>: Skip a specific number of results, allowing you to see later entries if you are limited by the config's max_num_results -
--verbose/-v: Show more information about the entries
-
-
-
tag:-
tag add <name> <color>: Add a tag -
tag edit <currentName>: Edit a tag-
--name/-n=<name>: Edit the name -
--color/-c=<color>: Edit the color
-
-
tag remove <name>: Remove a tag -
tag get <name>: Search for a tag with the specific name -
tag list: Search for tags-
--name/-n=<query>: Search by name (looks for names containing the query) -
--entry_id/-e=<query>: Get the tags attached to a specific entry
-
-
tag attach <entry> <tag>: Attach a tag to an entry -
tag detach <entry> <tag>: Detach a tag from an entry
-
-
results: View the internal entry results list, allowing you to include or exclude--verbosewithout sending another request-
--verbose/-v: Show more information about the entries
-
-
exit: Closes everything and exits
Notes:
- Entry ids can take in
#<result index>instead of having to supply the whole id - Data versions can take in a Minecraft version (1.21.4, 25w21a) IF you were connected to the internet when the program was launched
- Author UUIDs don't have to have dashes (but if there is at least one dash, it must have all of them in the right spots)
- Colors are 6 digit hex color codes with no # or 0x prefix
Arguments passed when starting the CLI will be executed as commands, which can be used to start servers in a single command:
java -jar nbtdatabase-cli-<version>-all.jar "open local stuff.db" "server start 25560"
Note that later commands will not wait for the prior command to finish, only start:
# Works (database will process requests in order)
java -jar nbtdatabase-cli-<version>-all.jar "open local stuff.db" "tag add foo FFAA00" "tag attach 123456789 foo"
# Doesn't work (the CLI may close the connection before the database has returned a result)
java -jar nbtdatabase-cli-<version>-all.jar "open local stuff.db" "entry list" "exit"