Add a concept of a concrete-library which has access to Bukkit but is not a plugin.

This commit is contained in:
Alex Endfinger
2022-07-10 19:35:50 -04:00
parent 39a7b50a07
commit 58356c27f3
13 changed files with 68 additions and 32 deletions

View File

@ -0,0 +1,3 @@
plugins {
id("lgbt.mystic.foundation.concrete-library")
}

View File

@ -0,0 +1,6 @@
package lgbt.mystic.foundation.conrete.sample.common
import org.bukkit.plugin.java.JavaPlugin
fun JavaPlugin.logOnEnable(name: String) = slF4JLogger.info("Enabled $name")
fun JavaPlugin.logOnDisable(name: String) = slF4JLogger.info("Disabled $name")

View File

@ -1,3 +1,7 @@
plugins {
id("lgbt.mystic.foundation.concrete-plugin")
}
dependencies {
implementation(project(":bukkit-plugins:common-library"))
}

View File

@ -1,13 +1,15 @@
package lgbt.mystic.foundation.concrete.sample.goodbyeworld
import lgbt.mystic.foundation.conrete.sample.common.logOnDisable
import lgbt.mystic.foundation.conrete.sample.common.logOnEnable
import org.bukkit.plugin.java.JavaPlugin
class GoodbyeWorldPlugin : JavaPlugin() {
override fun onEnable() {
slF4JLogger.info("Enabled Goodbye World")
logOnEnable("Goodbye World")
}
override fun onDisable() {
slF4JLogger.info("Disabled Goodbye World")
logOnDisable("Goodbye World")
}
}

View File

@ -4,4 +4,5 @@ plugins {
dependencies {
implementation(project(":other-library"))
implementation(project(":bukkit-plugins:common-library"))
}

View File

@ -1,14 +1,16 @@
package lgbt.mystic.foundation.concrete.sample.helloworld
import lgbt.mystic.foundation.concrete.other.OtherLibrary
import lgbt.mystic.foundation.conrete.sample.common.logOnDisable
import lgbt.mystic.foundation.conrete.sample.common.logOnEnable
import org.bukkit.plugin.java.JavaPlugin
class HelloWorldPlugin : JavaPlugin() {
override fun onEnable() {
slF4JLogger.info("Enabled Hello World (Constant is ${OtherLibrary.SOME_CONSTANT})")
logOnEnable(OtherLibrary.HELLO_WORLD)
}
override fun onDisable() {
slF4JLogger.info("Disabled Hello World (Constant is ${OtherLibrary.SOME_CONSTANT})")
logOnDisable(OtherLibrary.HELLO_WORLD)
}
}

View File

@ -1,5 +1,5 @@
package lgbt.mystic.foundation.concrete.other;
public class OtherLibrary {
public static final String SOME_CONSTANT = "HelloWorld";
public static final String HELLO_WORLD = "Hello World";
}

View File

@ -2,4 +2,5 @@ includeBuild("../..")
include(":bukkit-plugins")
include(":bukkit-plugins:hello-world")
include(":bukkit-plugins:goodbye-world")
include(":bukkit-plugins:common-library")
include(":other-library")