mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
strata version loading
This commit is contained in:
Submodule common/addons/manifest-addon-loader updated: f388c7b486...b34d3ed3a0
+1
-1
@@ -3,5 +3,5 @@ package com.dfsek.terra.api.addon;
|
|||||||
import com.dfsek.terra.api.util.StringIdentifiable;
|
import com.dfsek.terra.api.util.StringIdentifiable;
|
||||||
|
|
||||||
|
|
||||||
public interface AddonEntryPoint extends StringIdentifiable {
|
public interface BaseAddon extends StringIdentifiable {
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,16 +1,16 @@
|
|||||||
package com.dfsek.terra.api.addon.bootstrap;
|
package com.dfsek.terra.api.addon.bootstrap;
|
||||||
|
|
||||||
import com.dfsek.terra.api.addon.AddonEntryPoint;
|
import com.dfsek.terra.api.addon.BaseAddon;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
|
||||||
public interface BootstrapAddon extends AddonEntryPoint {
|
public interface BootstrapBaseAddon extends BaseAddon {
|
||||||
/**
|
/**
|
||||||
* Load all the relevant addons in the specified path.
|
* Load all the relevant addons in the specified path.
|
||||||
* @param addonsFolder Path containing addons.
|
* @param addonsFolder Path containing addons.
|
||||||
* @param parent
|
* @param parent
|
||||||
* @return Loaded addons
|
* @return Loaded addons
|
||||||
*/
|
*/
|
||||||
Iterable<AddonEntryPoint> loadAddons(Path addonsFolder, ClassLoader parent);
|
Iterable<BaseAddon> loadAddons(Path addonsFolder, ClassLoader parent);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.dfsek.terra.addon;
|
package com.dfsek.terra.addon;
|
||||||
|
|
||||||
import com.dfsek.terra.addon.exception.AddonLoadException;
|
import com.dfsek.terra.addon.exception.AddonLoadException;
|
||||||
import com.dfsek.terra.api.addon.AddonEntryPoint;
|
import com.dfsek.terra.api.addon.BaseAddon;
|
||||||
import com.dfsek.terra.api.addon.bootstrap.BootstrapAddon;
|
import com.dfsek.terra.api.addon.bootstrap.BootstrapBaseAddon;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
@@ -14,9 +14,9 @@ import java.util.jar.JarFile;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
public class BootstrapAddonLoader implements BootstrapAddon {
|
public class BootstrapAddonLoader implements BootstrapBaseAddon {
|
||||||
@Override
|
@Override
|
||||||
public Iterable<AddonEntryPoint> loadAddons(Path addonsFolder, ClassLoader parent) {
|
public Iterable<BaseAddon> loadAddons(Path addonsFolder, ClassLoader parent) {
|
||||||
Path bootstrapAddons = addonsFolder.resolve("bootstrap");
|
Path bootstrapAddons = addonsFolder.resolve("bootstrap");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -30,10 +30,10 @@ public class BootstrapAddonLoader implements BootstrapAddon {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Object in = loader.loadClass(entry).getConstructor().newInstance();
|
Object in = loader.loadClass(entry).getConstructor().newInstance();
|
||||||
if(!(in instanceof AddonEntryPoint)) {
|
if(!(in instanceof BootstrapBaseAddon)) {
|
||||||
throw new AddonLoadException(in.getClass() + " does not extend " + AddonEntryPoint.class);
|
throw new AddonLoadException(in.getClass() + " does not extend " + BootstrapBaseAddon.class);
|
||||||
}
|
}
|
||||||
return (AddonEntryPoint) in;
|
return (BaseAddon) in;
|
||||||
} catch(InvocationTargetException e) {
|
} catch(InvocationTargetException e) {
|
||||||
throw new AddonLoadException("Exception occurred while instantiating addon: ", e);
|
throw new AddonLoadException("Exception occurred while instantiating addon: ", e);
|
||||||
} catch(NoSuchMethodException | IllegalAccessException | InstantiationException e) {
|
} catch(NoSuchMethodException | IllegalAccessException | InstantiationException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user