⚙️
T-MiniGameAPI
WebsiteDiscord
2.0.0
2.0.0
  • 🏠Home
  • 💻Maven and Gradle
  • 📦Minigame setup
  • 🖱️Plugins are using this libarary
  • Basic features
    • 🗺️Configuration
      • 🎯Configurators
      • 🔴Override Configuartors
    • 🧑Models
      • 📦File model
        • 🟢Single file
        • 🟠Many files
      • 🧑‍🦱Users
    • 📔Loaders
      • 📗Loader
        • 📂File loader
  • Minigame features
    • 🅰️Arena system
      • 🟢Arena
      • 🔵ArenaManager
    • 🎮Game system
      • 🔴Game Manager
      • 🔵Game State
      • 🟡Users in game
      • 🟢Teams
    • ⏰Timers
      • 😀SimpleTimer
      • ✨XpTimer
    • 🪙Coins system
      • 🟢UserCoins
      • 🔵UserCoinsManager
    • ✨Statistics system
      • 🟢Default statistics system
      • 🔵Your own statistics system
    • 💥Cosmetics system
      • 📀Cosmetic
        • 💕ParticleCosmetic
      • ✳️Cosmetics Manager
      • 🧒Users' cosmetics
        • 💿UserCosmeticsManager
        • ✅UserCosmetics
  • Modules
    • 🔌What is module ?
    • 🗒️Modules list
    • Internal Modules
      • Commands Module
        • 🧔Parent commands
        • 🧒Sub commands
        • 📑Tab completer
        • ®️Command registration
      • SQL Module
        • 💡DbModel
        • SQLDatabaseDao
        • 💾Database loader
        • SQLDatabaseAdapter
        • SQLDatabaseMigrator
      • MongoDB Module
        • MongoDbConnector
        • 💡MongoDbModel
        • MongoDbDao
        • 💾MongoDb loader
    • 💾How to create module?
Powered by GitBook
On this page
  • How to register SQL Module?
  • How to define SQL Module configurator (Optional)?
  1. Modules
  2. Internal Modules

SQL Module

PreviousCommand registrationNextDbModel

Last updated 8 months ago

Module must be shaded to your JAR file

{VERSION} - current version form GitHub releases section:

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

<dependency>
   <groupId>com.github.timsixth.MinigameAPI</groupId>
   <artifactId>sql-databases-support</artifactId>
   <version>{VERSION}</version>
</dependency>
allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}
  
 dependencies {
   implementation 'com.github.timsixth.MinigameAPI:sql-databases-support:{VERSION}'    
}

How to register SQL Module?

//Use SQLLibraryConfiguration instend of LibraryConfiguration
    //Type list with SQLModule
    @Override
    protected LibraryConfiguration configure() {
        return new SQLLibraryConfiguration(this, getConfiguratorsInitializer(),
                () -> Collections.singletonList(new SQLModule())) //you can register modules before others
                .builder()
                .setGameManager(new MyGameManager(this, settings, messages))
                .build();
    }

with custom SQL module configuration (Optional but recommended)

    @Override
    protected LibraryConfiguration configure() {
        return new SQLLibraryConfiguration(this, getConfiguratorsInitializer(),
                () -> Collections.singletonList(new SQLModule(new MySQLModuleConfigurator().configure()))) //you can register modules before others
                .builder()
                .setGameManager(new MyGameManager(this, settings, messages))
                .build();
    }

How to define SQL Module configurator (Optional)?

public class MySQLModuleConfigurator extends DefaultSQLModuleConfigurator {

    @Override
    public SQLModuleConfiguration configure() {
        return SQLModuleConfiguration.builder()
                .sqlDatabaseAdapter(new CustomSQLDatabaseAdapter()) //if you want to create your own SQL Database adapter
                .sqlDatabaseMigrator(new CustomDatabaseMigrator()) //if you want to create your own SQL Database migrator
                .build();
    }
}
https://github.com/timsixth/MinigameAPI/releases