Made requested changes

This commit is contained in:
TheKodeToad 2024-09-02 17:03:27 +01:00
parent 0db877fd64
commit 730d8573a5
2 changed files with 34 additions and 10 deletions

View file

@ -2,6 +2,8 @@ package dev.frogmc.frogloader.api.mod;
import java.util.Collection; import java.util.Collection;
import org.jetbrains.annotations.Nullable;
public interface ModDependencies { public interface ModDependencies {
/** /**
@ -42,18 +44,46 @@ public interface ModDependencies {
PROVIDE PROVIDE
} }
/**
* Represents a mod's dependency.
*/
interface Entry { interface Entry {
/**
* Get this dependency's type.
*
* @return This dependency's type.
*/
Type type(); Type type();
/**
* Get this dependency's mod ID.
*
* @return This dependency's mod ID.
*/
String id(); String id();
String range(); /**
* Get this dependency's version range.
*
* @return This dependency's version range.
*/
@Nullable String range();
String link(); /**
* Get this dependency's installation link.
*
* @return This dependency's installation link.
*/
@Nullable String link();
String name(); /**
* Get this dependency's friendly name.
*
* @return This dependency's name.
*/
@Nullable String name();
} }
} }

View file

@ -2,14 +2,9 @@ package dev.frogmc.frogloader.impl.mod;
import java.util.*; import java.util.*;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import dev.frogmc.frogloader.api.mod.ModDependencies; import dev.frogmc.frogloader.api.mod.ModDependencies;
import dev.frogmc.frogloader.api.mod.ModProperties; import dev.frogmc.frogloader.api.mod.ModProperties;
import dev.frogmc.frogloader.api.mod.SemVer; import dev.frogmc.frogloader.api.mod.SemVer;
import dev.frogmc.frogloader.api.mod.ModDependencies.Entry;
import dev.frogmc.frogloader.api.mod.ModDependencies.Type;
/** /**
* A mod's dependencies. * A mod's dependencies.
@ -37,7 +32,6 @@ public final class ModDependenciesImpl implements ModDependencies {
* @param suggests <code>Type.SUGGEST</code> entries * @param suggests <code>Type.SUGGEST</code> entries
* @param provides <code>Type.PROVIDE</code> entries * @param provides <code>Type.PROVIDE</code> entries
*/ */
@ApiStatus.Internal
public ModDependenciesImpl(Collection<ModDependencies.Entry> depends, Collection<ModDependencies.Entry> breaks, Collection<ModDependencies.Entry> suggests, Collection<ModDependencies.Entry> provides) { public ModDependenciesImpl(Collection<ModDependencies.Entry> depends, Collection<ModDependencies.Entry> breaks, Collection<ModDependencies.Entry> suggests, Collection<ModDependencies.Entry> provides) {
entries.put(Type.DEPEND, depends); entries.put(Type.DEPEND, depends);
entries.put(Type.BREAK, breaks); entries.put(Type.BREAK, breaks);