refactor addon loader to new module

This commit is contained in:
dfsek
2021-06-29 19:34:54 -07:00
parent 9880f488e5
commit 22c97ca390
18 changed files with 33 additions and 33 deletions

View File

@@ -7,11 +7,11 @@ import com.dfsek.terra.api.addon.annotations.Version;
import org.jetbrains.annotations.NotNull;
/**
* Represents an entry point for an addon. Implementations must be annotated with {@link Addon}.
* Represents an entry point for an com.dfsek.terra.addon. Implementations must be annotated with {@link Addon}.
*/
public abstract class TerraAddon {
/**
* Gets the version of this addon.
* Gets the version of this com.dfsek.terra.addon.
*
* @return Addon version.
*/
@@ -21,7 +21,7 @@ public abstract class TerraAddon {
}
/**
* Gets the author of this addon.
* Gets the author of this com.dfsek.terra.addon.
*
* @return Addon author.
*/
@@ -31,19 +31,19 @@ public abstract class TerraAddon {
}
/**
* Gets the name (ID) of this addon.
* Gets the name (ID) of this com.dfsek.terra.addon.
*
* @return Addon ID.
*/
public final @NotNull String getName() {
Addon addon = getClass().getAnnotation(Addon.class);
if(addon == null)
throw new IllegalStateException("Addon annotation not present"); // This should never happen; the presence of this annotation is checked by the addon loader.
throw new IllegalStateException("Addon annotation not present"); // This should never happen; the presence of this annotation is checked by the com.dfsek.terra.addon loader.
return addon.value();
}
/**
* Invoked immediately after an addon is loaded.
* Invoked immediately after an com.dfsek.terra.addon is loaded.
*/
public abstract void initialize();
}

View File

@@ -8,13 +8,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specifies that the annotated class is an entry point for a Terra addon.
* Specifies that the annotated class is an entry point for a Terra com.dfsek.terra.addon.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Addon {
/**
* @return The ID of the addon.
* @return The ID of the com.dfsek.terra.addon.
*/
@NotNull String value();
}

View File

@@ -8,13 +8,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Optional annotation that specifies the author of an addon.
* Optional annotation that specifies the author of an com.dfsek.terra.addon.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Author {
/**
* @return Name of the addon author.
* @return Name of the com.dfsek.terra.addon author.
*/
@NotNull String value();
}

View File

@@ -8,13 +8,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Optional annotation that specifies dependencies of an addon.
* Optional annotation that specifies dependencies of an com.dfsek.terra.addon.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Depends {
/**
* @return All addons this addon is dependent upon.
* @return All addons this com.dfsek.terra.addon is dependent upon.
*/
@NotNull String[] value();
}

View File

@@ -8,13 +8,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Optional annotation that specifies the version of an addon.
* Optional annotation that specifies the version of an com.dfsek.terra.addon.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Version {
/**
* @return Version of the addon.
* @return Version of the com.dfsek.terra.addon.
*/
@NotNull String value();
}

View File

@@ -9,7 +9,7 @@ import java.lang.annotation.Target;
/**
* Specifies that an event handler is to handle all {@link PackEvent}s, regardless of whether the pack
* depends on the addon's listener.
* depends on the com.dfsek.terra.addon's listener.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)

View File

@@ -6,8 +6,8 @@ import com.dfsek.terra.api.event.annotations.Global;
/**
* An event with functionality directly linked to a {@link ConfigPack}.
* <p>
* PackEvents are only invoked when the pack specifies the addon in its
* {@code addon} key (or when the listener is annotated {@link Global}).
* PackEvents are only invoked when the pack specifies the com.dfsek.terra.addon in its
* {@code com.dfsek.terra.addon} key (or when the listener is annotated {@link Global}).
*/
@SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
public interface PackEvent extends Event {