rename NonsensePlugin -> FrogPlugin
This commit is contained in:
parent
932cf3e076
commit
93e397a19c
|
@ -6,7 +6,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.api.env.Env;
|
import dev.frogmc.frogloader.api.env.Env;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
import dev.frogmc.frogloader.api.plugin.NonsensePlugin;
|
import dev.frogmc.frogloader.api.plugin.FrogPlugin;
|
||||||
import dev.frogmc.frogloader.impl.FrogLoaderImpl;
|
import dev.frogmc.frogloader.impl.FrogLoaderImpl;
|
||||||
|
|
||||||
public interface FrogLoader {
|
public interface FrogLoader {
|
||||||
|
@ -15,7 +15,7 @@ public interface FrogLoader {
|
||||||
return FrogLoaderImpl.getInstance();
|
return FrogLoaderImpl.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<NonsensePlugin> getPlugins();
|
List<FrogPlugin> getPlugins();
|
||||||
|
|
||||||
Env getEnv();
|
Env getEnv();
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package dev.frogmc.frogloader.api.plugin;
|
package dev.frogmc.frogloader.api.plugin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
import dev.frogmc.frogloader.api.FrogLoader;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
|
|
||||||
public interface NonsensePlugin extends Runnable {
|
public interface FrogPlugin {
|
||||||
|
|
||||||
default void run() {
|
default void run() {
|
||||||
|
|
||||||
|
@ -21,5 +22,7 @@ public interface NonsensePlugin extends Runnable {
|
||||||
default void init(FrogLoader loader) throws Exception {
|
default void init(FrogLoader loader) throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<ModProperties> getMods();
|
default Collection<ModProperties> getMods(){
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ import com.google.gson.Gson;
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
import dev.frogmc.frogloader.api.FrogLoader;
|
||||||
import dev.frogmc.frogloader.api.env.Env;
|
import dev.frogmc.frogloader.api.env.Env;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
import dev.frogmc.frogloader.api.plugin.NonsensePlugin;
|
import dev.frogmc.frogloader.api.plugin.FrogPlugin;
|
||||||
import dev.frogmc.frogloader.impl.gui.LoaderGui;
|
import dev.frogmc.frogloader.impl.gui.LoaderGui;
|
||||||
import dev.frogmc.frogloader.impl.launch.MixinClassLoader;
|
import dev.frogmc.frogloader.impl.launch.MixinClassLoader;
|
||||||
import dev.frogmc.frogloader.impl.mod.ModUtil;
|
import dev.frogmc.frogloader.impl.mod.ModUtil;
|
||||||
|
@ -37,7 +37,7 @@ public class FrogLoaderImpl implements FrogLoader {
|
||||||
private final Logger LOGGER = LoggerFactory.getLogger("Frogloader");
|
private final Logger LOGGER = LoggerFactory.getLogger("Frogloader");
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final List<NonsensePlugin> plugins = new ArrayList<>();
|
private final List<FrogPlugin> plugins = new ArrayList<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Path gameDir, configDir, modsDir;
|
private final Path gameDir, configDir, modsDir;
|
||||||
|
@ -77,7 +77,7 @@ public class FrogLoaderImpl implements FrogLoader {
|
||||||
modIds = collectModIds();
|
modIds = collectModIds();
|
||||||
LOGGER.info(ModUtil.getModList(mods.values()));
|
LOGGER.info(ModUtil.getModList(mods.values()));
|
||||||
LOGGER.info("Launching...");
|
LOGGER.info("Launching...");
|
||||||
plugins.forEach(NonsensePlugin::run);
|
plugins.forEach(FrogPlugin::run);
|
||||||
} catch (Throwable t){
|
} catch (Throwable t){
|
||||||
LoaderGui.builder().setContent(LoaderGui.ContentType.GENERIC_ERROR, t).addReport(CrashReportGenerator.writeReport(t, collectMods().values())).build().show();
|
LoaderGui.builder().setContent(LoaderGui.ContentType.GENERIC_ERROR, t).addReport(CrashReportGenerator.writeReport(t, collectMods().values())).build().show();
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class FrogLoaderImpl implements FrogLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void discoverPlugins() {
|
private void discoverPlugins() {
|
||||||
ServiceLoader.load(NonsensePlugin.class).forEach(plugin -> {
|
ServiceLoader.load(FrogPlugin.class).forEach(plugin -> {
|
||||||
try {
|
try {
|
||||||
if (plugin.isApplicable()) {
|
if (plugin.isApplicable()) {
|
||||||
plugin.init(this);
|
plugin.init(this);
|
||||||
|
@ -154,7 +154,7 @@ public class FrogLoaderImpl implements FrogLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, ModProperties> collectMods() {
|
private Map<String, ModProperties> collectMods() {
|
||||||
Collection<ModProperties> properties = plugins.stream().map(NonsensePlugin::getMods).reduce(new HashSet<>(), (s1, s2) -> {
|
Collection<ModProperties> properties = plugins.stream().map(FrogPlugin::getMods).reduce(new HashSet<>(), (s1, s2) -> {
|
||||||
s1.addAll(s2);
|
s1.addAll(s2);
|
||||||
return s1;
|
return s1;
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ import dev.frogmc.frogloader.api.extensions.PreLaunchExtension;
|
||||||
import dev.frogmc.frogloader.api.mod.ModDependencies;
|
import dev.frogmc.frogloader.api.mod.ModDependencies;
|
||||||
import dev.frogmc.frogloader.api.mod.ModExtensions;
|
import dev.frogmc.frogloader.api.mod.ModExtensions;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
import dev.frogmc.frogloader.api.plugin.NonsensePlugin;
|
import dev.frogmc.frogloader.api.plugin.FrogPlugin;
|
||||||
import dev.frogmc.frogloader.impl.Discovery;
|
import dev.frogmc.frogloader.impl.Discovery;
|
||||||
import dev.frogmc.frogloader.impl.FrogLoaderImpl;
|
import dev.frogmc.frogloader.impl.FrogLoaderImpl;
|
||||||
import dev.frogmc.frogloader.impl.gui.LoaderGui;
|
import dev.frogmc.frogloader.impl.gui.LoaderGui;
|
||||||
|
@ -29,7 +29,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.spongepowered.asm.mixin.Mixins;
|
import org.spongepowered.asm.mixin.Mixins;
|
||||||
|
|
||||||
public class Minecraft implements NonsensePlugin {
|
public class Minecraft implements FrogPlugin {
|
||||||
|
|
||||||
protected static final String[] MINECRAFT_CLASSES = new String[]{
|
protected static final String[] MINECRAFT_CLASSES = new String[]{
|
||||||
"net/minecraft/client/main/Main.class",
|
"net/minecraft/client/main/Main.class",
|
||||||
|
|
Loading…
Reference in a new issue