Skip to content

Instantly share code, notes, and snippets.

@Proximyst
Created February 25, 2018 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Proximyst/93d20b780c3d8c788cec837d4af56e7a to your computer and use it in GitHub Desktop.
Save Proximyst/93d20b780c3d8c788cec837d4af56e7a to your computer and use it in GitHub Desktop.
class PluginImpl : JavaPlugin() {
override fun onLoad() { instance = this }
companion object {
lateinit var instance : PluginImpl
private set
}
}
class PluginImpl : JavaPlugin() {
companion object {
val instance by lazy {
JavaPlugin.getPlugin(PluginImpl::class.java)!!
}
}
}
// Only possible in Kotlin 1.2
lateinit var main : PluginImpl
class PluginImpl : JavaPlugin() {
override fun onLoad() { main = this }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment