Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Fabric Installer to 0.11.2 #3

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ plugins {
}

sourceCompatibility = 1.8
version = '0.11.1'
archivesBaseName = "fabric-installer"
version = '0.11.2'
archivesBaseName = "legacy-fabric-installer"

def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
Expand All @@ -20,12 +20,12 @@ repositories {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
mavenCentral()
}

def nativeLibVersion = "0.1.3"
def nativeLibDistributions = [
"windows-ARM64", "windows-Win32", "windows-x64", "macos-x86_64_arm64"
"windows-ARM64", "windows-Win32", "windows-x64", "macos-x86_64_arm64"
]

dependencies {
Expand Down Expand Up @@ -55,8 +55,8 @@ checkstyle {
shadowJar {
manifest {
attributes 'Implementation-Title': 'LegacyFabricInstaller',
'Implementation-Version': project.version,
'Main-Class': 'net.fabricmc.installer.Main'
'Implementation-Version': project.version,
'Main-Class': 'net.fabricmc.installer.Main'
}

minimize()
Expand All @@ -67,8 +67,8 @@ shadowJar {
task serverJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
manifest {
attributes 'Implementation-Title': 'LegacyFabricInstaller',
'Implementation-Version': project.version,
'Main-Class': 'net.fabricmc.installer.ServerLauncher'
'Implementation-Version': project.version,
'Main-Class': 'net.fabricmc.installer.ServerLauncher'
}

minimize()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
group = net.legacyfabric
group = net.legacyfabric
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pluginManagement {
}
}

rootProject.name = 'fabric-installer'
rootProject.name = 'legacy-fabric-installer'

2 changes: 1 addition & 1 deletion src/main/java/net/fabricmc/installer/Handler.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected String buildEditorPaneStyle() {
return String.format(Locale.ENGLISH,
"font-family:%s;font-weight:%s;font-size:%dpt;background-color: rgb(%d,%d,%d);",
font.getFamily(), (font.isBold() ? "bold" : "normal"), font.getSize(), color.getRed(), color.getGreen(), color.getBlue()
);
);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/fabricmc/installer/InstallerGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package net.fabricmc.installer;

import java.awt.Toolkit;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/fabricmc/installer/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(String[] args) throws IOException {
System.setProperty("javax.net.ssl.trustStoreType", "WINDOWS-ROOT");
}

System.out.println("Loading LegacyFabric Installer: " + Main.class.getPackage().getImplementationVersion());
System.out.println("Loading Legacy Fabric Installer: " + Main.class.getPackage().getImplementationVersion());

HANDLERS.add(new ClientHandler());
HANDLERS.add(new ServerHandler());
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/net/fabricmc/installer/ServerLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void main(String[] args) throws Throwable {
try {
launchData = initialise();
} catch (IOException e) {
throw new RuntimeException("Failed to setup fabric server", e);
throw new RuntimeException("Failed to setup legacy fabric server", e);
}

Objects.requireNonNull(launchData, "launchData is null, cannot proceed");
Expand Down Expand Up @@ -91,11 +91,18 @@ private static LaunchData initialise() throws IOException {
Path dataDir = baseDir.resolve(DATA_DIR);

// Vanilla server jar
Path serverJar = dataDir.resolve(String.format("%s-server.jar", gameVersion));
String customServerJar = System.getProperty("fabric.installer.server.gameJar", null);
Path serverJar = customServerJar == null ? dataDir.resolve(String.format("%s-server.jar", gameVersion)) : Paths.get(customServerJar);
// Includes the mc version as this jar contains intermediary
Path serverLaunchJar = dataDir.resolve(String.format("fabric-loader-server-%s-minecraft-%s.jar", loaderVersion.name, gameVersion));

if (Files.exists(serverJar) && Files.exists(serverLaunchJar)) { // install exists, verify libs exist and determine main class
if (!Files.exists(serverJar)) {
InstallerProgress.CONSOLE.updateProgress(Utils.BUNDLE.getString("progress.download.minecraft"));
MinecraftServerDownloader downloader = new MinecraftServerDownloader(gameVersion);
downloader.downloadMinecraftServer(serverJar);
}

if (Files.exists(serverLaunchJar)) { // install exists, verify libs exist and determine main class
try {
List<Path> classPath = new ArrayList<>();
String mainClass = readManifest(serverLaunchJar, classPath);
Expand Down Expand Up @@ -123,10 +130,6 @@ private static LaunchData initialise() throws IOException {
Files.createDirectories(dataDir);
ServerInstaller.install(baseDir, loaderVersion, gameVersion, InstallerProgress.CONSOLE, serverLaunchJar);

InstallerProgress.CONSOLE.updateProgress(Utils.BUNDLE.getString("progress.download.minecraft"));
MinecraftServerDownloader downloader = new MinecraftServerDownloader(gameVersion);
downloader.downloadMinecraftServer(serverJar);

String mainClass = readManifest(serverLaunchJar, null);

return new LaunchData(serverJar, serverLaunchJar, mainClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void doInstall() {
}

private void showInstalledMessage(String loaderVersion, String gameVersion) {
JEditorPane pane = new JEditorPane("text/html", "<html><body style=\"" + buildEditorPaneStyle() + "\">" + new MessageFormat(Utils.BUNDLE.getString("prompt.install.successful")).format(new Object[]{loaderVersion, gameVersion, Reference.FABRIC_API_URL}) + "</body></html>");
JEditorPane pane = new JEditorPane("text/html", "<html><body style=\"" + buildEditorPaneStyle() + "\">" + new MessageFormat(Utils.BUNDLE.getString("prompt.install.successful")).format(new Object[]{loaderVersion, gameVersion, Reference.LEGACY_FABRIC_API_URL}) + "</body></html>");
pane.setEditable(false);

pane.addHyperlinkListener(e -> {
Expand Down Expand Up @@ -148,7 +148,7 @@ private ProfileInstaller.LauncherType showLauncherTypeSelection() {
null,
options,
options[0]
);
);

if (result == JOptionPane.CLOSED_OPTION) {
return null;
Expand Down
31 changes: 0 additions & 31 deletions src/main/java/net/fabricmc/installer/server/ServerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,20 @@

package net.fabricmc.installer.server;

import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.GridBagConstraints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.MessageFormat;

import javax.swing.JLabel;
import javax.swing.JPanel;

import net.fabricmc.installer.Handler;
import net.fabricmc.installer.InstallerGui;
import net.fabricmc.installer.LoaderVersion;
import net.fabricmc.installer.util.ArgumentParser;
import net.fabricmc.installer.util.InstallerProgress;
import net.fabricmc.installer.util.Reference;
import net.fabricmc.installer.util.Utils;

public class ServerHandler extends Handler {
Expand Down Expand Up @@ -93,28 +84,6 @@ public String cliHelp() {
return "-dir <install dir, default current dir> -mcversion <minecraft version, default latest> -loader <loader version, default latest> -downloadMinecraft";
}

@Override
public void setupPane1(JPanel pane, GridBagConstraints c, InstallerGui installerGui) {
if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
return;
}

JLabel label = new JLabel(String.format("<html><a href=\"\">%s</a></html>", Utils.BUNDLE.getString("prompt.server.launcher")));
label.setCursor(new Cursor(Cursor.HAND_CURSOR));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
Desktop.getDesktop().browse(new URI(Reference.SERVER_LAUNCHER_URL));
} catch (IOException | URISyntaxException ex) {
ex.printStackTrace();
}
}
});

addRow(pane, c, null, label);
}

@Override
public void setupPane2(JPanel pane, GridBagConstraints c, InstallerGui installerGui) {
installLocation.setText(Paths.get(".").toAbsolutePath().normalize().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import net.fabricmc.installer.util.FabricService;
import net.fabricmc.installer.util.InstallerProgress;
import net.fabricmc.installer.util.Library;
import net.fabricmc.installer.util.Reference;
import net.fabricmc.installer.util.Utils;

public class ServerInstaller {
Expand Down Expand Up @@ -88,8 +89,8 @@ public static void install(Path dir, LoaderVersion loaderVersion, String gameVer

mainClassMeta = json.at("mainClass").asString();
} else { // loader jar available, generate library list from it
libraries.add(new Library(String.format("net.fabricmc:fabric-loader:%s", loaderVersion.name), "https://maven.fabricmc.net/", loaderVersion.path));
libraries.add(new Library(String.format("net.fabricmc:intermediary:%s", gameVersion), "https://maven.legacyfabric.net/", null));
libraries.add(new Library(String.format("net.fabricmc:fabric-loader:%s", loaderVersion.name), Reference.FABRIC_MAVEN, loaderVersion.path));
libraries.add(new Library(String.format("net.fabricmc:intermediary:%s", gameVersion), Reference.LEGACY_FABRIC_MAVEN, null));

try (ZipFile zf = new ZipFile(loaderVersion.path.toFile())) {
ZipEntry entry = zf.getEntry("fabric-installer.json");
Expand Down Expand Up @@ -139,7 +140,7 @@ public static void install(Path dir, LoaderVersion loaderVersion, String gameVer
}

private static void makeLaunchJar(Path file, String launchMainClass, String jarMainClass, List<Path> libraryFiles,
boolean shadeLibraries, InstallerProgress progress) throws IOException {
boolean shadeLibraries, InstallerProgress progress) throws IOException {
Files.deleteIfExists(file);

try (ZipOutputStream zipOutputStream = new ZipOutputStream(Files.newOutputStream(file))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static LauncherMeta getLauncherMeta() throws IOException {
private static LauncherMeta load() throws IOException {
List<Version> versions = new ArrayList<>();
versions.addAll(getVersionsFromUrl(Reference.MINECRAFT_LAUNCHER_MANIFEST));
versions.addAll(getVersionsFromUrl(Reference.OLD_SNAPSHOTS));
versions.addAll(getVersionsFromUrl(Reference.OLD_SNAPSHOTS_MANIFEST));

return new LauncherMeta(versions);
}
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/net/fabricmc/installer/util/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@

public class Reference {
public static final String LOADER_NAME = "fabric-loader";

public static final String FABRIC_API_URL = "https://github.com/Legacy-Fabric/fabric/releases/";
public static final String SERVER_LAUNCHER_URL = "https://fabricmc.net/use/server/";
public static final String LEGACY_FABRIC_API_URL = "https://github.com/Legacy-Fabric/fabric/releases/";
public static final String MINECRAFT_LAUNCHER_MANIFEST = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json";
public static final String OLD_SNAPSHOTS = "https://raw.githubusercontent.com/Legacy-Fabric/manifests/master/manifest.json";

static final String DEFAULT_META_SERVER = "https://meta.legacyfabric.net/";
static final String DEFAULT_MAVEN_SERVER = "https://maven.legacyfabric.net/";
public static final String OLD_SNAPSHOTS_MANIFEST = "https://raw.githubusercontent.com/Legacy-Fabric/manifests/master/manifest.json";
public static final String LEGACY_FABRIC_META = "https://meta.legacyfabric.net/";
public static final String FABRIC_MAVEN = "https://maven.fabricmc.net/";
public static final String LEGACY_FABRIC_MAVEN = "https://maven.legacyfabric.net/";

static final FabricService[] FABRIC_SERVICES = {
new FabricService(DEFAULT_META_SERVER, DEFAULT_MAVEN_SERVER)//,
new FabricService(LEGACY_FABRIC_META, LEGACY_FABRIC_MAVEN)//,
// Do not use these fallback servers to interact with our web services. They can and will be unavailable at times and only support limited throughput.
// new FabricService("https://meta2.fabricmc.net/", "https://maven2.fabricmc.net/"),
// new FabricService("https://meta3.fabricmc.net/", "https://maven3.fabricmc.net/")
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/lang/installer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ prompt.server.jar.invalid=No valid {0} server jar found
prompt.server.downloading=Downloading {0}/{1} MB
prompt.server.generate=Generate
prompt.server.overwrite=Are you sure you want to override the existing launch scripts?
prompt.server.launcher=Click here to use the standalone server launcher for an easier setup
prompt.install.successful.title=Successfully Installed
prompt.install.successful=Fabric Loader {0} for {1} has been successfully installed.<br>Many mods also require you to put <a href="{2}">Fabric API</a> into the mods folder.
prompt.install.successful=Fabric Loader {0} for {1} has been successfully installed.<br>Many mods also require you to put <a href="{2}">Legacy Fabric API</a> into the mods folder.
tab.client=Client
tab.server=Server
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_ar_AR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ prompt.server.jar.invalid={0} لم يتم العثور على ملف الخاد
prompt.server.generate=إنشاء
prompt.server.overwrite=هل أنت متأكد من أنك تريد تجاهل سكريبت التشغيل الحالية؟
prompt.install.successful.title=تم التثبيث بنجاح
prompt.install.successful=محمل فابريك {0} ل {1} تم تثبيثه بنجاح<br>الكثير من المودات تجبر وضع <a href="{2}">Fabric API</a> في مجلد المودات.
prompt.install.successful=محمل فابريك {0} ل {1} تم تثبيثه بنجاح<br>الكثير من المودات تجبر وضع <a href="{2}">Legacy Fabric API</a> في مجلد المودات.
tab.client=العميل
tab.server=الخادم
4 changes: 2 additions & 2 deletions src/main/resources/lang/installer_ar_Ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ prompt.launcher.open.body=ماينكرافت لونشر يستعمل حاليا
prompt.launcher.open.tile=ماينكرافت لونشر يستعمل حاليا
prompt.game.version=:نسخة اللعبة
prompt.ready.install=جاهز للتثبيث
prompt.select.location=حدد مكان التثبيث
prompt.select.location=:حدد مكان التثبيث
prompt.server.info.jar=الملف الرسمي للخادم الرسمي إجباري
prompt.server.info.command=إستعمل هذه التعليمة لتشغيل الخادم
prompt.server.info.scipt=أو انتج سكريبت التشغيل
Expand All @@ -33,6 +33,6 @@ prompt.server.jar.invalid={0} لم يتم العثور على ملف الخاد
prompt.server.generate=إنشاء
prompt.server.overwrite=هل أنت متأكد من أنك تريد تجاهل سكريبت التشغيل الحالية؟
prompt.install.successful.title=تم التثبيث بنجاح
prompt.install.successful=محمل فابريك {0} ل {1} تم تثبيثه بنجاح<br>الكثير من المودات تجبر وضع <a href="{2}">Fabric API</a> في مجلد المودات.
prompt.install.successful=محمل فابريك {0} ل {1} تم تثبيثه بنجاح<br>الكثير من المودات تجبر وضع <a href="{2}">Legacy Fabric API</a> في مجلد المودات.
tab.client=العميل
tab.server=الخادم
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_es_ES.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ prompt.server.jar.invalid=No se encontró un JAR del servidor de la {0} válido
prompt.server.generate=Generar
prompt.server.overwrite=¿Estás seguro que quieres sobreescribir los scripts de lanzamiento existentes?
prompt.install.successful.title=Instalado Correctamente
prompt.install.successful=Fabric Loader {0} para {1} ha sido instalado correctamente.<br>Muchos mods también necesitan que descargues <a href="{2}">Fabric API</a> en tu carpeta de mods.
prompt.install.successful=Fabric Loader {0} para {1} ha sido instalado correctamente.<br>Muchos mods también necesitan que descargues <a href="{2}">Legacy Fabric API</a> en tu carpeta de mods.
tab.client=Cliente
tab.server=Servidor
3 changes: 1 addition & 2 deletions src/main/resources/lang/installer_et_EE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ prompt.server.jar.invalid=Sobivat {0} serveri JARi ei leitud
prompt.server.downloading=Allalaadimine {0}/{1} MB
prompt.server.generate=Genereeri
prompt.server.overwrite=Kas soovid kindlasti olemasolevad käivitusskriptid üle kirjutada?
prompt.server.launcher=Klõpsa siia, et kasutada lihtsamaks seadistuseks eraldiseisvat serverikäivitajat
prompt.install.successful.title=Edukalt paigaldatud
prompt.install.successful=Fabric Loader {0} versioonile {1} on edukalt paigaldatud.<br>Mitmed modid eeldavad ka <a href="{2}">Fabric API</a> asetamist mods kausta.
prompt.install.successful=Fabric Loader {0} versioonile {1} on edukalt paigaldatud.<br>Mitmed modid eeldavad ka <a href="{2}">Legacy Fabric API</a> asetamist mods kausta.
tab.client=Klient
tab.server=Server
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_fi_FI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ prompt.server.downloading=Ladataan {0}/{1} Mt
prompt.server.generate=Generoi
prompt.server.overwrite=Haluatko varmasti korvata olemassaolevat käynnistinskriptit?
prompt.install.successful.title=Asennus onnistui
prompt.install.successful=Fabric Loader {0} versiolle {1} asennettiin onnistuneesti.<br>Monet modit vaativat myös <a href="{2}">Fabric API:n</a> lataamisen mods-kansioon.
prompt.install.successful=Fabric Loader {0} versiolle {1} asennettiin onnistuneesti.<br>Monet modit vaativat myös <a href="{2}">Legacy Fabric API:n</a> lataamisen mods-kansioon.
tab.client=Asiakasohjelma
tab.server=Palvelin
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_fr_FR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ prompt.server.jar.invalid=Aucun fichier jar serveur {0} valide trouvé
prompt.server.generate=Générer
prompt.server.overwrite=Voulez-vous vraiment remplacer les scripts de lancement existants?
prompt.install.successful.title=Installé avec succès
prompt.install.successful=Fabric Loader {0} pour la version {1} a été installé avec succès. <br> De nombreux mods vous demanderons également de placer <a href="{2}">Fabric API</a> dans le dossier mods.
prompt.install.successful=Fabric Loader {0} pour la version {1} a été installé avec succès. <br> De nombreux mods vous demanderons également de placer <a href="{2}">Legacy Fabric API</a> dans le dossier mods.
tab.client=Client
tab.server=Serveur
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_ja_JP.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ prompt.server.jar.invalid=無効な {0} サーバー JAR が見つかりまし
prompt.server.generate=生成
prompt.server.overwrite=既存の起動スクリプトを上書きしてもよろしいですか?
prompt.install.successful.title=正常にインストールされました
prompt.install.successful={1}用のFabric ローダー {0} が正常にインストールされました。<br>多くのmodを使用する場合には、<a href="{2}">Fabric API</a> をmodsフォルダーに入れる必要があります。
prompt.install.successful={1}用のFabric ローダー {0} が正常にインストールされました。<br>多くのmodを使用する場合には、<a href="{2}">Legacy Fabric API</a> をmodsフォルダーに入れる必要があります。
tab.client=クライアント
tab.server=サーバー
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_pl_PL.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ prompt.server.jar.invalid=Poprawny plik jar serwera {0} nie został znaleziony
prompt.server.generate=Generuj
prompt.server.overwrite=Czy na pewno chcesz nadpisać istniejące skrypty uruchamiające?
prompt.install.successful.title=Pomyślnie zainstalowano
prompt.install.successful=Loader Fabric {0} dla {1} został pomyślnie zainstalowany.<br>Wiele modów wymaga także umieszczenia <a href="{2}">Fabric API</a> w folderze modów.
prompt.install.successful=Loader Fabric {0} dla {1} został pomyślnie zainstalowany.<br>Wiele modów wymaga także umieszczenia <a href="{2}">Legacy Fabric API</a> w folderze modów.
tab.client=Klient
tab.server=Serwer
2 changes: 1 addition & 1 deletion src/main/resources/lang/installer_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ prompt.server.downloading=Baixando {0}/{1} MB
prompt.server.generate=Gerar
prompt.server.overwrite=Deseja mesmo sobrescrever os scripts de inicialização atuais?
prompt.install.successful.title=Instalação com êxito
prompt.install.successful=O Fabric Loader {0} para {1} foi instalado com êxito.<br>Muitos mods exigem o <a href="{2}">Fabric API</a> na pasta de mods.
prompt.install.successful=O Fabric Loader {0} para {1} foi instalado com êxito.<br>Muitos mods exigem o <a href="{2}">Legacy Fabric API</a> na pasta de mods.
tab.client=Cliente
tab.server=Servidor
Loading
Loading