Download Knowledge Book — Minecraft Mods — MetaMods
Knowledge Book

Knowledge Book

Active

Downloads

0

Last update

1 year ago

Versions

1.20 — 1.21.1
Server
Fabric
Neoforge
Forge
Quilt
Control
Storage
Utils

Knowledge Book — Revolutionary Database Plugin

Knowledge Book is a minimalistic solution for Java developers looking to replace standard local YML files with the powerful MongoDB database. This tool is ideal for creating modern plugins that require reliable information storage.

Quick preview of Knowledge Book

How It Works

The plugin uses the advanced MongoDB API to automatically convert Java classes into database documents. Its main task is to ensure smooth integration of this functionality into your projects.

Example of Java Conversion to MongoDB Document

package to.lodestone.example.data;

import com.fasterxml.jackson.annotation.JsonProperty;
import to.lodestone.knowledgebook.annotation.Collection;

@Collection(name = "person_collection")
public class Person {

    @JsonProperty("fullName")
    private String fullName;

    @JsonProperty("socialSecurityNumber")
    private String socialSecurityNumber;

    // Constructor for Knowledge Book to create an empty object
    public Person() {

    }

    public Person(String fullName, String socialSecurityNumber) {
        this.fullName = fullName;
        this.socialSecurityNumber = socialSecurityNumber;
    }

    @JsonProperty("fullName")
    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    @JsonProperty("fullName")
    public String getFullName() {
        return fullName;
    }

    @JsonProperty("socialSecurityNumber")
    public void setSocialSecurityNumber(String socialSecurityNumber) {
        this.socialSecurityNumber = socialSecurityNumber;
    }

    @JsonProperty("socialSecurityNumber")
    public String getSocialSecurityNumber() {
        return socialSecurityNumber;
    }
}

Integration into Your Plugin

Here's how easily you can use Knowledge Book in your own project:

package to.lodestone.example;

import org.bukkit.plugin.java.JavaPlugin;
import org.mongojack.JacksonMongoCollection;
import to.lodestone.conquest.data.Person;
import to.lodestone.knowledgebook.IKnowledgeBookAPI;
import to.lodestone.knowledgebook.KBHook;

public class TestPlugin extends JavaPlugin {

    private KBHook kbHook;
    @Override
    public void onEnable() {
        this.kbHook = new KBHook(this);

        JacksonMongoCollection<Person> personCollection = this.kbHook.api().getOrCreateCollection(Person.class);
        personCollection.insertOne(new Person("John Doe", "4355678656"));
    }

    public IKnowledgeBookAPI db() {
        return kbHook.api();
    }
}

After starting the server, a collection named "person_collection" is automatically created, containing a new Person document with all the information you provided.

Knowledge Book at work

IMPORTANT: For the plugin to work correctly, you must properly specify the variables in the configuration file:

database: null
connectionString: null
Project members
lullaby6

lullaby6

Created: 15 Jul 2024

ID: 26331