Database-API 1.3

Asynchronous database api for bungee

  1. IngotStudios
    Native Minecraft Version:
    Legacy (< 1.13)
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    • 1.16
    Source Code:
    https://github.com/IngotStudios/async-database-api
    Contributors:
    Yassino, gusosasi
    This is an asynchronous database API which allows using MongoDB and MySQL asynchronously on BungeeCord.
    In the config you can set which database should be in use.
    Possible database types are "MONGODB" or "MYSQL"

    MongoDB:
    Code (Text):

    Get DatabaseHandler instance
    MongoDatabaseHandler databaseHandler = databaseService.getMongoDatabaseHandler();

    Get single `Document`
    Document mongoDocument = databaseHandler.getAsyncModel("CollectionName", Filters.eq("UUID", player.getUniqueId().toString()));

    Get `List` of `Document`
    List<Document> mongoDocumentList = databaseHandler.getAsyncModels("CollectionName");

    Insert `Document`
    Document mongoDocument = new Document();
    mongoDocument.put("UUID", player.getUniqueId().toString());
    databaseHandler.insertModel("CollectionName", mongoDocument);

    Update `Document`
    Document mongoDocument = new Document();
    mongoDocument.put("UUID", player.getUniqueId().toString());
    mongoDocument.put("Kills", 10);
    databaseHandler.updateModel("CollectionName", Filters.eq("UUID", player.getUniqueId().toString()), mongoDocument);

    databaseHandler.deleteModel("CollectionName", Filters.eq("UUID", player.getUniqueId().toString()));

     


    MySQL:
    Code (Text):


    Get DatabaseHandler instance
    MySQLDatabaseHandler databaseHandler = databaseService.getMySQLDatabaseHandler();

    Get single `ResultSet`
    String queryStatement = "SELECT * FROM `player_stats`";
    ResultSet resultSet = databaseHandler.getAsyncModel(queryStatement);

    Get `List` of `ResultSet`
    String queryStatement = "SELECT * FROM `player_stats`";
    List<ResultSet> resultSetList = databaseHandler.getAsyncModels(queryStatement);

    Execute Insert-Statement
    String insertStatement = "INSERT INTO `player_stats` (`UUID`, `KILLS`, `DEATHS`) VALUES ('" + player.getUniqueId.toString() + "', '0', '0')";
    databaseHandler.insertModel(insertStatement);

    Execute Update-Statement
    String updateStatement = "UPDATE `player_stats` SET `KILLS`='" + kills + "' WHERE `UUID`='" + player.getUniqueId.toString() + "'";
    databaseHandler.updateModel(updateStatement);

    Execute Delete-Statement
    String deleteStatement = "DELETE FROM `player_stats` WHERE `UUID`='" + player.getUniqueId.toString() + "'";
    databaseHandler.deleteModel(updateStatement);

     



    [​IMG]



    If you need any help you can contact us at https://discord.com/invite/9H4wxG9yBc

Recent Updates

  1. Wrong version
  2. New Version