Skip to content

Commit f0dc9aa

Browse files
committed
Updated to using new Bootstrap...
1 parent 535500e commit f0dc9aa

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,13 @@ repositories {
5252
maven {
5353
url 'https://jitpack.io'
5454
}
55-
maven {
56-
url = "https://maven.minecraftforge.net/"
57-
}
5855
}
5956

6057

6158
dependencies {
6259

6360
installer('org.mangorage:installer:4.0.13')
64-
bootstrap("org.mangorage:mangobotbootstrap:1.0.18")
61+
bootstrap("org.mangorage:mangobotbootstrap:1.0.19")
6562

6663
library('io.github.classgraph:classgraph:4.8.162')
6764
library('org.mangorage:scanner:1.1.3')

src/main/java/module-info.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727

2828
exports org.mangorage.entrypoint;
2929

30-
exports org.mangorage.mangobotcore.plugin.internal to com.google.gson;
31-
exports org.mangorage.mangobotcore.plugin.internal.dependency to com.google.gson;
30+
exports org.mangorage.mangobotcore.plugin.internal;
31+
exports org.mangorage.mangobotcore.plugin.internal.dependency;
32+
33+
opens org.mangorage.mangobotcore.plugin.internal;
34+
opens org.mangorage.mangobotcore.plugin.internal.dependency;
35+
36+
exports org.mangorage.mangobotcore;
3237

3338
provides org.mangorage.mangobotcore.plugin.api.Plugin with org.mangorage.mangobotcore.MangoBotCore;
3439
uses org.mangorage.mangobotcore.plugin.api.Plugin;

src/main/java/org/mangorage/mangobotcore/plugin/internal/PluginManagerImpl.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,11 @@ public void load() {
4444
LogHelper.info("Gathering Plugin Info...");
4545
LibraryManager<PluginContainerImpl> manager = new LibraryManager<>();
4646

47-
List<Class<?>> scanner = new ArrayList<>();
47+
Scanner scanner = ScannerBuilder.of()
48+
.addClassloader((URLClassLoader) PluginManagerImpl.class.getClassLoader())
49+
.build();
4850

49-
ServiceLoader.load(PluginContainerImpl.class.getModule().getLayer(), Plugin.class)
50-
.stream()
51-
.forEach(p -> {
52-
scanner.add(p.type());
53-
System.out.println("Found Service: " + p.type().getName());
54-
});
55-
56-
scanner
51+
scanner.findClassesWithAnnotation(MangoBotPlugin.class)
5752
.forEach(clz -> {
5853
var annotation = clz.getAnnotation(MangoBotPlugin.class);
5954
if (Plugin.class.isAssignableFrom(clz)) {

0 commit comments

Comments
 (0)