A Minecraft Database that uses scoreboard to save/load data. Well if Mojang doesn't nerf their scoreboard API.
Benefits:
- Easy to use
- Encryption support (not as secure as crypto but you get the idea)
Import Database class
import { JaylyDB } from "./JaylyDB";Create a new JaylyDB object with the scoreboard objective 'my_database'
import { JaylyDB } from "./index";
const db = new JaylyDB("my_database");To enable encryption in database in favor of better performance, set 2nd parameter to true. By default encryption is disabled in databases:
import { JaylyDB } from "./index";
const db = new JaylyDB("my_database", false);Set some values in the database
db.set("foo", "bar");
db.set("baz", 42);Note: JaylyDB now writes data to the world asynchronously. Please check the Content Log to ensure that the data is successfully written to the scoreboard before exiting the world
Get a value from the database
const value = db.get("foo");
console.log(value); // Output: 'bar'Check if a key exists in the database
const hasKey = db.has("baz");
console.log(hasKey); // Output: trueIterate over the entries in the database
db.forEach((value, key) => {
console.log(`${key}: ${value}`);
});Remove an entry from the database
db.delete("baz");Clear all entries from the database
db.clear();This database is compatible with Minecraft 1.19.0 and above.
This database is benchmarked using tests.js. The test file records the time taken to execute get, set, has and delete operations with different content length and difference between whether the data is encoded or not.
| Content Length | set time |
set time (encrypted) |
get time |
has time |
delete time |
|---|---|---|---|---|---|
| 0 bytes | 19 ms | 20 ms | 1 ms | 0 ms | 1 ms |
| 10,000 bytes | 48 ms | 776 ms | 0 ms | 0 ms | 2 ms |
| 20,000 bytes | 83 ms | 1517 ms | 1 ms | 0 ms | 4 ms |
| 30,000 bytes | 139 ms | 2325 ms | 0 ms | 0 ms | 5 ms |
Note: 100 elements with different data length are inserted into individual database, and it doesn't record time taken to write data to world.
Made by Jayly