Developer API

The TeslaLibs project is a collection of libraries made available for use outside of TeslaPowered. TeslaLibs maintains semantic versioning and full support for Sponge API 7.

Including TeslaLibs

To include TeslaLibs in your project’s workspace, it is recommended to use JitPack. The following code can be used in your build.gradle to add JitPack and depend on TeslaLibs.

repositories {
    maven {
        url 'https://jitpack.io'
    }
}

dependencies {
    compile "com.github.SimonFlash.TeslaPowered:TeslaLibs:v${teslaversion}"
}

Dependency or Shade?

If you use TeslaLibs in your project, you need to ensure that the classes are available at runtime on the server (duh!). With lightweight plugins, it makes more sense to require users to have TeslaPowered installed to provide TeslaLibs at runtime. For larger projects you should consider shading TeslaLibs into your plugin. Remember: If you choose to shade TeslaLibs, you should always relocate the package into your own project to prevent class loading conflictions with other instances such as TeslaPowered.

In order to shade TeslaLibs, you will need a plugin such as shadow. The following shows how the shadow plugin and shadowJar task can be used to include and relocate TeslaLibs into your compiled jar.

plugins {
    id 'com.github.johnrengelman.shadow' version '2.0.4'
}

shadowJar {
    dependencies {
        include dependency("com.github.SimonFlash.TeslaPowered:TeslaLibs:v${teslaversion}")
    }
    relocate 'com.mcsimonflash.sponge.teslalibs', 'com.mypackage.teslalibs'
}

Contributing

TeslaLibs is always undergoing new developments, making improvement, or even adding completely new libraries. However, these updates are limited by the time and resources of our contributors. If you’re interested in contributing to TeslaLibs, I encourage you to reach out to either myself (Simon_Flash) or a contributor working on a library you’re interested in. If you may not have the time to commit development wise, be sure to keep an eye on progress and provide feedback on issues, PRs, and TeslaLibs as a whole. When push comes to shove, the success of TeslaLibs relies on the team behind it - help make it happen!

Category: Developer Tools

Published on Mar 18, 2018

views

stars

watchers

total downloads

Promoted Versions

Members