mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[ANY] Перемещение всего лишнего из libLauncher в LauncherAPI
This commit is contained in:
parent
cbc2506a13
commit
886524bb94
30 changed files with 31 additions and 30 deletions
|
@ -34,10 +34,11 @@
|
||||||
import ru.gravit.launchserver.manangers.hook.SocketHookManager;
|
import ru.gravit.launchserver.manangers.hook.SocketHookManager;
|
||||||
import ru.gravit.launchserver.socket.ServerSocketHandler;
|
import ru.gravit.launchserver.socket.ServerSocketHandler;
|
||||||
import ru.gravit.launchserver.websocket.NettyServerSocketHandler;
|
import ru.gravit.launchserver.websocket.NettyServerSocketHandler;
|
||||||
|
import ru.gravit.utils.Version;
|
||||||
import ru.gravit.utils.command.CommandHandler;
|
import ru.gravit.utils.command.CommandHandler;
|
||||||
import ru.gravit.utils.command.JLineCommandHandler;
|
import ru.gravit.utils.command.JLineCommandHandler;
|
||||||
import ru.gravit.utils.command.StdCommandHandler;
|
import ru.gravit.utils.command.StdCommandHandler;
|
||||||
import ru.gravit.utils.config.JsonConfigurable;
|
import ru.gravit.launcher.config.JsonConfigurable;
|
||||||
import ru.gravit.utils.helper.*;
|
import ru.gravit.utils.helper.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
@ -688,8 +689,8 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
|
||||||
newConfig.launch4j = new ExeConf();
|
newConfig.launch4j = new ExeConf();
|
||||||
newConfig.launch4j.enabled = true;
|
newConfig.launch4j.enabled = true;
|
||||||
newConfig.launch4j.copyright = "© GravitLauncher Team";
|
newConfig.launch4j.copyright = "© GravitLauncher Team";
|
||||||
newConfig.launch4j.fileDesc = "GravitLauncher ".concat(Launcher.getVersion().getVersionString());
|
newConfig.launch4j.fileDesc = "GravitLauncher ".concat(Version.getVersion().getVersionString());
|
||||||
newConfig.launch4j.fileVer = Launcher.getVersion().getVersionString().concat(".").concat(String.valueOf(Launcher.getVersion().patch));
|
newConfig.launch4j.fileVer = Version.getVersion().getVersionString().concat(".").concat(String.valueOf(Version.getVersion().patch));
|
||||||
newConfig.launch4j.internalName = "Launcher";
|
newConfig.launch4j.internalName = "Launcher";
|
||||||
newConfig.launch4j.trademarks = "This product is licensed under GPLv3";
|
newConfig.launch4j.trademarks = "This product is licensed under GPLv3";
|
||||||
newConfig.launch4j.txtFileVersion = "%s, build %d";
|
newConfig.launch4j.txtFileVersion = "%s, build %d";
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
import net.sf.launch4j.Builder;
|
import net.sf.launch4j.Builder;
|
||||||
import net.sf.launch4j.Log;
|
import net.sf.launch4j.Log;
|
||||||
import net.sf.launch4j.config.*;
|
import net.sf.launch4j.config.*;
|
||||||
import ru.gravit.launcher.Launcher;
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.utils.Version;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ private void setConfig() {
|
||||||
ConfigPersister.getInstance().setAntConfig(config, null);
|
ConfigPersister.getInstance().setAntConfig(config, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String VERSION = Launcher.getVersion().getVersionString();
|
private static String VERSION = Version.getVersion().getVersionString();
|
||||||
private static int BUILD = Launcher.getVersion().build;
|
private static int BUILD = Version.getVersion().build;
|
||||||
|
|
||||||
public static String formatVars(String mask) {
|
public static String formatVars(String mask) {
|
||||||
return String.format(mask, VERSION, BUILD);
|
return String.format(mask, VERSION, BUILD);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
import ru.gravit.utils.Version;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public final class VersionCommand extends Command {
|
public final class VersionCommand extends Command {
|
||||||
|
@ -22,6 +23,6 @@ public String getUsageDescription() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invoke(String... args) {
|
public void invoke(String... args) {
|
||||||
LogHelper.subInfo("LaunchServer version: %d.%d.%d (build #%d)", Launcher.MAJOR, Launcher.MINOR, Launcher.PATCH, Launcher.BUILD);
|
LogHelper.subInfo("LaunchServer version: %d.%d.%d (build #%d)", Version.MAJOR, Version.MINOR, Version.PATCH, Version.BUILD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ru.gravit.launchserver.modules;
|
package ru.gravit.launchserver.modules;
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
|
||||||
import ru.gravit.launcher.modules.Module;
|
import ru.gravit.launcher.modules.Module;
|
||||||
import ru.gravit.launcher.modules.ModuleContext;
|
import ru.gravit.launcher.modules.ModuleContext;
|
||||||
import ru.gravit.utils.Version;
|
import ru.gravit.utils.Version;
|
||||||
|
@ -18,7 +17,7 @@ public String getName() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Version getVersion() {
|
public Version getVersion() {
|
||||||
return Launcher.getVersion();
|
return Version.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||||
import ru.gravit.launcher.utils.DirWatcher;
|
import ru.gravit.launcher.utils.DirWatcher;
|
||||||
import ru.gravit.utils.PublicURLClassLoader;
|
import ru.gravit.utils.PublicURLClassLoader;
|
||||||
|
import ru.gravit.utils.Version;
|
||||||
import ru.gravit.utils.helper.*;
|
import ru.gravit.utils.helper.*;
|
||||||
import ru.gravit.utils.helper.JVMHelper.OS;
|
import ru.gravit.utils.helper.JVMHelper.OS;
|
||||||
|
|
||||||
|
@ -201,7 +202,7 @@ private static void addClientArgs(Collection<String> args, ClientProfile profile
|
||||||
Collections.addAll(args, "--assetsDir", params.assetDir.toString());
|
Collections.addAll(args, "--assetsDir", params.assetDir.toString());
|
||||||
Collections.addAll(args, "--resourcePackDir", params.clientDir.resolve(RESOURCEPACKS_DIR).toString());
|
Collections.addAll(args, "--resourcePackDir", params.clientDir.resolve(RESOURCEPACKS_DIR).toString());
|
||||||
if (version.compareTo(ClientProfile.Version.MC194) >= 0)
|
if (version.compareTo(ClientProfile.Version.MC194) >= 0)
|
||||||
Collections.addAll(args, "--versionType", "Launcher v" + Launcher.getVersion().getVersionString());
|
Collections.addAll(args, "--versionType", "Launcher v" + Version.getVersion().getVersionString());
|
||||||
|
|
||||||
// Add server args
|
// Add server args
|
||||||
if (params.autoEnter) {
|
if (params.autoEnter) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.utils.config.JsonConfigurable;
|
import ru.gravit.launcher.config.JsonConfigurable;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -57,11 +57,6 @@ public final class Launcher {
|
||||||
public static final String CONFIG_SCRIPT_FILE = "config.js";
|
public static final String CONFIG_SCRIPT_FILE = "config.js";
|
||||||
|
|
||||||
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);
|
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);
|
||||||
public static final int MAJOR = 5;
|
|
||||||
public static final int MINOR = 0;
|
|
||||||
public static final int PATCH = 0;
|
|
||||||
public static final int BUILD = 4;
|
|
||||||
public static final Version.Type RELEASE = Version.Type.BETA;
|
|
||||||
public static GsonManager gsonManager;
|
public static GsonManager gsonManager;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
@ -119,10 +114,6 @@ public static String toHash(UUID uuid) {
|
||||||
return UUID_PATTERN.matcher(uuid.toString()).replaceAll("");
|
return UUID_PATTERN.matcher(uuid.toString()).replaceAll("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Version getVersion() {
|
|
||||||
return new Version(MAJOR, MINOR, PATCH, BUILD, RELEASE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyLauncherEnv(LauncherConfig.LauncherEnvironment env) {
|
public static void applyLauncherEnv(LauncherConfig.LauncherEnvironment env) {
|
||||||
switch (env) {
|
switch (env) {
|
||||||
case DEV:
|
case DEV:
|
|
@ -1,4 +1,4 @@
|
||||||
package ru.gravit.utils.config;
|
package ru.gravit.launcher.config;
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
|
@ -1,6 +1,6 @@
|
||||||
package ru.gravit.launcher.managers;
|
package ru.gravit.launcher.managers;
|
||||||
|
|
||||||
import ru.gravit.utils.config.JsonConfigurable;
|
import ru.gravit.launcher.config.JsonConfigurable;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import ru.gravit.launcher.request.update.ProfilesRequest;
|
import ru.gravit.launcher.request.update.ProfilesRequest;
|
||||||
import ru.gravit.launcher.server.setup.ServerWrapperSetup;
|
import ru.gravit.launcher.server.setup.ServerWrapperSetup;
|
||||||
import ru.gravit.utils.PublicURLClassLoader;
|
import ru.gravit.utils.PublicURLClassLoader;
|
||||||
import ru.gravit.utils.config.JsonConfigurable;
|
import ru.gravit.launcher.config.JsonConfigurable;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.CommonHelper;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
|
@ -15,6 +15,11 @@ public final class Version {
|
||||||
public final int build;
|
public final int build;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final Type release;
|
public final Type release;
|
||||||
|
public static final int MAJOR = 5;
|
||||||
|
public static final int MINOR = 0;
|
||||||
|
public static final int PATCH = 0;
|
||||||
|
public static final int BUILD = 4;
|
||||||
|
public static final Version.Type RELEASE = Version.Type.BETA;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public Version(int major, int minor, int patch) {
|
public Version(int major, int minor, int patch) {
|
||||||
|
@ -43,6 +48,10 @@ public Version(int major, int minor, int patch, int build, Type release) {
|
||||||
this.release = release;
|
this.release = release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Version getVersion() {
|
||||||
|
return new Version(MAJOR, MINOR, PATCH, BUILD, RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package ru.gravit.utils.helper;
|
package ru.gravit.utils.helper;
|
||||||
|
|
||||||
import org.fusesource.jansi.Ansi;
|
import org.fusesource.jansi.Ansi;
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.utils.Version;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Nashorn при инициализации LogHelper пытается инициализировтаь все доступные в нем методы.
|
* Nashorn при инициализации LogHelper пытается инициализировтаь все доступные в нем методы.
|
||||||
|
@ -59,8 +59,8 @@ static String ansiFormatVersion(String product) {
|
||||||
fgBright(Ansi.Color.MAGENTA).a("GravitLauncher "). // sashok724's
|
fgBright(Ansi.Color.MAGENTA).a("GravitLauncher "). // sashok724's
|
||||||
fgBright(Ansi.Color.BLUE).a("(fork sashok724's Launcher) ").
|
fgBright(Ansi.Color.BLUE).a("(fork sashok724's Launcher) ").
|
||||||
fgBright(Ansi.Color.CYAN).a(product). // Product
|
fgBright(Ansi.Color.CYAN).a(product). // Product
|
||||||
fgBright(Ansi.Color.WHITE).a(" v").fgBright(Ansi.Color.BLUE).a(Launcher.getVersion().toString()). // Version
|
fgBright(Ansi.Color.WHITE).a(" v").fgBright(Ansi.Color.BLUE).a(Version.getVersion().toString()). // Version
|
||||||
fgBright(Ansi.Color.WHITE).a(" (build #").fgBright(Ansi.Color.RED).a(Launcher.getVersion().build).fgBright(Ansi.Color.WHITE).a(')'). // Build#
|
fgBright(Ansi.Color.WHITE).a(" (build #").fgBright(Ansi.Color.RED).a(Version.getVersion().build).fgBright(Ansi.Color.WHITE).a(')'). // Build#
|
||||||
reset().toString(); // To file
|
reset().toString(); // To file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public static String rawFormat(LogHelper.Level level, String dateTime, boolean s
|
||||||
}
|
}
|
||||||
|
|
||||||
static String formatVersion(String product) {
|
static String formatVersion(String product) {
|
||||||
return String.format("GravitLauncher (fork sashok724's Launcher) %s v%s", product, Launcher.getVersion().toString());
|
return String.format("GravitLauncher (fork sashok724's Launcher) %s v%s", product, Version.getVersion().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
static String formatLicense(String product) {
|
static String formatLicense(String product) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ru.gravit.utils.helper;
|
package ru.gravit.utils.helper;
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
@ -10,8 +9,8 @@
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.*;
|
|
||||||
import java.nio.file.FileSystem;
|
import java.nio.file.FileSystem;
|
||||||
|
import java.nio.file.*;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -229,7 +228,7 @@ public static byte[] getResourceBytes(String name) throws IOException {
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static URL getResourceURL(String name) throws NoSuchFileException {
|
public static URL getResourceURL(String name) throws NoSuchFileException {
|
||||||
URL url = Launcher.class.getResource('/' + name);
|
URL url = IOHelper.class.getResource('/' + name);
|
||||||
if (url == null)
|
if (url == null)
|
||||||
throw new NoSuchFileException(name);
|
throw new NoSuchFileException(name);
|
||||||
return url;
|
return url;
|
||||||
|
|
Loading…
Reference in a new issue