Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b5a58a867 | ||
|
|
c6ab7878e7 | ||
|
|
99e85eba37 | ||
|
|
3bf92e6f12 | ||
|
|
ba359305f6 |
No files matched your search
+5
-4
@@ -1,3 +1,6 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import proguard.gradle.ProGuardTask
|
||||
|
||||
import java.security.MessageDigest
|
||||
import java.util.jar.JarFile
|
||||
import java.util.jar.Pack200
|
||||
@@ -17,9 +20,7 @@ def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "3.0"
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
String bundleName = "Hello Minecraft! Launcher"
|
||||
version = mavenVersion
|
||||
|
||||
dependencies {
|
||||
@@ -30,7 +31,7 @@ dependencies {
|
||||
task generateSources(type: Sync) {
|
||||
from 'src/main/java'
|
||||
into "$buildDir/generated-src"
|
||||
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
|
||||
filter(ReplaceTokens, tokens: [
|
||||
'HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING': mavenVersion
|
||||
])
|
||||
}
|
||||
@@ -122,7 +123,7 @@ task makePackGZ(dependsOn: jar) doLast {
|
||||
fileEx.append sha1Hex
|
||||
}
|
||||
|
||||
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
|
||||
task proguard(type: ProGuardTask, dependsOn: jar) {
|
||||
ext {
|
||||
def re = jar.classifier
|
||||
injar = jar.archivePath
|
||||
|
||||
@@ -86,6 +86,8 @@ public final class Launcher extends Application {
|
||||
}
|
||||
|
||||
public static void stopWithoutPlatform() {
|
||||
Logging.LOG.info("Stopping application without JavaFX Toolkit");
|
||||
|
||||
JFXUtilities.runInFX(() -> {
|
||||
if (Controllers.getStage() == null)
|
||||
return;
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl;
|
||||
|
||||
import org.apache.commons.compress.utils.Charsets;
|
||||
import org.jackhuang.hmcl.util.Logging;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
|
||||
public final class Main {
|
||||
|
||||
@@ -17,6 +17,13 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.event;
|
||||
|
||||
import org.jackhuang.hmcl.auth.Account;
|
||||
import org.jackhuang.hmcl.setting.Profile;
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* This event gets fired when loading accounts.
|
||||
* <br>
|
||||
@@ -26,14 +33,29 @@ package org.jackhuang.hmcl.event;
|
||||
*/
|
||||
public class AccountLoadingEvent extends Event {
|
||||
|
||||
private final Collection<Account> accounts;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param source {@link org.jackhuang.hmcl.setting.Settings}
|
||||
*/
|
||||
public AccountLoadingEvent(Object source) {
|
||||
public AccountLoadingEvent(Object source, Collection<Account> accounts) {
|
||||
super(source);
|
||||
this.accounts = Collections.unmodifiableCollection(accounts);
|
||||
}
|
||||
|
||||
|
||||
public Collection<Account> getAccounts() {
|
||||
return accounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("source", source)
|
||||
.append("accounts", accounts)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.event;
|
||||
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
import org.jackhuang.hmcl.util.VersionNumber;
|
||||
|
||||
/**
|
||||
@@ -42,4 +43,11 @@ public final class OutOfDateEvent extends Event {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("source", getSource())
|
||||
.append("version", getVersion())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.jackhuang.hmcl.event;
|
||||
|
||||
import org.jackhuang.hmcl.setting.Profile;
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* This event gets fired when the selected profile changed.
|
||||
@@ -44,4 +45,11 @@ public final class ProfileChangedEvent extends Event {
|
||||
return profile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("source", source)
|
||||
.append("profile", profile)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,12 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.event;
|
||||
|
||||
import org.jackhuang.hmcl.setting.Profile;
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* This event gets fired when loading profiles.
|
||||
* <br>
|
||||
@@ -26,14 +32,29 @@ package org.jackhuang.hmcl.event;
|
||||
*/
|
||||
public class ProfileLoadingEvent extends Event {
|
||||
|
||||
private final Collection<Profile> profiles;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param source {@link org.jackhuang.hmcl.setting.Settings}
|
||||
*/
|
||||
public ProfileLoadingEvent(Object source) {
|
||||
public ProfileLoadingEvent(Object source, Collection<Profile> profiles) {
|
||||
super(source);
|
||||
|
||||
this.profiles = Collections.unmodifiableCollection(profiles);
|
||||
}
|
||||
|
||||
public Collection<Profile> getProfiles() {
|
||||
return profiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("source", source)
|
||||
.append("profiles", profiles)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public final class HMCLModpackInstallTask extends Task {
|
||||
private final String name;
|
||||
private final HMCLGameRepository repository;
|
||||
private final Modpack modpack;
|
||||
private final File run;
|
||||
private final List<Task> dependencies = new LinkedList<>();
|
||||
private final List<Task> dependents = new LinkedList<>();
|
||||
|
||||
@@ -52,8 +51,8 @@ public final class HMCLModpackInstallTask extends Task {
|
||||
this.zipFile = zipFile;
|
||||
this.name = name;
|
||||
this.modpack = modpack;
|
||||
this.run = repository.getRunDirectory(name);
|
||||
|
||||
File run = repository.getRunDirectory(name);
|
||||
File json = repository.getModpackConfiguration(name);
|
||||
if (repository.hasVersion(name) && !json.exists())
|
||||
throw new IllegalArgumentException("Version " + name + " already exists");
|
||||
|
||||
@@ -50,7 +50,6 @@ public final class LauncherHelper {
|
||||
public static final LauncherHelper INSTANCE = new LauncherHelper();
|
||||
private LauncherHelper(){}
|
||||
|
||||
private TaskExecutor executor;
|
||||
public static final Queue<ManagedProcess> PROCESSES = new ConcurrentLinkedQueue<>();
|
||||
private final TaskExecutorDialogPane launchingStepsPane = new TaskExecutorDialogPane(() -> {});
|
||||
|
||||
@@ -78,7 +77,7 @@ public final class LauncherHelper {
|
||||
VersionSetting setting = profile.getVersionSetting(selectedVersion);
|
||||
Optional<String> gameVersion = GameVersion.minecraftVersion(repository.getVersionJar(version));
|
||||
|
||||
executor = Task.of(Schedulers.javafx(), () -> Controllers.dialog(launchingStepsPane))
|
||||
TaskExecutor executor = Task.of(Schedulers.javafx(), () -> Controllers.dialog(launchingStepsPane))
|
||||
.then(Task.of(Schedulers.javafx(), () -> emitStatus(LoadingState.DEPENDENCIES)))
|
||||
.then(variables -> {
|
||||
if (setting.isNotCheckGame())
|
||||
@@ -162,8 +161,7 @@ public final class LauncherHelper {
|
||||
Controllers.closeDialog();
|
||||
});
|
||||
}
|
||||
|
||||
LauncherHelper.this.executor = null;
|
||||
launchingStepsPane.setExecutor(null);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -356,7 +354,8 @@ public final class LauncherHelper {
|
||||
});
|
||||
break;
|
||||
case CLOSE:
|
||||
throw new Error("Never come to here");
|
||||
// Never come to here.
|
||||
break;
|
||||
case KEEP:
|
||||
// No operations here
|
||||
break;
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jackhuang.hmcl.game.HMCLGameRepository;
|
||||
import org.jackhuang.hmcl.mod.ModManager;
|
||||
import org.jackhuang.hmcl.util.ImmediateObjectProperty;
|
||||
import org.jackhuang.hmcl.util.ImmediateStringProperty;
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
@@ -146,6 +147,14 @@ public final class Profile {
|
||||
vs.setUsesGlobal(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("gameDir", getGameDir())
|
||||
.append("name", getName())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public void addPropertyChangedListener(InvalidationListener listener) {
|
||||
nameProperty.addListener(listener);
|
||||
globalProperty.addListener(listener);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Settings {
|
||||
|
||||
private final Config SETTINGS = initSettings();
|
||||
|
||||
private Map<String, Account> accounts = new HashMap<>();
|
||||
private final Map<String, Account> accounts = new HashMap<>();
|
||||
|
||||
{
|
||||
loadProxy();
|
||||
@@ -473,7 +473,7 @@ public class Settings {
|
||||
checkProfileMap();
|
||||
|
||||
if (!hasProfile(SETTINGS.getSelectedProfile())) {
|
||||
SETTINGS.setSelectedProfile(getProfileMap().keySet().stream().findFirst().get());
|
||||
getProfileMap().keySet().stream().findFirst().ifPresent(SETTINGS::setSelectedProfile);
|
||||
Schedulers.computation().schedule(this::onProfileChanged);
|
||||
}
|
||||
return getProfile(SETTINGS.getSelectedProfile());
|
||||
@@ -535,7 +535,7 @@ public class Settings {
|
||||
}
|
||||
|
||||
private void onProfileChanged() {
|
||||
EventBus.EVENT_BUS.fireEvent(new ProfileChangedEvent(SETTINGS, getSelectedProfile()));
|
||||
EventBus.EVENT_BUS.fireEvent(new ProfileChangedEvent(this, getSelectedProfile()));
|
||||
getSelectedProfile().getRepository().refreshVersionsAsync().start();
|
||||
}
|
||||
|
||||
@@ -548,11 +548,11 @@ public class Settings {
|
||||
* Invoked by loading GUI phase.
|
||||
*/
|
||||
public void onProfileLoading() {
|
||||
EventBus.EVENT_BUS.fireEvent(new ProfileLoadingEvent(SETTINGS));
|
||||
EventBus.EVENT_BUS.fireEvent(new ProfileLoadingEvent(this, getProfiles()));
|
||||
onProfileChanged();
|
||||
}
|
||||
|
||||
public void onAccountLoading() {
|
||||
EventBus.EVENT_BUS.fireEvent(new AccountLoadingEvent(SETTINGS));
|
||||
EventBus.EVENT_BUS.fireEvent(new AccountLoadingEvent(this, getAccounts()));
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import org.jackhuang.hmcl.setting.Accounts;
|
||||
import org.jackhuang.hmcl.setting.Settings;
|
||||
import org.jackhuang.hmcl.setting.Theme;
|
||||
import org.jackhuang.hmcl.task.Schedulers;
|
||||
import org.jackhuang.hmcl.task.Task;
|
||||
import org.jackhuang.hmcl.ui.construct.ComponentList;
|
||||
import org.jackhuang.hmcl.ui.wizard.DecoratorPage;
|
||||
|
||||
|
||||
@@ -93,6 +93,8 @@ public final class Controllers {
|
||||
public static void initialize(Stage stage) {
|
||||
Controllers.stage = stage;
|
||||
|
||||
stage.setOnCloseRequest(e -> Launcher.stopApplication());
|
||||
|
||||
decorator = new Decorator(stage, getMainPage(), Launcher.TITLE, false, true);
|
||||
decorator.showPage(null);
|
||||
leftPaneController = new LeftPaneController(decorator.getLeftPane());
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
||||
private static final SVGGlyph close = Lang.apply(new SVGGlyph(0, "CLOSE", "M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z", Color.WHITE),
|
||||
glyph -> { glyph.setPrefSize(12, 12); glyph.setSize(12, 12); });
|
||||
|
||||
private final ObjectProperty<Runnable> onCloseButtonAction = new SimpleObjectProperty<>(Launcher::stopApplication);
|
||||
private final ObjectProperty<Runnable> onCloseButtonAction;
|
||||
private final BooleanProperty customMaximize = new SimpleBooleanProperty(false);
|
||||
|
||||
private final Stage primaryStage;
|
||||
@@ -141,6 +141,8 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
||||
|
||||
FXUtils.loadFXML(this, "/assets/fxml/decorator.fxml");
|
||||
|
||||
onCloseButtonAction = new SimpleObjectProperty<>(this, "onCloseButtonAction", Launcher::stopApplication);
|
||||
|
||||
primaryStage.initStyle(StageStyle.UNDECORATED);
|
||||
btnClose.setGraphic(close);
|
||||
btnMin.setGraphic(minus);
|
||||
|
||||
@@ -209,7 +209,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
||||
}
|
||||
|
||||
private void loadingVersions() {
|
||||
contentPane.getChildren().setAll(spinner);
|
||||
getChildren().setAll(spinner);
|
||||
FXUtils.resetChildren(masonryPane, Collections.emptyList());
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
||||
}
|
||||
JFXUtilities.runInFX(() -> {
|
||||
if (profile == repository.getProfile()) {
|
||||
contentPane.getChildren().setAll(masonryPane);
|
||||
getChildren().setAll(contentPane);
|
||||
FXUtils.resetChildren(masonryPane, children);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -57,7 +57,9 @@ public class TaskExecutorDialogPane extends StackPane {
|
||||
|
||||
public void setExecutor(TaskExecutor executor) {
|
||||
this.executor = executor;
|
||||
taskListPane.setExecutor(executor);
|
||||
|
||||
if (executor != null)
|
||||
taskListPane.setExecutor(executor);
|
||||
}
|
||||
|
||||
public StringProperty titleProperty() {
|
||||
|
||||
@@ -28,12 +28,10 @@ import org.jackhuang.hmcl.ui.wizard.WizardPage;
|
||||
import java.util.Map;
|
||||
|
||||
public final class InstallTypePage extends StackPane implements WizardPage {
|
||||
private final WizardController controller;
|
||||
|
||||
@FXML private JFXListView<Object> list;
|
||||
|
||||
public InstallTypePage(WizardController controller) {
|
||||
this.controller = controller;
|
||||
|
||||
FXUtils.loadFXML(this, "/assets/fxml/download/dltype.fxml");
|
||||
list.setOnMouseClicked(e -> {
|
||||
|
||||
@@ -37,8 +37,6 @@ import java.util.Map;
|
||||
|
||||
public class InstallersPage extends StackPane implements WizardPage {
|
||||
private final WizardController controller;
|
||||
private final GameRepository repository;
|
||||
private final DownloadProvider downloadProvider;
|
||||
|
||||
@FXML
|
||||
private VBox list;
|
||||
@@ -72,8 +70,6 @@ public class InstallersPage extends StackPane implements WizardPage {
|
||||
|
||||
public InstallersPage(WizardController controller, GameRepository repository, DownloadProvider downloadProvider) {
|
||||
this.controller = controller;
|
||||
this.repository = repository;
|
||||
this.downloadProvider = downloadProvider;
|
||||
|
||||
FXUtils.loadFXML(this, "/assets/fxml/download/installers.fxml");
|
||||
|
||||
|
||||
@@ -44,11 +44,9 @@ import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class VersionsPage extends StackPane implements WizardPage, Refreshable {
|
||||
private final WizardController controller;
|
||||
private final String gameVersion;
|
||||
private final DownloadProvider downloadProvider;
|
||||
private final String libraryId;
|
||||
private final Runnable callback;
|
||||
private final String title;
|
||||
|
||||
@FXML
|
||||
@@ -73,12 +71,10 @@ public final class VersionsPage extends StackPane implements WizardPage, Refresh
|
||||
private TaskExecutor executor;
|
||||
|
||||
public VersionsPage(WizardController controller, String title, String gameVersion, DownloadProvider downloadProvider, String libraryId, Runnable callback) {
|
||||
this.controller = controller;
|
||||
this.title = title;
|
||||
this.gameVersion = gameVersion;
|
||||
this.downloadProvider = downloadProvider;
|
||||
this.libraryId = libraryId;
|
||||
this.callback = callback;
|
||||
this.versionList = downloadProvider.getVersionListById(libraryId);
|
||||
|
||||
FXUtils.loadFXML(this, "/assets/fxml/download/versions.fxml");
|
||||
|
||||
@@ -176,7 +176,7 @@ public class AppDataUpgrader extends IUpgrader {
|
||||
|
||||
@Override
|
||||
public Collection<Task> getDependents() {
|
||||
return Arrays.asList(new FileDownloadTask(downloadLink, tempFile, Proxy.NO_PROXY, hash));
|
||||
return Collections.singleton(new FileDownloadTask(downloadLink, tempFile, Proxy.NO_PROXY, hash));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,6 +37,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||
private static final HashMap<String, String> SOURCE = new HashMap<String, String>() {
|
||||
{
|
||||
put("javafx.fxml.LoadException", Launcher.i18n("crash.NoClassDefFound"));
|
||||
put("Location is not set", Launcher.i18n("crash.NoClassDefFound"));
|
||||
put("UnsatisfiedLinkError", Launcher.i18n("crash.user_fault"));
|
||||
put("java.lang.NoClassDefFoundError", Launcher.i18n("crash.NoClassDefFound"));
|
||||
put("java.lang.VerifyError", Launcher.i18n("crash.NoClassDefFound"));
|
||||
@@ -45,6 +46,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||
put("java.lang.ClassFormatError", Launcher.i18n("crash.NoClassDefFound"));
|
||||
put("java.lang.OutOfMemoryError", "FUCKING MEMORY LIMIT!");
|
||||
put("Trampoline", Launcher.i18n("launcher.update_java"));
|
||||
put("com.sun.javafx.css.StyleManager.findMatchingStyles", Launcher.i18n("launcher.update_java"));
|
||||
put("NoSuchAlgorithmException", "Has your operating system been installed completely or is a ghost system?");
|
||||
}
|
||||
};
|
||||
@@ -78,18 +80,16 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||
THROWABLE_SET.add(stackTrace);
|
||||
|
||||
try {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("---- Hello Minecraft! Crash Report ----\n");
|
||||
builder.append(" Version: " + Launcher.VERSION + "\n");
|
||||
builder.append(" Time: ").append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())).append("\n");
|
||||
builder.append(" Thread: ").append(t.toString()).append("\n");
|
||||
builder.append("\n Content: \n ");
|
||||
builder.append(stackTrace).append("\n\n");
|
||||
builder.append("-- System Details --\n");
|
||||
builder.append(" Operating System: ").append(System.getProperty("os.name")).append(' ').append(OperatingSystem.SYSTEM_VERSION).append("\n");
|
||||
builder.append(" Java Version: ").append(System.getProperty("java.version")).append(", ").append(System.getProperty("java.vendor")).append("\n");
|
||||
builder.append(" Java VM Version: ").append(System.getProperty("java.vm.name")).append(" (").append(System.getProperty("java.vm.info")).append("), ").append(System.getProperty("java.vm.vendor")).append("\n");
|
||||
String text = builder.toString();
|
||||
String text = "---- Hello Minecraft! Crash Report ----\n" +
|
||||
" Version: " + Launcher.VERSION + "\n" +
|
||||
" Time: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n" +
|
||||
" Thread: " + t.toString() + "\n" +
|
||||
"\n Content: \n " +
|
||||
stackTrace + "\n\n" +
|
||||
"-- System Details --\n" +
|
||||
" Operating System: " + System.getProperty("os.name") + ' ' + OperatingSystem.SYSTEM_VERSION + "\n" +
|
||||
" Java Version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n" +
|
||||
" Java VM Version: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n";
|
||||
|
||||
Logging.LOG.log(Level.SEVERE, text);
|
||||
|
||||
|
||||
@@ -10,23 +10,23 @@
|
||||
maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
|
||||
type="StackPane" pickOnBounds="false"
|
||||
xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<JFXSpinner fx:id="spinner" styleClass="first-spinner" />
|
||||
<StackPane fx:id="contentPane">
|
||||
<JFXSpinner fx:id="spinner" styleClass="first-spinner" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" fx:id="scrollPane" hbarPolicy="NEVER">
|
||||
<JFXMasonryPane fx:id="masonryPane" HSpacing="3" VSpacing="3" cellWidth="182" cellHeight="160">
|
||||
</JFXMasonryPane>
|
||||
</ScrollPane>
|
||||
<VBox style="-fx-padding: 15;" spacing="15" pickOnBounds="false" alignment="BOTTOM_RIGHT">
|
||||
<JFXButton prefWidth="40" prefHeight="40" buttonType="RAISED" fx:id="btnRefresh" styleClass="jfx-button-raised-round">
|
||||
<graphic>
|
||||
<fx:include source="/assets/svg/refresh.fxml" />
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
<JFXButton prefWidth="40" prefHeight="40" buttonType="RAISED" fx:id="btnAdd" styleClass="jfx-button-raised-round">
|
||||
<graphic>
|
||||
<fx:include source="/assets/svg/plus.fxml" />
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
</VBox>
|
||||
</StackPane>
|
||||
<VBox style="-fx-padding: 15;" spacing="15" pickOnBounds="false" alignment="BOTTOM_RIGHT">
|
||||
<JFXButton prefWidth="40" prefHeight="40" buttonType="RAISED" fx:id="btnRefresh" styleClass="jfx-button-raised-round">
|
||||
<graphic>
|
||||
<fx:include source="/assets/svg/refresh.fxml" />
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
<JFXButton prefWidth="40" prefHeight="40" buttonType="RAISED" fx:id="btnAdd" styleClass="jfx-button-raised-round">
|
||||
<graphic>
|
||||
<fx:include source="/assets/svg/plus.fxml" />
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
</VBox>
|
||||
</fx:root>
|
||||
@@ -5,7 +5,6 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import org.jackhuang.hmcl.ui.construct.*?>
|
||||
<?import org.jackhuang.hmcl.ui.*?>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.auth;
|
||||
|
||||
import org.jackhuang.hmcl.util.ToStringBuilder;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -64,4 +66,13 @@ public abstract class Account {
|
||||
public abstract Map<Object, Object> toStorage();
|
||||
|
||||
public abstract void clearCache();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("username", getUsername())
|
||||
.append("character", getCharacter())
|
||||
.append("uuid", getUUID())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import org.jackhuang.hmcl.download.optifine.OptiFineVersionList;
|
||||
*/
|
||||
public class MojangDownloadProvider implements DownloadProvider {
|
||||
|
||||
private boolean isChina;
|
||||
private final boolean isChina;
|
||||
|
||||
public MojangDownloadProvider(boolean isChina) {
|
||||
this.isChina = isChina;
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class ForgeInstallTask extends TaskResult<Version> {
|
||||
private final DefaultDependencyManager dependencyManager;
|
||||
private final Version version;
|
||||
private final File installer = new File("forge-installer.jar").getAbsoluteFile();
|
||||
private ForgeRemoteVersion remote;
|
||||
private final ForgeRemoteVersion remote;
|
||||
private final List<Task> dependents = new LinkedList<>();
|
||||
private final List<Task> dependencies = new LinkedList<>();
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public final class LiteLoaderInstallTask extends TaskResult<Version> {
|
||||
|
||||
private final DefaultDependencyManager dependencyManager;
|
||||
private final Version version;
|
||||
private LiteLoaderRemoteVersion remote;
|
||||
private final LiteLoaderRemoteVersion remote;
|
||||
private final List<Task> dependents = new LinkedList<>();
|
||||
private final List<Task> dependencies = new LinkedList<>();
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public final class OptiFineInstallTask extends TaskResult<Version> {
|
||||
|
||||
private final DefaultDependencyManager dependencyManager;
|
||||
private final Version version;
|
||||
private OptiFineRemoteVersion remote;
|
||||
private final OptiFineRemoteVersion remote;
|
||||
private final List<Task> dependents = new LinkedList<>();
|
||||
private final List<Task> dependencies = new LinkedList<>();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Event {
|
||||
/**
|
||||
* The object on which the Event initially occurred.
|
||||
*/
|
||||
protected transient Object source;
|
||||
protected final transient Object source;
|
||||
|
||||
/**
|
||||
* Constructs a prototypical Event.
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DefaultGameRepository implements GameRepository {
|
||||
@Override
|
||||
public Version getVersion(String id) {
|
||||
if (!hasVersion(id))
|
||||
throw new VersionNotFoundException("Version '" + id + "' does not exist.");
|
||||
throw new VersionNotFoundException("Version '" + id + "' does not exist in " + versions.keySet() + ".");
|
||||
return versions.get(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class LibrariesDownloadInfo {
|
||||
|
||||
public LibrariesDownloadInfo(LibraryDownloadInfo artifact, Map<String, LibraryDownloadInfo> classifiers) {
|
||||
this.artifact = artifact;
|
||||
this.classifiers = new HashMap<>(classifiers);
|
||||
this.classifiers = classifiers == null ? null : new HashMap<>(classifiers);
|
||||
}
|
||||
|
||||
public LibraryDownloadInfo getArtifact() {
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class StringArgument implements Argument {
|
||||
@Override
|
||||
public List<String> toString(Map<String, String> keys, Map<String, Boolean> features) {
|
||||
String res = argument;
|
||||
Pattern pattern = Pattern.compile("\\$\\{(.*?)\\}");
|
||||
Pattern pattern = Pattern.compile("\\$\\{(.*?)}");
|
||||
Matcher m = pattern.matcher(argument);
|
||||
while (m.find()) {
|
||||
String entry = m.group();
|
||||
|
||||
@@ -44,23 +44,20 @@ import java.util.Objects;
|
||||
*/
|
||||
public final class MultiMCModpackInstallTask extends Task {
|
||||
|
||||
private final DefaultDependencyManager dependencyManager;
|
||||
private final File zipFile;
|
||||
private final MultiMCInstanceConfiguration manifest;
|
||||
private final String name;
|
||||
private final File run;
|
||||
private final DefaultGameRepository repository;
|
||||
private final List<Task> dependencies = new LinkedList<>();
|
||||
private final List<Task> dependents = new LinkedList<>();
|
||||
|
||||
public MultiMCModpackInstallTask(DefaultDependencyManager dependencyManager, File zipFile, MultiMCInstanceConfiguration manifest, String name) {
|
||||
this.dependencyManager = dependencyManager;
|
||||
this.zipFile = zipFile;
|
||||
this.manifest = manifest;
|
||||
this.name = name;
|
||||
this.repository = dependencyManager.getGameRepository();
|
||||
this.run = repository.getRunDirectory(name);
|
||||
|
||||
File run = repository.getRunDirectory(name);
|
||||
File json = repository.getModpackConfiguration(name);
|
||||
if (repository.hasVersion(name) && !json.exists())
|
||||
throw new IllegalArgumentException("Version " + name + " already exists.");
|
||||
|
||||
@@ -35,9 +35,7 @@ public final class Schedulers {
|
||||
private static synchronized ExecutorService getCachedExecutorService() {
|
||||
if (CACHED_EXECUTOR == null)
|
||||
CACHED_EXECUTOR = new ThreadPoolExecutor(0, Integer.MAX_VALUE,
|
||||
60, TimeUnit.SECONDS, new SynchronousQueue<>(), runnable -> {
|
||||
return Executors.defaultThreadFactory().newThread(runnable);
|
||||
});
|
||||
60, TimeUnit.SECONDS, new SynchronousQueue<>(), Executors.defaultThreadFactory());
|
||||
|
||||
return CACHED_EXECUTOR;
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ public enum Log4jLevel {
|
||||
public boolean lessOrEqual(Log4jLevel level) {
|
||||
return this.level <= level.level;
|
||||
}
|
||||
public static final Pattern MINECRAFT_LOGGER = Pattern.compile("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\]");
|
||||
public static final Pattern MINECRAFT_LOGGER_CATEGORY = Pattern.compile("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\] \\[(?<category>[^\\]]+)\\]");
|
||||
public static final Pattern MINECRAFT_LOGGER = Pattern.compile("\\[(?<timestamp>[0-9:]+)] \\[[^/]+/(?<level>[^]]+)]");
|
||||
public static final Pattern MINECRAFT_LOGGER_CATEGORY = Pattern.compile("\\[(?<timestamp>[0-9:]+)] \\[[^/]+/(?<level>[^]]+)] \\[(?<category>[^]]+)]");
|
||||
public static final String JAVA_SYMBOL = "([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$][a-zA-Z\\d_$]*";
|
||||
|
||||
public static Log4jLevel guessLevel(String line) {
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.jackhuang.hmcl.util;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.*;
|
||||
|
||||
Reference in new issue
Block a user