⚙️
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
  1. Modules
  2. Internal Modules
  3. Commands Module

Parent commands

Every parent command must extend ParentCommand.

Parent command has three constructors.

  1. First constructor

This constructor requires all parameters:

  • permission (first param)

  • hasArguments (second param)

  • onlyPlayers (third param)

  • usePermission (fourth param)

 public MyCommand() {
    super("minigame.admin", true, true, true);
 }
  1. Second constructor

This constructor requires four parameters:

  • permission (first param)

  • onlyPlayers (second param)

  • usePermission (third param)

  • hasArguments (in this constructor this field is set to false)

 public MyCommand() {
    super("minigame.admin", true, true);
 }
  1. Third constructor

This constructor doesn't have parameters,everything is set to default value like false, empty string.

The parent command class has three methods to implement:

  • excecuteCommand - executes command

  • getName - gets command name, this is so important for addons system

  • getTabCompleter - gets tab completer for command (Optional)

The whole implementation of the command class.

 public class MyCommand extends ParentCommand {

    public MyCommand() {
        super("command.admin", true, true, true);
        
        addSubCommand(new MySubCommand());
    }

    @Override
    protected boolean executeCommand(CommandSender sender, String[] args) {
        Player player = (Player) sender;

        player.sendMessage("test");

        return false;
    }

    @Override
    public String getName() {
        return "mycommand";
    }

}
PreviousCommands ModuleNextSub commands

Last updated 8 months ago

🧔