-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made ModuleEnvironment able to support additions
- Loading branch information
1 parent
d75933d
commit e69aa43
Showing
7 changed files
with
84 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package dev.emortal.api.modules; | ||
|
||
import java.io.IOException; | ||
import dev.emortal.api.modules.env.ModuleEnvironment; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public record LoadableModule(@NotNull Class<? extends Module> clazz, @NotNull Creator creator) { | ||
|
||
@FunctionalInterface | ||
public interface Creator { | ||
|
||
@NotNull Module create(@NotNull ModuleEnvironment environment) throws IOException; | ||
@NotNull Module create(@NotNull ModuleEnvironment environment) throws Exception; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/emortal/api/modules/env/BasicModuleEnvironment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.emortal.api.modules.env; | ||
|
||
import dev.emortal.api.modules.ModuleData; | ||
import dev.emortal.api.modules.ModuleProvider; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* The basic environment that only includes the required fields. | ||
*/ | ||
public record BasicModuleEnvironment(@NotNull ModuleData data, @NotNull ModuleProvider moduleProvider) implements ModuleEnvironment { | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/dev/emortal/api/modules/env/ModuleEnvironment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package dev.emortal.api.modules.env; | ||
|
||
import dev.emortal.api.modules.ModuleData; | ||
import dev.emortal.api.modules.ModuleProvider; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* The environment that a module is loaded in. | ||
*/ | ||
public interface ModuleEnvironment { | ||
|
||
/** | ||
* Data provided by the module. | ||
*/ | ||
@NotNull ModuleData data(); | ||
|
||
/** | ||
* Provides access to existing modules to facilitate module dependencies. | ||
*/ | ||
@NotNull ModuleProvider moduleProvider(); | ||
|
||
@FunctionalInterface | ||
interface Provider { | ||
|
||
@NotNull ModuleEnvironment create(@NotNull ModuleData data, @NotNull ModuleProvider moduleProvider); | ||
} | ||
} |