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

Getting started

Leonhard edited this page Dec 26, 2020 · 41 revisions

The SimplixCore works as a plugin on Spigot and BungeeCord. You don't have to shade any parts of the SimplixCore (it's also discouraged to do so on Spigot/BungeeCord!) Instead of shading the whole SimplixCore you can use the QuickStart module to ensure that the SimplixCore-plugin is loaded properly on your server or download the plugin automatically if needed.

You can see how to use the QuickStart module to check whether the SimplixPlugin was installed properly here:

Adding dependencies

This is the repository to use:

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

Standalone

<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-common-api</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-common-implementation</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>

BungeeCord

<!-- If you wish to use it: The SimplixQuickStartModule QuickStartModule needs to be shaded -->
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-bungeecord-quickstart</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-common-api</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-api</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency> 
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-bungeecord-implementation</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Velocity:

<!-- If you wish to use it: The SimplixQuickStartModule QuickStartModule needs to be shaded -->
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-velocity-quickstart</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-common-api</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-api</artifactId>
  <version>1.0.0-SNAPSHOT</version> 
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-velocity-implementation</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Spigot:

<!-- If you wish to use it: The SimplixQuickStartModule QuickStartModule needs to be shaded -->
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-spigot-quickstart</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-common-api</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-api</artifactId>
  <version>1.0.0-SNAPSHOT</version> 
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>dev.simplix.core</groupId>
  <artifactId>simplixcore-minecraft-spigot-implementation</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Initialization

Standalone

import dev.simplix.core.common.CommonSimplixModule;
import dev.simplix.core.common.aop.SimplixApplication;
import dev.simplix.core.common.inject.SimplixInstaller;
import dev.simplix.core.common.aop.ScanComponents;

@SimplixApplication(
    name = "SimplixExample",
    version = "1.0.0",
    authors = "SimplixSoftworks")
@ScanComponents("dev.simplix.core")
public class ExampleSimplixApplication {

  public static void main(String[] args) {
    SimplixInstaller
        .instance()
        .register(ExampleSimplixApplication.class, new CommonSimplixModule()/*, Other modules here*/);
    SimplixInstaller.instance().install(Platform.STANDALONE);
  }
}

BungeeCord / Spigot / Velocity using the Quickstart module

ExampleSimplixPlugin.java

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

@SimplixApplication(
    name = "SimplixExample",
    version = "1.0.0",
    authors = "SimplixSoftworks",
    dependencies = "SimplixCore")
@ScanComponents("dev.simplix.core")
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()/*, Other modules here*/);
  }
}

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 {
}

Next steps

What you have done so far, was creating an application/plugin that now has access to all possibilities the SimplixPlattform has to offer. But at the moment it is not using any of them. As the next step, it is recommended to learn how to use the dependency-injection build into The SimplixCore to its fullest potential. If you are using the SimplixCore as a plugin it is highly recommended to learn how to use the dependency system of the SimplixPlattform to learn how to load libraries dynamically instead of making them bloating your jar. For further real world-examples see an Example-Project here.