Skip to content

Spigot command DSL and helper methods used between our plugins

License

Notifications You must be signed in to change notification settings

Norazan/Idofront

 
 

Repository files navigation

CI Package Wiki Contribute

Idofront

Idofront is a repository, shadowed by many of our plugins, which contains many useful helper functions. Some are exclusive in usefulness to code written in Kotlin.

This project is really new and not intended to be used by anyone for their own plugins yet! Don't expect any consistency or good code for now.

Features

Check out the wiki
  • A clean command DSL for kotlin (May change a lot in the near future). See implementation in our plugins, notably Mobzy.
  • Custom ktx.serialization serializers for many bukkit classes.
  • Many helper functions to reduce boilerplate code, such as:
    • String.color() to translate color codes.
    • Quick ItemStack manipulation:
      itemStack.editItemMeta{
          isUnbreakable = true
          setDisplayName("Custom name")
      }
  • Destructure functions:
    val (x, y, z, world) = location  
Coming soon(tm):
  • Config management powered by ktx.serialization (currently experimental)
  • Easy custom recipe registration.

Setup

Dependencies

  • Use PDM to auto download Kotlin (and kotlinx.serialization if you are using it).
  • OR: Manage shading shading these libs into your jar. Shading Kotlin can cause hard-to-find errors if two different versions are present during runtime!
  • OR: Depend on KotlinSpice in your plugin config, and request users to download the plugin to their server.

Gradle

repositories {
    maven { url 'https://repo.mineinabyss.com/releases' }
}

dependencies {
    implementation 'com.mineinabyss:idofront:<version>'
    // Or use for idofront + extra NMS stuff
    implementation 'com.mineinabyss:idofront-nms:<version>'
}

Shading

Lastly, shade Idofront (ex with gradle's shadowJar plugin, or the maven equivalent). It is recommended that you relocate the jar into a unique package in order to avoid problems when different plugins are using different versions of Idofront.

Once pdm supports relocation, we recommend just using that!

shadowJar {
    relocate 'com.mineinabyss.idofront', "${project.group}.${project.name}.idofront".toLowerCase()

    minimize()
}

Minimize will only shade classes you are using and does not seem to cause problems with Idofront.

About

Spigot command DSL and helper methods used between our plugins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 95.6%
  • Java 4.4%