⚙️
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 Commands Module?
  • How to define command configurator?
  1. Modules
  2. Internal Modules

Commands Module

PreviousInternal ModulesNextParent commands

Last updated 8 months ago

Thanks to this module you can create parent commands and every sub-command in separate classes.

You can add a tab completer to the parent command, but it won't be required.

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>commands</artifactId>
   <version>{VERSION}</version>
</dependency>
allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}
  
 dependencies {
   implementation 'com.github.timsixth.MinigameAPI:commands:{VERSION}'    
}

How to register Commands Module?

//Add new instance of Commands Module to registerModules method in configure method
    @Override
    protected LibraryConfiguration configure() {
        commandsModule = new CommandsModule(this);
        //or use your own command configurator
        commandsModule = new CommandsModule(this, new MyCommandConfigurator());
        return new LibraryConfiguration(this, getConfiguratorsInitializer())
                .builder()
                .setGameManager(new MyGameManager(this, settings, messages))
                .registerModules(commandsModule) //new way how to register command module
                .build();
    }

How to define command configurator?

public class MyCommandConfigurator extends DefaultCommandConfigurator {

    @Override
    public CommandConfiguration configure() {
        return CommandConfiguration.builder()
                .doNotHavePermissionMessage("No permission")
                .onlyPlayersMessage("Only players can use this command")
                .build();
    }
}
https://github.com/timsixth/MinigameAPI/releases