mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-07 00:06:12 +00:00
addon dependency sorting
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
dependencies {
|
||||
"shadedApi"(project(":common:api:util"))
|
||||
"shadedApi"("ca.solo-studios:strata:1.0.0")
|
||||
}
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
package com.dfsek.terra.api.addon;
|
||||
|
||||
import ca.solostudios.strata.version.Version;
|
||||
import ca.solostudios.strata.version.VersionRange;
|
||||
|
||||
import com.dfsek.terra.api.util.StringIdentifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface BaseAddon extends StringIdentifiable {
|
||||
default void initialize() { }
|
||||
|
||||
default Map<String, VersionRange> getDependencies() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Version getVersion();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.api.addon;
|
||||
|
||||
|
||||
import ca.solostudios.strata.Versions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.dfsek.terra.api.addon.annotations.Addon;
|
||||
@@ -11,6 +12,8 @@ import com.dfsek.terra.api.addon.annotations.Version;
|
||||
/**
|
||||
* Represents an entry point for an com.dfsek.terra.addon. Implementations must be annotated with {@link Addon}.
|
||||
*/
|
||||
|
||||
//todo delete this
|
||||
public abstract class TerraAddon implements BaseAddon {
|
||||
/**
|
||||
* Invoked immediately after an com.dfsek.terra.addon is loaded.
|
||||
@@ -22,9 +25,9 @@ public abstract class TerraAddon implements BaseAddon {
|
||||
*
|
||||
* @return Addon version.
|
||||
*/
|
||||
public final @NotNull String getVersion() {
|
||||
public final @NotNull ca.solostudios.strata.version.Version getVersion() {
|
||||
Version version = getClass().getAnnotation(Version.class);
|
||||
return version == null ? "0.1.0" : version.value();
|
||||
return Versions.getVersion(1, 2, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user