Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

Using_The_Quick_Start_Module

Nico edited this page Sep 17, 2020 · 15 revisions

Using the quickstart module

The QuickStart module was designed to be used on Spigot/BungeeCord and to make the usage of the SimplixCore as easy as possible. It allows you to check whether the SimplixCore was properly installed on your server. You can configure it to download the SimplixCore if the check fails or to not enable your plugin.

Maven Dependencies

 <repository>
  <id>SimplixPublic</id>
  <url>https://repo.simplix.dev/repository/simplixsoft-public/</url>
</repository>

Spigot QuickStart module:

<dependency>
  <groupId>dev.simplix</groupId>
  <artifactId>simplixcore-minecraft-spigot-quickstart</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

BungeeCord QuickStart module:

<dependency>
  <groupId>dev.simplix</groupId>
  <artifactId>simplixcore-minecraft-bungeecord-quickstart</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Usage:

This example was made for BungeeCord but it also applies for Spigot.

import dev.simplix.core.common.CommonSimplixModule;
import dev.simplix.core.common.aop.SimplixApplication;
import dev.simplix.core.common.inject.SimplixInstaller;
import dev.simplix.core.minecraft.bungeecord.dynamiccommands.DynamicCommandsSimplixModule;
import dev.simplix.core.minecraft.bungeecord.dynamiclisteners.DynamicListenersSimplixModule;
import dev.simplix.core.minecraft.bungeecord.quickstart.SimplixQuickStart;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;

public class ExampleSimplixPlugin extends Plugin {

  @Override
  public void onEnable() {
    if (!SimplixQuickStart.ensureSimplixCore(this)) {
      /*
       * Handling the lack of the SimplixCore here...
       * Example possibilities
       * 1) Try to download it
       * 2) Disable plugin
       * and or Encourage user to install it using
       * /simplix install (will be automatically registered by the SimplixQuickStartModule when the plugin is not present)
       */
      return;
    }

    SimplixInstaller
        .instance()
        .register(
            ExampleApplication.class,
            new CommonSimplixModule(),
            new DynamicCommandsSimplixModule(this),
            new DynamicListenersSimplixModule(this));
  }
}

ExampleApplication.java

package com.simplixsoft.example.common;

import dev.simplix.core.common.aop.ScanComponents;
import dev.simplix.core.common.aop.SimplixApplication;

@SimplixApplication(name = "SimplixExample",
                    version = "1.0",
                    authors = "Exceptionflug",
                    dependencies = "SimplixCore",
                    workingDirectory = "plugins/SimplixExample")
@ScanComponents("com.simplixsoft.example") // Scan common base package
public class ExampleApplication {
}