HomeJavaModsNDatabase - Fast data model creation - Powerful Async / Sync API
NDatabase - Fast data model creation - Powerful Async / Sync API
ModsJava

NDatabase - Fast data model creation - Powerful Async / Sync API

Lightweight opensource and easy to use INDEXED key-value database multi-platform framework. Free Minecraft Java mod for 1.7, 1.8, 1.9.

⬇ Download on Spigot
[​IMG]

[​IMG] [​IMG] [​IMG] [​IMG] [​IMG] [​IMG]

What is NDatabase API ?

NDatabase is a lightweight and easy to use indexed key-value store database framework mainly aimed for minecraft servers and is multi-platform (currently supporting Bukkit / Spigot servers).
It can be used as a plugin, so you can install it once and use it everywhere without having to configure a database and duplicate connection pool each time you develop a new plugin.

The API provide a fluent way to handle Async data fetch and server main thread callback with async to sync mechanism. NDatabase can support multiple databases (currently MySQL, SQLite, and MongoDB implementation). NDatabase can support java 8 from 18 and higher and all minecraft server version (tested from 1.8 to 1.19+).

NDatabase WIKI - Github page

Benefits of using NDatabase

Create a Repository

When NDatabase is running on your server, Creating the schema and repository for your data model is very easy, you can actually do that with one line of code.
Code (Java):
Repository <UUID, PlayerStatsDTO > repository = NDatabase. api ( ). getOrCreateRepository (PlayerStatsDTO. class ) ;
Async / Sync usage of your repository

You should never do I/O and database operation in your minecraft main thread, that's why the repository provide a fluent API to retrieve data asynchronously and then run a callback in your main thread if needed.

Async and Sync examples
Click to expand...
Code (Java):

// Async to Sync (get data async and consume it in the main thread)
blockRepository. getAsync ( "id" )
        . thenSync ( (bloc ) -> {
            placeBlockInWorld (bloc ) ;
        } ) ;

// Full Async (get data async and consume it in the same async thread)
playerRepository. getAsync (joinedPlayer. getUUID ( ) )
        . thenAsync ( (playerDTO ) -> {
            loadPlayer (playerDTO ) ;
        } ) ;
 
Query Example : Get best players, which have score >= 100 or a specific discord id
Click to expand...
Code (Java):

List <PlayerData > bestPlayers = repository. find (NQuery. predicate (
          "$.statistics.score >= 100 || $.discordId == 3432487284963298"
) ) ;
 
[​IMG]
Wanna try this out ?

You can get the API of NDatabase with gradle or maven and try it.
I also recommend your to check out the github page for the full documentation about the installation, best practice and future updates.
Code (Text):

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.NivixX.NDatabase</groupId>
    <artifactId>ndatabase-api</artifactId>
    <version>1.0.0</version>
    <scope>provided</scope>
</dependency>

NDatabase - Fast data model creation - Powerful Async / Sync API is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 2,131 times (via Spigot). Download it and open it directly in the game.

Explore more