Separate plugin types #10
|
@ -1,6 +1,6 @@
|
||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
thyroxine = "0.0.1-alpha.2"
|
thyroxine = "0.0.1-alpha.3"
|
||||||
nightconfig = "3.7.2"
|
nightconfig = "3.7.2"
|
||||||
mixin = "0.14.0+mixin.0.8.6"
|
mixin = "0.14.0+mixin.0.8.6"
|
||||||
annotations = "24.1.0"
|
annotations = "24.1.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
id("dev.frogmc.phytotelma") version "0.0.1-alpha.9"
|
id("dev.frogmc.phytotelma") version "0.0.1-alpha.10"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
|
@ -84,9 +84,9 @@ public class PluginLoader {
|
||||||
|
|
||||||
public static GamePlugin discoverGamePlugins() {
|
public static GamePlugin discoverGamePlugins() {
|
||||||
LOGGER.info("Discovering game plugins...");
|
LOGGER.info("Discovering game plugins...");
|
||||||
ServiceLoader<GamePlugin> loader = ServiceLoader.load(GamePlugin.class);
|
GamePlugin[] applicablePlugins = ServiceLoader.load(GamePlugin.class).stream().map(ServiceLoader.Provider::get)
|
||||||
loader.stream().map(ServiceLoader.Provider::get).forEach(p -> LOGGER.info("Found game plugin: {}", p.getClass().getName()));
|
.peek(p -> LOGGER.debug("Found game plugin: {}", p.getClass().getName()))
|
||||||
GamePlugin[] applicablePlugins = ServiceLoader.load(GamePlugin.class).stream().map(ServiceLoader.Provider::get).filter(GamePlugin::isApplicable).toArray(GamePlugin[]::new);
|
.filter(GamePlugin::isApplicable).toArray(GamePlugin[]::new);
|
||||||
if (applicablePlugins.length > 1) {
|
if (applicablePlugins.length > 1) {
|
||||||
throw new IllegalStateException("Multiple applicable game plugins found!");
|
throw new IllegalStateException("Multiple applicable game plugins found!");
|
||||||
} else if (applicablePlugins.length == 0) {
|
} else if (applicablePlugins.length == 0) {
|
||||||
|
|
Loading…
Reference in a new issue