mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
Fasten version item construction
This commit is contained in:
parent
72871e6d9a
commit
118a6cf0d1
@ -50,10 +50,11 @@ import org.jackhuang.hmcl.util.OperatingSystem;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.util.StringUtils.removePrefix;
|
import static org.jackhuang.hmcl.util.StringUtils.removePrefix;
|
||||||
import static org.jackhuang.hmcl.util.StringUtils.removeSuffix;
|
import static org.jackhuang.hmcl.util.StringUtils.removeSuffix;
|
||||||
@ -88,7 +89,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
});
|
});
|
||||||
EventBus.EVENT_BUS.channel(RefreshingVersionsEvent.class).register(event -> {
|
EventBus.EVENT_BUS.channel(RefreshingVersionsEvent.class).register(event -> {
|
||||||
if (event.getSource() == profile.getRepository())
|
if (event.getSource() == profile.getRepository())
|
||||||
JFXUtilities.runInFXAndWait(this::loadingVersions);
|
// This will occupy 0.5s. Too slow!
|
||||||
|
JFXUtilities.runInFX(this::loadingVersions);
|
||||||
});
|
});
|
||||||
EventBus.EVENT_BUS.channel(ProfileChangedEvent.class).register(event -> {
|
EventBus.EVENT_BUS.channel(ProfileChangedEvent.class).register(event -> {
|
||||||
this.profile = event.getProfile();
|
this.profile = event.getProfile();
|
||||||
@ -191,7 +193,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
Launcher.i18n("modpack.export"),
|
Launcher.i18n("modpack.export"),
|
||||||
Launcher.i18n("folder.game")
|
Launcher.i18n("folder.game")
|
||||||
));
|
));
|
||||||
versionList.setOnMouseClicked(e ->{
|
versionList.setOnMouseClicked(e -> {
|
||||||
versionPopup.hide();
|
versionPopup.hide();
|
||||||
switch (versionList.getSelectionModel().getSelectedIndex()) {
|
switch (versionList.getSelectionModel().getSelectedIndex()) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -208,7 +210,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
versionPopup.show(item, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, event.getX(), event.getY());
|
versionPopup.show(item, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, event.getX(), event.getY());
|
||||||
} else if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
|
} else if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
|
||||||
if (Settings.INSTANCE.getSelectedAccount() == null)
|
if (Settings.INSTANCE.getSelectedAccount() == null)
|
||||||
@ -229,10 +232,9 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadVersions(HMCLGameRepository repository) {
|
private void loadVersions(HMCLGameRepository repository) {
|
||||||
List<Node> children = new LinkedList<>();
|
List<Node> children = repository.getVersions().parallelStream()
|
||||||
for (Version version : repository.getVersions()) {
|
.map(version -> buildNode(repository, version, () -> GameVersion.minecraftVersion(repository.getVersionJar(version.getId())).orElse("Unknown")))
|
||||||
children.add(buildNode(repository, version, () -> GameVersion.minecraftVersion(repository.getVersionJar(version.getId())).orElse("Unknown")));
|
.collect(Collectors.toList());
|
||||||
}
|
|
||||||
JFXUtilities.runInFX(() -> {
|
JFXUtilities.runInFX(() -> {
|
||||||
if (profile == repository.getProfile()) {
|
if (profile == repository.getProfile()) {
|
||||||
masonryPane.getChildren().setAll(children);
|
masonryPane.getChildren().setAll(children);
|
||||||
|
@ -21,6 +21,8 @@ import com.jfoenix.controls.JFXButton;
|
|||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.effect.BlurType;
|
import javafx.scene.effect.BlurType;
|
||||||
import javafx.scene.effect.DropShadow;
|
import javafx.scene.effect.DropShadow;
|
||||||
@ -28,10 +30,9 @@ import javafx.scene.image.Image;
|
|||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.MouseButton;
|
import javafx.scene.input.MouseButton;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.*;
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.text.TextAlignment;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.Launcher;
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
|
|
||||||
@ -65,8 +66,107 @@ public final class VersionItem extends StackPane {
|
|||||||
|
|
||||||
private EventHandler<? super MouseEvent> launchClickedHandler = null;
|
private EventHandler<? super MouseEvent> launchClickedHandler = null;
|
||||||
|
|
||||||
|
private void initializeComponents() {
|
||||||
|
setPickOnBounds(false);
|
||||||
|
FXUtils.setLimitWidth(this, 160);
|
||||||
|
FXUtils.setLimitHeight(this, 156);
|
||||||
|
|
||||||
|
content = new VBox();
|
||||||
|
{
|
||||||
|
header = new StackPane();
|
||||||
|
VBox.setVgrow(header, Priority.ALWAYS);
|
||||||
|
header.setPickOnBounds(false);
|
||||||
|
header.setPadding(new Insets(8));
|
||||||
|
header.setStyle("-fx-background-radius: 2 2 0 0; -fx-background-color: rgb(255,255,255,0.87);");
|
||||||
|
{
|
||||||
|
VBox headerContent = new VBox();
|
||||||
|
headerContent.setPadding(new Insets(8, 8, 0, 8));
|
||||||
|
{
|
||||||
|
lblVersionName = new Label();
|
||||||
|
lblVersionName.setStyle("-fx-font-size: 15;");
|
||||||
|
lblVersionName.setTextAlignment(TextAlignment.JUSTIFY);
|
||||||
|
lblVersionName.setWrapText(true);
|
||||||
|
headerContent.getChildren().add(lblVersionName);
|
||||||
|
|
||||||
|
lblGameVersion = new Label();
|
||||||
|
lblGameVersion.setStyle("-fx-font-size: 11;");
|
||||||
|
lblGameVersion.setTextAlignment(TextAlignment.JUSTIFY);
|
||||||
|
lblGameVersion.setWrapText(true);
|
||||||
|
headerContent.getChildren().add(lblGameVersion);
|
||||||
|
|
||||||
|
lblLibraries = new Label();
|
||||||
|
lblLibraries.setStyle("-fx-font-size: 10; -fx-text-fill: gray;");
|
||||||
|
lblLibraries.setTextAlignment(TextAlignment.JUSTIFY);
|
||||||
|
lblLibraries.setWrapText(true);
|
||||||
|
headerContent.getChildren().add(lblLibraries);
|
||||||
|
}
|
||||||
|
header.getChildren().add(headerContent);
|
||||||
|
}
|
||||||
|
content.getChildren().add(header);
|
||||||
|
|
||||||
|
body = new StackPane();
|
||||||
|
body.setStyle("-fx-background-radius: 0 0 2 2; -fx-background-color: rgb(255,255,255,0.87); -fx-padding: 8;");
|
||||||
|
body.setMinHeight(40);
|
||||||
|
body.setPickOnBounds(false);
|
||||||
|
{
|
||||||
|
BorderPane bodyContent = new BorderPane();
|
||||||
|
{
|
||||||
|
HBox hbox = new HBox();
|
||||||
|
hbox.setSpacing(8);
|
||||||
|
{
|
||||||
|
btnSettings = new JFXButton();
|
||||||
|
btnSettings.getStyleClass().add("toggle-icon4");
|
||||||
|
FXUtils.setLimitWidth(btnSettings, 30);
|
||||||
|
FXUtils.setLimitHeight(btnSettings, 30);
|
||||||
|
hbox.getChildren().add(btnSettings);
|
||||||
|
|
||||||
|
btnUpdate = new JFXButton();
|
||||||
|
btnUpdate.getStyleClass().add("toggle-icon4");
|
||||||
|
FXUtils.setLimitWidth(btnUpdate, 30);
|
||||||
|
FXUtils.setLimitHeight(btnUpdate, 30);
|
||||||
|
hbox.getChildren().add(btnUpdate);
|
||||||
|
}
|
||||||
|
bodyContent.setLeft(hbox);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
HBox hbox = new HBox();
|
||||||
|
hbox.setSpacing(8);
|
||||||
|
{
|
||||||
|
btnScript = new JFXButton();
|
||||||
|
btnScript.getStyleClass().add("toggle-icon4");
|
||||||
|
FXUtils.setLimitWidth(btnScript, 30);
|
||||||
|
FXUtils.setLimitHeight(btnScript, 30);
|
||||||
|
hbox.getChildren().add(btnScript);
|
||||||
|
|
||||||
|
btnLaunch = new JFXButton();
|
||||||
|
btnLaunch.getStyleClass().add("toggle-icon4");
|
||||||
|
FXUtils.setLimitWidth(btnLaunch, 30);
|
||||||
|
FXUtils.setLimitHeight(btnLaunch, 30);
|
||||||
|
hbox.getChildren().add(btnLaunch);
|
||||||
|
}
|
||||||
|
bodyContent.setRight(hbox);
|
||||||
|
}
|
||||||
|
body.getChildren().setAll(bodyContent);
|
||||||
|
}
|
||||||
|
content.getChildren().add(body);
|
||||||
|
}
|
||||||
|
getChildren().add(content);
|
||||||
|
|
||||||
|
icon = new StackPane();
|
||||||
|
StackPane.setAlignment(icon, Pos.TOP_RIGHT);
|
||||||
|
icon.setPickOnBounds(false);
|
||||||
|
{
|
||||||
|
iconView = new ImageView();
|
||||||
|
StackPane.setAlignment(iconView, Pos.CENTER_RIGHT);
|
||||||
|
StackPane.setMargin(iconView, new Insets(0, 12, 0, 0));
|
||||||
|
iconView.setImage(new Image("/assets/img/icon.png"));
|
||||||
|
icon.getChildren().add(iconView);
|
||||||
|
}
|
||||||
|
getChildren().add(icon);
|
||||||
|
}
|
||||||
|
|
||||||
public VersionItem() {
|
public VersionItem() {
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/version-item.fxml");
|
initializeComponents();
|
||||||
setEffect(new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.26), 5.0, 0.12, -1.0, 1.0));
|
setEffect(new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.26), 5.0, 0.12, -1.0, 1.0));
|
||||||
btnSettings.setGraphic(SVG.gear(Theme.blackFillBinding(), 15, 15));
|
btnSettings.setGraphic(SVG.gear(Theme.blackFillBinding(), 15, 15));
|
||||||
btnUpdate.setGraphic(SVG.update(Theme.blackFillBinding(), 15, 15));
|
btnUpdate.setGraphic(SVG.update(Theme.blackFillBinding(), 15, 15));
|
||||||
|
@ -911,6 +911,14 @@
|
|||||||
-fx-stroke-width: 5.0;
|
-fx-stroke-width: 5.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.small-spinner {
|
||||||
|
-jfx-radius: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-spinner > .arc {
|
||||||
|
-fx-stroke-width: 3.0;
|
||||||
|
}
|
||||||
|
|
||||||
.second-spinner {
|
.second-spinner {
|
||||||
-jfx-radius: 30;
|
-jfx-radius: 30;
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,11 @@
|
|||||||
</body>
|
</body>
|
||||||
<actions>
|
<actions>
|
||||||
<Label fx:id="lblCreationWarning"/>
|
<Label fx:id="lblCreationWarning"/>
|
||||||
|
<StackPane fx:id="acceptPane">
|
||||||
<JFXButton fx:id="btnAccept" onMouseClicked="#onCreationAccept" text="%button.ok" styleClass="dialog-accept"/>
|
<JFXButton fx:id="btnAccept" onMouseClicked="#onCreationAccept" text="%button.ok" styleClass="dialog-accept"/>
|
||||||
|
<JFXSpinner fx:id="spinnerAccept" styleClass="small-spinner" />
|
||||||
|
</StackPane>
|
||||||
<JFXButton onMouseClicked="#onCreationCancel" text="%button.cancel" styleClass="dialog-cancel"/>
|
<JFXButton onMouseClicked="#onCreationCancel" text="%button.cancel" styleClass="dialog-cancel"/>
|
||||||
</actions>
|
</actions>
|
||||||
</JFXDialogLayout>
|
</JFXDialogLayout>
|
||||||
<JFXProgressBar fx:id="progressBar" visible="false" StackPane.alignment="TOP_CENTER"/>
|
|
||||||
</fx:root>
|
</fx:root>
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import com.jfoenix.controls.JFXButton?>
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
|
||||||
<?import javafx.scene.image.Image?>
|
|
||||||
<?import javafx.scene.image.ImageView?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import org.jackhuang.hmcl.ui.FXUtils?>
|
|
||||||
<fx:root xmlns="http://javafx.com/javafx"
|
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
|
||||||
type="StackPane" pickOnBounds="false" FXUtils.limitWidth="160" FXUtils.limitHeight="156">
|
|
||||||
<VBox fx:id="content" pickOnBounds="false">
|
|
||||||
<StackPane fx:id="header" VBox.vgrow="ALWAYS" pickOnBounds="false" style="-fx-background-radius: 2 2 0 0; -fx-background-color: rgb(255,255,255,0.87); -fx-padding: 8;">
|
|
||||||
<VBox style="-fx-padding: 8 8 0 8;">
|
|
||||||
<Label fx:id="lblVersionName" style="-fx-font-size: 15;" textAlignment="JUSTIFY" wrapText="true" />
|
|
||||||
<Label fx:id="lblGameVersion" style="-fx-font-size: 11;" textAlignment="JUSTIFY" wrapText="true" />
|
|
||||||
<Label fx:id="lblLibraries" style="-fx-font-size: 10; -fx-text-fill: gray;" textAlignment="JUSTIFY" wrapText="true" />
|
|
||||||
</VBox>
|
|
||||||
</StackPane>
|
|
||||||
<StackPane fx:id="body" style="-fx-background-radius: 0 0 2 2; -fx-background-color: rgb(255,255,255,0.87); -fx-padding: 8;" minHeight="40" pickOnBounds="false">
|
|
||||||
<BorderPane>
|
|
||||||
<left>
|
|
||||||
<HBox spacing="8">
|
|
||||||
<JFXButton fx:id="btnSettings" styleClass="toggle-icon4" maxWidth="30" maxHeight="30" minWidth="30" minHeight="30" prefWidth="30" prefHeight="30" />
|
|
||||||
<JFXButton fx:id="btnUpdate" styleClass="toggle-icon4" maxWidth="30" maxHeight="30" minWidth="30" minHeight="30" prefWidth="30" prefHeight="30" />
|
|
||||||
</HBox>
|
|
||||||
</left>
|
|
||||||
<right>
|
|
||||||
<HBox spacing="8">
|
|
||||||
<JFXButton fx:id="btnScript" styleClass="toggle-icon4" maxWidth="30" maxHeight="30" minWidth="30" minHeight="30" prefWidth="30" prefHeight="30" />
|
|
||||||
<JFXButton fx:id="btnLaunch" styleClass="toggle-icon4" maxWidth="30" maxHeight="30" minHeight="30" minWidth="30" prefWidth="30" prefHeight="30" />
|
|
||||||
</HBox>
|
|
||||||
</right>
|
|
||||||
</BorderPane>
|
|
||||||
|
|
||||||
</StackPane>
|
|
||||||
</VBox>
|
|
||||||
<StackPane fx:id="icon" StackPane.alignment="TOP_RIGHT" pickOnBounds="false">
|
|
||||||
<ImageView fx:id="iconView" StackPane.alignment="CENTER_RIGHT">
|
|
||||||
<StackPane.margin>
|
|
||||||
<Insets right="12" />
|
|
||||||
</StackPane.margin>
|
|
||||||
<Image url="/assets/img/icon.png" />
|
|
||||||
</ImageView>
|
|
||||||
</StackPane>
|
|
||||||
</fx:root>
|
|
@ -18,7 +18,7 @@
|
|||||||
about.copyright=Copyright
|
about.copyright=Copyright
|
||||||
about.copyright.statement=Copyright (c) 2018 huangyuhui.
|
about.copyright.statement=Copyright (c) 2018 huangyuhui.
|
||||||
about.author=Author
|
about.author=Author
|
||||||
about.author.statement=huanghongxun (MCF: klkl6523)
|
about.author.statement=huanghongxun (hmcl@huangyuhui.net)
|
||||||
about.thanks_to=Thanks to
|
about.thanks_to=Thanks to
|
||||||
about.thanks_to.statement=bangbang93 (BMCLAPI, http://bmclapi2.bangbang93.com/)\ngamerteam (Default background image)\nAll contributors.
|
about.thanks_to.statement=bangbang93 (BMCLAPI, http://bmclapi2.bangbang93.com/)\ngamerteam (Default background image)\nAll contributors.
|
||||||
about.dependency=Dependency
|
about.dependency=Dependency
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
about.copyright=版权
|
about.copyright=版权
|
||||||
about.copyright.statement=Copyright (c) 2018 huangyuhui.
|
about.copyright.statement=Copyright (c) 2018 huangyuhui.
|
||||||
about.author=作者
|
about.author=作者
|
||||||
about.author.statement=huanghongxun (百度贴吧:huanghongxun20)
|
about.author.statement=huanghongxun (hmcl@huangyuhui.net)
|
||||||
about.thanks_to=鸣谢
|
about.thanks_to=鸣谢
|
||||||
about.thanks_to.statement=bangbang93 (BMCLAPI, http://bmclapi2.bangbang93.com/)\ngamerteam (默认背景图)\n所有参与本项目,issue,pull requests的贡献者
|
about.thanks_to.statement=bangbang93 (BMCLAPI, http://bmclapi2.bangbang93.com/)\ngamerteam (默认背景图)\n所有参与本项目,issue,pull requests的贡献者
|
||||||
about.dependency=依赖
|
about.dependency=依赖
|
||||||
|
@ -30,6 +30,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of classic Minecraft game repository.
|
* An implementation of classic Minecraft game repository.
|
||||||
@ -170,14 +171,7 @@ public class DefaultGameRepository implements GameRepository {
|
|||||||
|
|
||||||
File[] files = new File(getBaseDirectory(), "versions").listFiles();
|
File[] files = new File(getBaseDirectory(), "versions").listFiles();
|
||||||
if (files != null)
|
if (files != null)
|
||||||
for (File dir : files)
|
Arrays.stream(files).parallel().filter(File::isDirectory).flatMap(dir -> {
|
||||||
if (dir.isDirectory()) {
|
|
||||||
if (Thread.interrupted()) {
|
|
||||||
this.versions = new HashMap<>();
|
|
||||||
loaded = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String id = dir.getName();
|
String id = dir.getName();
|
||||||
File json = new File(dir, id + ".json");
|
File json = new File(dir, id + ".json");
|
||||||
|
|
||||||
@ -188,7 +182,7 @@ public class DefaultGameRepository implements GameRepository {
|
|||||||
if (jsons.size() == 1)
|
if (jsons.size() == 1)
|
||||||
if (!jsons.get(0).renameTo(json)) {
|
if (!jsons.get(0).renameTo(json)) {
|
||||||
Logging.LOG.warning("Cannot rename json file " + jsons.get(0) + " to " + json + ", ignoring version " + id);
|
Logging.LOG.warning("Cannot rename json file " + jsons.get(0) + " to " + json + ", ignoring version " + id);
|
||||||
continue;
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,13 +192,13 @@ public class DefaultGameRepository implements GameRepository {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// JsonSyntaxException or IOException or NullPointerException(!!)
|
// JsonSyntaxException or IOException or NullPointerException(!!)
|
||||||
if (EventBus.EVENT_BUS.fireEvent(new GameJsonParseFailedEvent(this, json, id)) != Event.Result.ALLOW)
|
if (EventBus.EVENT_BUS.fireEvent(new GameJsonParseFailedEvent(this, json, id)) != Event.Result.ALLOW)
|
||||||
continue;
|
return Stream.empty();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
version = Objects.requireNonNull(readVersionJson(json));
|
version = Objects.requireNonNull(readVersionJson(json));
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
Logging.LOG.log(Level.SEVERE, "User corrected version json is still malformed");
|
Logging.LOG.log(Level.SEVERE, "User corrected version json is still malformed");
|
||||||
continue;
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,12 +208,12 @@ public class DefaultGameRepository implements GameRepository {
|
|||||||
FileUtils.writeText(json, Constants.GSON.toJson(version));
|
FileUtils.writeText(json, Constants.GSON.toJson(version));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logging.LOG.log(Level.WARNING, "Ignoring version " + id + " because wrong id " + version.getId() + " is set and cannot correct it.");
|
Logging.LOG.log(Level.WARNING, "Ignoring version " + id + " because wrong id " + version.getId() + " is set and cannot correct it.");
|
||||||
continue;
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider.addVersion(version);
|
return Stream.of(version);
|
||||||
}
|
}).forEachOrdered(provider::addVersion);
|
||||||
|
|
||||||
for (Version version : provider.getVersionMap().values()) {
|
for (Version version : provider.getVersionMap().values()) {
|
||||||
try {
|
try {
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Collection;
|
|||||||
*/
|
*/
|
||||||
public final class ParallelTask extends Task {
|
public final class ParallelTask extends Task {
|
||||||
|
|
||||||
private final Task[] tasks;
|
private final Collection<Task> tasks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -36,6 +36,11 @@ public final class ParallelTask extends Task {
|
|||||||
* @param tasks the tasks that can be executed parallelly.
|
* @param tasks the tasks that can be executed parallelly.
|
||||||
*/
|
*/
|
||||||
public ParallelTask(Task... tasks) {
|
public ParallelTask(Task... tasks) {
|
||||||
|
this.tasks = Arrays.asList(tasks);
|
||||||
|
setSignificance(TaskSignificance.MINOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParallelTask(Collection<Task> tasks) {
|
||||||
this.tasks = tasks;
|
this.tasks = tasks;
|
||||||
setSignificance(TaskSignificance.MINOR);
|
setSignificance(TaskSignificance.MINOR);
|
||||||
}
|
}
|
||||||
@ -46,7 +51,7 @@ public final class ParallelTask extends Task {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Task> getDependents() {
|
public Collection<Task> getDependents() {
|
||||||
return Arrays.asList(tasks);
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
rootProject.name = 'HMCLKotlin'
|
rootProject.name = 'HMCL3'
|
||||||
include 'HMCL'
|
include 'HMCL'
|
||||||
include 'HMCLCore'
|
include 'HMCLCore'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user