mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
format
This commit is contained in:
parent
a5d9fca932
commit
9b30d11791
@ -3,7 +3,7 @@ dependencies {
|
||||
"shadedImplementation"("com.dfsek.tectonic:yaml:2.1.2")
|
||||
}
|
||||
|
||||
tasks.withType<Jar>() {
|
||||
tasks.withType<Jar> {
|
||||
manifest {
|
||||
attributes("Bootstrap-Addon-Entry-Point" to "com.dfsek.terra.addons.manifest.impl.ManifestAddonLoader")
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.dfsek.terra.addons.manifest.api;
|
||||
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
|
||||
|
||||
public interface AddonInitializer {
|
||||
void initialize();
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.dfsek.terra.addons.manifest.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||
import com.dfsek.terra.addons.manifest.impl.config.AddonManifest;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
@ -7,8 +9,6 @@ import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.inject.Injector;
|
||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ManifestAddon implements BaseAddon {
|
||||
private final AddonManifest manifest;
|
||||
|
@ -54,19 +54,18 @@ public class ManifestAddonLoader implements BootstrapBaseAddon<ManifestAddon> {
|
||||
if(manifestEntry == null) {
|
||||
throw new ManifestNotPresentException("Addon " + path + " does not contain addon manifest.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
AddonManifest manifest = manifestLoader.load(new AddonManifest(),
|
||||
new YamlConfiguration(jar.getInputStream(manifestEntry),
|
||||
"terra.addon.yml"));
|
||||
|
||||
|
||||
platform.logger().info("Loading addon " + manifest.getID());
|
||||
|
||||
|
||||
ManifestAddonClassLoader loader = new ManifestAddonClassLoader(new URL[]{ path.toUri().toURL() },
|
||||
getClass().getClassLoader());
|
||||
|
||||
|
||||
return new ManifestAddon(manifest, manifest.getEntryPoints().stream().map(entryPoint -> {
|
||||
try {
|
||||
Object in = loader.loadClass(entryPoint).getConstructor().newInstance();
|
||||
|
@ -6,12 +6,12 @@ import com.dfsek.tectonic.annotations.Default;
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.tectonic.config.ConfigTemplate;
|
||||
|
||||
import com.dfsek.terra.api.util.StringIdentifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.dfsek.terra.api.util.StringIdentifiable;
|
||||
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
public class AddonManifest implements ConfigTemplate, StringIdentifiable {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.addons.manifest.impl.exception;
|
||||
|
||||
public class ManifestException extends AddonException{
|
||||
public class ManifestException extends AddonException {
|
||||
public ManifestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.addons.manifest.impl.exception;
|
||||
|
||||
public class ManifestNotPresentException extends ManifestException{
|
||||
public class ManifestNotPresentException extends ManifestException {
|
||||
public ManifestNotPresentException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user