Fixed compile errors in HMCSM
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.download;
|
||||
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.DownloadTypeChangedEvent;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.task.TaskWindow;
|
||||
@@ -62,6 +62,6 @@ public enum DownloadType {
|
||||
}
|
||||
|
||||
static {
|
||||
HMCLAPI.EVENT_BUS.channel(DownloadTypeChangedEvent.class).register(t -> setSuggestedDownloadType(t.getValue()));
|
||||
HMCAPI.EVENT_BUS.channel(DownloadTypeChangedEvent.class).register(t -> setSuggestedDownloadType(t.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.jackhuang.hellominecraft.launcher.core.launch;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.api.ResultedSimpleEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.DecompressLibrariesEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.DownloadLibrariesEvent;
|
||||
@@ -44,7 +44,7 @@ public class DefaultGameLauncher extends GameLauncher {
|
||||
}
|
||||
|
||||
private void register() {
|
||||
HMCLAPI.EVENT_BUS.channel(DownloadLibrariesEvent.class).register(t -> {
|
||||
HMCAPI.EVENT_BUS.channel(DownloadLibrariesEvent.class).register(t -> {
|
||||
ResultedSimpleEvent<List<DownloadLibraryJob>> event = (ResultedSimpleEvent) t;
|
||||
final TaskWindow.TaskWindowFactory dw = TaskWindow.factory();
|
||||
ParallelTask parallelTask = new ParallelTask();
|
||||
@@ -63,7 +63,7 @@ public class DefaultGameLauncher extends GameLauncher {
|
||||
flag = true;
|
||||
t.setResult(flag);
|
||||
});
|
||||
HMCLAPI.EVENT_BUS.channel(DecompressLibrariesEvent.class).register(t -> {
|
||||
HMCAPI.EVENT_BUS.channel(DecompressLibrariesEvent.class).register(t -> {
|
||||
if (t.getValue() == null) {
|
||||
t.setResult(false);
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.List;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.DecompressLibrariesEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.DecompressLibraryJob;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.DownloadLibrariesEvent;
|
||||
@@ -90,7 +90,7 @@ public class GameLauncher {
|
||||
public void makeLaunchCommand() throws AuthenticationException, GameException, RuntimeGameException {
|
||||
HMCLog.log("Building process");
|
||||
HMCLog.log("Logging in...");
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.LoggingIn));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.LoggingIn));
|
||||
IMinecraftLoader loader;
|
||||
if (info != null)
|
||||
result = login.login(info);
|
||||
@@ -98,9 +98,9 @@ public class GameLauncher {
|
||||
result = login.loginBySettings();
|
||||
if (result == null)
|
||||
throw new AuthenticationException("Result can not be null.");
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new ProcessingLoginResultEvent(this, result));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new ProcessingLoginResultEvent(this, result));
|
||||
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.GeneratingLaunchingCodes));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.GeneratingLaunchingCodes));
|
||||
loader = service.launch(options, result);
|
||||
|
||||
File file = service.version().getDecompressNativesToLocation(loader.getMinecraftVersion());
|
||||
@@ -109,18 +109,18 @@ public class GameLauncher {
|
||||
|
||||
if (!options.isNotCheckGame()) {
|
||||
HMCLog.log("Detecting libraries...");
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.DownloadingLibraries));
|
||||
if (!HMCLAPI.EVENT_BUS.fireChannelResulted(new DownloadLibrariesEvent(this, service.download().getDownloadLibraries(loader.getMinecraftVersion()))))
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.DownloadingLibraries));
|
||||
if (!HMCAPI.EVENT_BUS.fireChannelResulted(new DownloadLibrariesEvent(this, service.download().getDownloadLibraries(loader.getMinecraftVersion()))))
|
||||
throw new GameException("Failed to download libraries");
|
||||
}
|
||||
|
||||
HMCLog.log("Unpacking natives...");
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.DecompressingNatives));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, LaunchingState.DecompressingNatives));
|
||||
DecompressLibraryJob job = service.version().getDecompressLibraries(loader.getMinecraftVersion());
|
||||
if (!HMCLAPI.EVENT_BUS.fireChannelResulted(new DecompressLibrariesEvent(this, job)))
|
||||
if (!HMCAPI.EVENT_BUS.fireChannelResulted(new DecompressLibrariesEvent(this, job)))
|
||||
throw new GameException("Failed to decompress natives");
|
||||
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchSucceededEvent(this, loader.makeLaunchingCommand()));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchSucceededEvent(this, loader.makeLaunchingCommand()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ public class GameLauncher {
|
||||
.environment().put("APPDATA", service.baseDirectory().getAbsolutePath());
|
||||
JavaProcess jp = new JavaProcess(str, builder.start(), PROCESS_MANAGER);
|
||||
HMCLog.log("Have started the process");
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchEvent(this, jp));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchEvent(this, jp));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.MinecraftLibraryPathEvent;
|
||||
import org.jackhuang.hellominecraft.util.sys.OS;
|
||||
import org.jackhuang.hellominecraft.util.sys.Platform;
|
||||
@@ -108,7 +108,7 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
if (info == null)
|
||||
return null;
|
||||
MinecraftLibraryPathEvent event = new MinecraftLibraryPathEvent(this, "libraries/" + info.path, new Wrapper<>(new File(gameDir, "libraries/" + info.path)));
|
||||
HMCLAPI.EVENT_BUS.fireChannel(event);
|
||||
HMCAPI.EVENT_BUS.fireChannel(event);
|
||||
return event.getFile().getValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.LoadedOneVersionEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.RefreshedVersionsEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.RefreshingVersionsEvent;
|
||||
@@ -72,7 +72,7 @@ public class MinecraftVersionManager extends IMinecraftProvider {
|
||||
|
||||
@Override
|
||||
public synchronized void refreshVersions() {
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new RefreshingVersionsEvent(this, service));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new RefreshingVersionsEvent(this, service));
|
||||
|
||||
try {
|
||||
MCUtils.tryWriteProfile(service.baseDirectory());
|
||||
@@ -142,12 +142,12 @@ public class MinecraftVersionManager extends IMinecraftProvider {
|
||||
}
|
||||
|
||||
versions.put(id, mcVersion);
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LoadedOneVersionEvent(this, id));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LoadedOneVersionEvent(this, id));
|
||||
} catch (Exception e) {
|
||||
HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", e);
|
||||
}
|
||||
}
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new RefreshedVersionsEvent(this, service));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new RefreshedVersionsEvent(this, service));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.Theme;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.AuthenticatorChangedEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.DownloadTypeChangedEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ThemeChangedEvent;
|
||||
@@ -92,7 +92,7 @@ public final class Config implements Cloneable {
|
||||
|
||||
public void setTheme(int theme) {
|
||||
this.theme = theme;
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new ThemeChangedEvent(this, getTheme()));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new ThemeChangedEvent(this, getTheme()));
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public final class Config implements Cloneable {
|
||||
if (logintype < 0 || logintype >= IAuthenticator.LOGINS.size())
|
||||
return;
|
||||
this.logintype = logintype;
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new AuthenticatorChangedEvent(this, IAuthenticator.LOGINS.get(logintype)));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new AuthenticatorChangedEvent(this, IAuthenticator.LOGINS.get(logintype)));
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public final class Config implements Cloneable {
|
||||
|
||||
public void setDownloadType(int downloadtype) {
|
||||
this.downloadtype = downloadtype;
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new DownloadTypeChangedEvent(this, getDownloadSource()));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new DownloadTypeChangedEvent(this, getDownloadSource()));
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jackhuang.hellominecraft.launcher.Main;
|
||||
import org.jackhuang.hellominecraft.launcher.core.MCUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
|
||||
import org.jackhuang.hellominecraft.util.CollectionUtils;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ProfileChangedEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ProfileLoadingEvent;
|
||||
import org.jackhuang.hellominecraft.util.sys.FileUtils;
|
||||
@@ -161,12 +161,12 @@ public final class Settings {
|
||||
Profile p = getLastProfile();
|
||||
if (p == null)
|
||||
throw new Error("No profiles here, it should not happen");
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new ProfileChangedEvent(SETTINGS, p.getName()));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new ProfileChangedEvent(SETTINGS, p.getName()));
|
||||
p.onSelected();
|
||||
}
|
||||
|
||||
public static void onProfileLoading() {
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new ProfileLoadingEvent(SETTINGS));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new ProfileLoadingEvent(SETTINGS));
|
||||
onProfileChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ProfileChangedEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ProfileLoadingEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.RefreshedVersionsEvent;
|
||||
@@ -86,7 +86,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
final InstallerPanel installerPanels[] = new InstallerPanel[InstallerType.values().length];
|
||||
|
||||
public GameSettingsPanel() {
|
||||
HMCLAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(t -> {
|
||||
HMCAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(t -> {
|
||||
if (Settings.getLastProfile().service() == t.getValue() && t.getValue().version().getVersions().isEmpty())
|
||||
if (!showedNoVersion && Settings.getLastProfile().service().checkingModpack) {
|
||||
showedNoVersion = true;
|
||||
@@ -123,9 +123,9 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
cboJava.addItem(j.getLocalizedName());
|
||||
isLoading = false;
|
||||
|
||||
HMCLAPI.EVENT_BUS.channel(ProfileLoadingEvent.class).register(onLoadingProfiles);
|
||||
HMCLAPI.EVENT_BUS.channel(ProfileChangedEvent.class).register(onSelectedProfilesChanged);
|
||||
HMCLAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(onRefreshedVersions);
|
||||
HMCAPI.EVENT_BUS.channel(ProfileLoadingEvent.class).register(onLoadingProfiles);
|
||||
HMCAPI.EVENT_BUS.channel(ProfileChangedEvent.class).register(onSelectedProfilesChanged);
|
||||
HMCAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(onRefreshedVersions);
|
||||
}
|
||||
|
||||
void initExplorationMenu() {
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.jackhuang.hellominecraft.launcher.ui;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.api.event.process.JVMLaunchFailedEvent;
|
||||
import org.jackhuang.hellominecraft.api.event.process.JavaProcessExitedAbnormallyEvent;
|
||||
import org.jackhuang.hellominecraft.api.event.process.JavaProcessStoppedEvent;
|
||||
@@ -49,8 +49,8 @@ import org.jackhuang.hellominecraft.util.net.WebFrame;
|
||||
public class LaunchingUIDaemon {
|
||||
|
||||
public LaunchingUIDaemon() {
|
||||
HMCLAPI.EVENT_BUS.channel(LaunchingStateChangedEvent.class).register(LAUNCHING_STATE_CHANGED);
|
||||
HMCLAPI.EVENT_BUS.channel(LaunchEvent.class).register(p -> {
|
||||
HMCAPI.EVENT_BUS.channel(LaunchingStateChangedEvent.class).register(LAUNCHING_STATE_CHANGED);
|
||||
HMCAPI.EVENT_BUS.channel(LaunchEvent.class).register(p -> {
|
||||
GameLauncher obj = (GameLauncher) p.getSource();
|
||||
HMCLGameLauncher.GameLauncherTag tag = (HMCLGameLauncher.GameLauncherTag) obj.getTag();
|
||||
if (tag.launcherVisibility == LauncherVisibility.CLOSE && !LogWindow.INSTANCE.isVisible()) {
|
||||
@@ -69,15 +69,15 @@ public class LaunchingUIDaemon {
|
||||
monitor.setTag(tag.launcherVisibility);
|
||||
monitor.start();
|
||||
});
|
||||
HMCLAPI.EVENT_BUS.channel(LaunchSucceededEvent.class).register(p -> {
|
||||
HMCAPI.EVENT_BUS.channel(LaunchSucceededEvent.class).register(p -> {
|
||||
int state = ((HMCLGameLauncher.GameLauncherTag) ((GameLauncher) p.getSource()).getTag()).state;
|
||||
if (state == 1)
|
||||
LAUNCH_FINISHER.accept(p);
|
||||
else if (state == 2)
|
||||
LAUNCH_SCRIPT_FINISHER.accept(p);
|
||||
});
|
||||
HMCLAPI.EVENT_BUS.channel(JavaProcessStoppedEvent.class).register(event -> checkExit((LauncherVisibility) ((JavaProcessMonitor) event.getSource()).getTag()));
|
||||
HMCLAPI.EVENT_BUS.channel(JavaProcessExitedAbnormallyEvent.class).register(event -> {
|
||||
HMCAPI.EVENT_BUS.channel(JavaProcessStoppedEvent.class).register(event -> checkExit((LauncherVisibility) ((JavaProcessMonitor) event.getSource()).getTag()));
|
||||
HMCAPI.EVENT_BUS.channel(JavaProcessExitedAbnormallyEvent.class).register(event -> {
|
||||
int exitCode = event.getValue().getExitCode();
|
||||
HMCLog.err("The game exited abnormally, exit code: " + exitCode);
|
||||
String[] logs = event.getValue().getStdOutLines().toArray(new String[0]);
|
||||
@@ -98,7 +98,7 @@ public class LaunchingUIDaemon {
|
||||
f.setVisible(true);
|
||||
checkExit((LauncherVisibility) ((JavaProcessMonitor) event.getSource()).getTag());
|
||||
});
|
||||
HMCLAPI.EVENT_BUS.channel(JVMLaunchFailedEvent.class).register(event -> {
|
||||
HMCAPI.EVENT_BUS.channel(JVMLaunchFailedEvent.class).register(event -> {
|
||||
int exitCode = event.getValue().getExitCode();
|
||||
HMCLog.err("Cannot create jvm, exit code: " + exitCode);
|
||||
WebFrame f = new WebFrame(event.getValue().getStdOutLines().toArray(new String[0]));
|
||||
|
||||
@@ -51,7 +51,7 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.Main;
|
||||
import org.jackhuang.hellominecraft.launcher.api.PluginManager;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ThemeChangedEvent;
|
||||
@@ -159,7 +159,7 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
}
|
||||
((JPanel) getContentPane()).setOpaque(true);
|
||||
|
||||
HMCLAPI.EVENT_BUS.channel(ThemeChangedEvent.class).register(x -> reloadColor(x.getValue()));
|
||||
HMCAPI.EVENT_BUS.channel(ThemeChangedEvent.class).register(x -> reloadColor(x.getValue()));
|
||||
|
||||
SwingUtilities.invokeLater(() -> selectTab("main"));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.AuthenticatorChangedEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ProfileChangedEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.config.ProfileLoadingEvent;
|
||||
@@ -97,12 +97,12 @@ public class MainPagePanel extends Page {
|
||||
|
||||
((RepaintPage) pnlMore).setRepainter(pnlRoot);
|
||||
|
||||
HMCLAPI.EVENT_BUS.channel(AuthenticatorChangedEvent.class).register(onAuthChanged);
|
||||
HMCLAPI.EVENT_BUS.channel(ProfileLoadingEvent.class).register(onLoadingProfiles);
|
||||
HMCLAPI.EVENT_BUS.channel(ProfileChangedEvent.class).register(onSelectedProfilesChanged);
|
||||
HMCLAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(onRefreshedVersions);
|
||||
HMCLAPI.EVENT_BUS.channel(LaunchingStateChangedEvent.class).register(launchingStateChanged);
|
||||
HMCLAPI.EVENT_BUS.channel(LaunchSucceededEvent.class).register(this::prepareAuths);
|
||||
HMCAPI.EVENT_BUS.channel(AuthenticatorChangedEvent.class).register(onAuthChanged);
|
||||
HMCAPI.EVENT_BUS.channel(ProfileLoadingEvent.class).register(onLoadingProfiles);
|
||||
HMCAPI.EVENT_BUS.channel(ProfileChangedEvent.class).register(onSelectedProfilesChanged);
|
||||
HMCAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).register(onRefreshedVersions);
|
||||
HMCAPI.EVENT_BUS.channel(LaunchingStateChangedEvent.class).register(launchingStateChanged);
|
||||
HMCAPI.EVENT_BUS.channel(LaunchSucceededEvent.class).register(this::prepareAuths);
|
||||
|
||||
prepareAuths();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jackhuang.hellominecraft.launcher.core.launch.LaunchOptions;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Profile;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Settings;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.LaunchSucceededEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.LaunchingState;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.launch.LaunchingStateChangedEvent;
|
||||
@@ -50,12 +50,12 @@ public class HMCLGameLauncher {
|
||||
public HMCLGameLauncher(Profile p) {
|
||||
this.profile = p;
|
||||
|
||||
HMCLAPI.EVENT_BUS.channel(LaunchSucceededEvent.class).register(() -> setLaunching(false));
|
||||
HMCAPI.EVENT_BUS.channel(LaunchSucceededEvent.class).register(() -> setLaunching(false));
|
||||
}
|
||||
|
||||
void setLaunching(boolean isLaunching) {
|
||||
if (isLaunching != this.isLaunching)
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, isLaunching ? LaunchingState.Starting : LaunchingState.Done));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new LaunchingStateChangedEvent(this, isLaunching ? LaunchingState.Starting : LaunchingState.Done));
|
||||
this.isLaunching = isLaunching;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class HMCLGameLauncher {
|
||||
Thread.currentThread().setName("Game Launcher");
|
||||
try {
|
||||
LaunchOptions options = profile.getSelectedVersionSetting().createLaunchOptions(profile.getCanonicalGameDirFile());
|
||||
HMCLAPI.EVENT_BUS.fireChannel(new ProcessingLaunchOptionsEvent(this, options));
|
||||
HMCAPI.EVENT_BUS.fireChannel(new ProcessingLaunchOptionsEvent(this, options));
|
||||
DefaultGameLauncher gl = new DefaultGameLauncher(options, profile.service(), li, l);
|
||||
GameLauncherTag tag = new GameLauncherTag();
|
||||
tag.launcherVisibility = profile.getSelectedVersionSetting().getLauncherVisibility();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package org.jackhuang.hellominecraft.launcher.util;
|
||||
|
||||
import java.io.File;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.MinecraftLibraryPathEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.GameDirType;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager;
|
||||
@@ -34,7 +34,7 @@ public class HMCLGameProvider extends MinecraftVersionManager {
|
||||
public HMCLGameProvider(HMCLMinecraftService p) {
|
||||
super(p);
|
||||
|
||||
HMCLAPI.EVENT_BUS.channel(MinecraftLibraryPathEvent.class).register(t -> {
|
||||
HMCAPI.EVENT_BUS.channel(MinecraftLibraryPathEvent.class).register(t -> {
|
||||
if (!t.getFile().getValue().exists())
|
||||
t.getFile().setValue(new File(Settings.getInstance().getCommonpath(), t.getLocation()));
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.jackhuang.hellominecraft.api.HMCLAPI;
|
||||
import org.jackhuang.hellominecraft.api.HMCAPI;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.LoadedOneVersionEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.RefreshedVersionsEvent;
|
||||
import org.jackhuang.hellominecraft.launcher.api.event.version.RefreshingVersionsEvent;
|
||||
@@ -57,8 +57,8 @@ public class HMCLMinecraftService extends IMinecraftService {
|
||||
this.p = p;
|
||||
this.provider = new HMCLGameProvider(this);
|
||||
provider.initializeMiencraft();
|
||||
HMCLAPI.EVENT_BUS.channel(RefreshingVersionsEvent.class).register(versionSettings::clear);
|
||||
HMCLAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).registerFirst(() -> {
|
||||
HMCAPI.EVENT_BUS.channel(RefreshingVersionsEvent.class).register(versionSettings::clear);
|
||||
HMCAPI.EVENT_BUS.channel(RefreshedVersionsEvent.class).registerFirst(() -> {
|
||||
if (!checkingModpack) {
|
||||
checkingModpack = true;
|
||||
if (version().getVersionCount() == 0) {
|
||||
@@ -72,7 +72,7 @@ public class HMCLMinecraftService extends IMinecraftService {
|
||||
}
|
||||
}
|
||||
});
|
||||
HMCLAPI.EVENT_BUS.channel(LoadedOneVersionEvent.class).register(e -> loadVersionSetting(e.getValue()));
|
||||
HMCAPI.EVENT_BUS.channel(LoadedOneVersionEvent.class).register(e -> loadVersionSetting(e.getValue()));
|
||||
this.mms = new MinecraftModService(this);
|
||||
this.mds = new MinecraftDownloadService(this);
|
||||
this.mas = new HMCLAssetService(this);
|
||||
|
||||
Reference in New Issue
Block a user