mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
Move LauncherVersion and LauncherClassLoader
This commit is contained in:
parent
d14564f54e
commit
78766d0c5c
19 changed files with 88 additions and 94 deletions
|
@ -29,8 +29,8 @@
|
|||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.launcher.hasher.HashedDir;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
|
@ -196,9 +196,9 @@ private ExeConf(BlockConfigEntry block) {
|
|||
trademarks = block.hasEntry("trademarks") ? block.getEntryValue("trademarks", StringConfigEntry.class)
|
||||
: "This product is licensed under MIT License";
|
||||
txtFileVersion = block.hasEntry("txtFileVersion") ? block.getEntryValue("txtFileVersion", StringConfigEntry.class)
|
||||
: String.format("%s, build %d", LauncherVersion.getVersion().getVersionString(),LauncherVersion.getVersion().build);
|
||||
: String.format("%s, build %d", Launcher.getVersion().getVersionString(), Launcher.getVersion().build);
|
||||
txtProductVersion = block.hasEntry("txtProductVersion") ? block.getEntryValue("txtProductVersion", StringConfigEntry.class)
|
||||
: String.format("%s, build %d", LauncherVersion.getVersion().getVersionString(),LauncherVersion.getVersion().build);
|
||||
: String.format("%s, build %d", Launcher.getVersion().getVersionString(), Launcher.getVersion().build);
|
||||
}
|
||||
}
|
||||
private final class ProfilesFileVisitor extends SimpleFileVisitor<Path> {
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
|
@ -114,8 +113,8 @@ private void setConfig() {
|
|||
// Return prepared config
|
||||
ConfigPersister.getInstance().setAntConfig(config, null);
|
||||
}
|
||||
private static String VERSION = LauncherVersion.getVersion().getVersionString();
|
||||
private static int BUILD = LauncherVersion.getVersion().build;
|
||||
private static String VERSION = Launcher.getVersion().getVersionString();
|
||||
private static int BUILD = Launcher.getVersion().build;
|
||||
public static String formatVars(String mask)
|
||||
{
|
||||
return String.format(mask, VERSION, BUILD);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ru.gravit.launchserver.command.basic;
|
||||
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.command.Command;
|
||||
|
@ -22,6 +22,6 @@ public String getUsageDescription() {
|
|||
|
||||
@Override
|
||||
public void invoke(String... args) {
|
||||
LogHelper.subInfo("LaunchServer version: %d.%d.%d (build #%d)", LauncherVersion.MAJOR, LauncherVersion.MINOR, LauncherVersion.PATCH, LauncherVersion.BUILD);
|
||||
LogHelper.subInfo("LaunchServer version: %d.%d.%d (build #%d)", Launcher.MAJOR, Launcher.MINOR, Launcher.PATCH, Launcher.BUILD);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ru.gravit.launcher.LauncherClassLoader;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.launcher.modules.SimpleModuleManager;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.modules.CoreModule;
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class ModulesManager extends SimpleModuleManager {
|
||||
public ModulesManager(LaunchServer lsrv) {
|
||||
modules = new ArrayList<>(1);
|
||||
classloader = new LauncherClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
|
||||
classloader = new PublicURLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
|
||||
context = new LaunchServerModuleContext(lsrv, classloader);
|
||||
}
|
||||
private void registerCoreModule() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ru.gravit.launchserver.modules;
|
||||
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.utils.Version;
|
||||
import ru.gravit.launcher.modules.Module;
|
||||
import ru.gravit.launcher.modules.ModuleContext;
|
||||
|
||||
|
@ -16,8 +17,8 @@ public String getName() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LauncherVersion getVersion() {
|
||||
return LauncherVersion.getVersion();
|
||||
public Version getVersion() {
|
||||
return Launcher.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package ru.gravit.launchserver.modules;
|
||||
|
||||
import ru.gravit.launcher.LauncherClassLoader;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.launcher.modules.ModuleContext;
|
||||
import ru.gravit.launcher.modules.ModulesManagerInterface;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
|
||||
public class LaunchServerModuleContext implements ModuleContext {
|
||||
public final LaunchServer launchServer;
|
||||
public final LauncherClassLoader classloader;
|
||||
public LaunchServerModuleContext(LaunchServer server, LauncherClassLoader classloader)
|
||||
public final PublicURLClassLoader classloader;
|
||||
public LaunchServerModuleContext(LaunchServer server, PublicURLClassLoader classloader)
|
||||
{
|
||||
launchServer = server;
|
||||
this.classloader = classloader;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ru.gravit.launchserver.modules;
|
||||
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.utils.Version;
|
||||
import ru.gravit.launcher.modules.Module;
|
||||
import ru.gravit.launcher.modules.ModuleContext;
|
||||
|
||||
|
@ -16,8 +16,8 @@ public String getName() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LauncherVersion getVersion() {
|
||||
return new LauncherVersion(1,0,0,0, LauncherVersion.Type.UNKNOWN);
|
||||
public Version getVersion() {
|
||||
return new Version(1,0,0,0, Version.Type.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
import ru.gravit.launcher.hasher.DirWatcher;
|
||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||
import ru.gravit.launcher.hasher.HashedDir;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.EnvHelper;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
|
@ -161,7 +162,7 @@ public void write(HOutput output) throws IOException {
|
|||
// Constants
|
||||
private static final Path NATIVES_DIR = IOHelper.toPath("natives");
|
||||
private static final Path RESOURCEPACKS_DIR = IOHelper.toPath("resourcepacks");
|
||||
private static LauncherClassLoader classLoader;
|
||||
private static PublicURLClassLoader classLoader;
|
||||
// Authlib constants
|
||||
@LauncherAPI
|
||||
public static final String SKIN_URL_PROPERTY = "skinURL";
|
||||
|
@ -222,7 +223,7 @@ private static void addClientArgs(Collection<String> args, ClientProfile profile
|
|||
Collections.addAll(args, "--assetsDir", params.assetDir.toString());
|
||||
Collections.addAll(args, "--resourcePackDir", params.clientDir.resolve(RESOURCEPACKS_DIR).toString());
|
||||
if (version.compareTo(ClientProfile.Version.MC194) >= 0)
|
||||
Collections.addAll(args, "--versionType", "Launcher v" + LauncherVersion.getVersion().getVersionString());
|
||||
Collections.addAll(args, "--versionType", "Launcher v" + Launcher.getVersion().getVersionString());
|
||||
|
||||
// Add server args
|
||||
if (params.autoEnter) {
|
||||
|
@ -451,9 +452,9 @@ public static void main(String... args) throws Throwable {
|
|||
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
|
||||
}
|
||||
URL[] classpathurls = resolveClassPath(params.clientDir, profile.object.getClassPath());
|
||||
classLoader = new LauncherClassLoader(classpathurls, ClassLoader.getSystemClassLoader());
|
||||
classLoader = new PublicURLClassLoader(classpathurls, ClassLoader.getSystemClassLoader());
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
LauncherClassLoader.systemclassloader = classLoader;
|
||||
PublicURLClassLoader.systemclassloader = classLoader;
|
||||
// Start client with WatchService monitoring
|
||||
boolean digest = !profile.object.isUpdateFastCheck();
|
||||
LogHelper.debug("Starting JVM and client WatchService");
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ru.gravit.launcher.LauncherClassLoader;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.launcher.modules.SimpleModuleManager;
|
||||
|
||||
public class ModulesManager extends SimpleModuleManager {
|
||||
public ModulesManager(ServerWrapper wrapper) {
|
||||
modules = new ArrayList<>();
|
||||
classloader = new LauncherClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
|
||||
classloader = new PublicURLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
|
||||
context = new ServerModuleContext(wrapper, classloader);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package ru.gravit.launcher.server;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherClassLoader;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.launcher.modules.ModuleContext;
|
||||
import ru.gravit.launcher.modules.ModulesManagerInterface;
|
||||
|
||||
public class ServerModuleContext implements ModuleContext {
|
||||
public final LauncherClassLoader classLoader;
|
||||
public final PublicURLClassLoader classLoader;
|
||||
public final ServerWrapper wrapper;
|
||||
|
||||
public ServerModuleContext(ServerWrapper wrapper, LauncherClassLoader classLoader) {
|
||||
public ServerModuleContext(ServerWrapper wrapper, PublicURLClassLoader classLoader) {
|
||||
this.classLoader = classLoader;
|
||||
this.wrapper = wrapper;
|
||||
}
|
||||
|
|
|
@ -9,23 +9,22 @@
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.gravit.utils.Version;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
import ru.gravit.launcher.modules.ModulesManagerInterface;
|
||||
import ru.gravit.launcher.serialize.HInput;
|
||||
|
||||
public final class Launcher {
|
||||
|
||||
static int readBuildNumber() {
|
||||
try {
|
||||
return Integer.valueOf(IOHelper.request(IOHelper.getResourceURL("buildnumber")));
|
||||
} catch (IOException ignored) {
|
||||
return 0; // Maybe dev env?
|
||||
}
|
||||
}
|
||||
private static final AtomicReference<LauncherConfig> CONFIG = new AtomicReference<>();
|
||||
// Version info
|
||||
//Все версии оригинального Sashok Launcher v3 считаются как 3.xx.xx, например 3.15.3 3.15.4
|
||||
//Все версии модификации считаются так: 3.16.xx Например 3.16.5 для коммита от 20 Августа
|
||||
@Deprecated
|
||||
@LauncherAPI
|
||||
public static final String VERSION = LauncherVersion.getVersion().getVersionString();
|
||||
@Deprecated
|
||||
@LauncherAPI
|
||||
public static final String BUILD = String.valueOf(LauncherVersion.readBuildNumber());
|
||||
//Начиная с 4.0.0 PROTOCOL_MAGIC изменит свою форму
|
||||
@LauncherAPI
|
||||
public static ModulesManagerInterface modulesManager = null;
|
||||
@LauncherAPI
|
||||
|
@ -44,6 +43,11 @@ public final class Launcher {
|
|||
public static final String API_SCRIPT_FILE = "engine/api.js";
|
||||
|
||||
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);
|
||||
public static int MAJOR = 4;
|
||||
public static int MINOR = 0;
|
||||
public static int PATCH = 0;
|
||||
public static int BUILD = readBuildNumber();
|
||||
public static Version.Type RELEASE = Version.Type.DEV;
|
||||
|
||||
@LauncherAPI
|
||||
public static LauncherConfig getConfig() {
|
||||
|
@ -75,15 +79,12 @@ public static URL getResourceURL(String name) throws IOException {
|
|||
return url;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
@SuppressWarnings({"SameReturnValue", "MethodReturnAlwaysConstant"})
|
||||
public static String getVersion() {
|
||||
return LauncherVersion.getVersion().toString(); // Because Java constants are known at compile-time
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public static String toHash(UUID uuid) {
|
||||
return UUID_PATTERN.matcher(uuid.toString()).replaceAll("");
|
||||
}
|
||||
|
||||
public static Version getVersion() {
|
||||
return new Version(MAJOR,MINOR,PATCH,BUILD,RELEASE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package ru.gravit.launcher.modules;
|
||||
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.utils.Version;
|
||||
|
||||
public interface Module extends AutoCloseable {
|
||||
|
||||
String getName();
|
||||
|
||||
LauncherVersion getVersion();
|
||||
Version getVersion();
|
||||
|
||||
int getPriority();
|
||||
void init(ModuleContext context);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.gravit.launcher.modules;
|
||||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherClassLoader;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
|||
}
|
||||
}
|
||||
public ArrayList<Module> modules;
|
||||
public LauncherClassLoader classloader;
|
||||
public PublicURLClassLoader classloader;
|
||||
protected ModuleContext context;
|
||||
|
||||
@LauncherAPI
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package ru.gravit.launcher.modules;
|
||||
|
||||
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.utils.Version;
|
||||
|
||||
public class TestClientModule implements Module {
|
||||
@Override
|
||||
|
@ -15,8 +16,8 @@ public String getName() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LauncherVersion getVersion() {
|
||||
return LauncherVersion.getVersion();
|
||||
public Version getVersion() {
|
||||
return Launcher.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
import javassist.CtConstructor;
|
||||
import javassist.CtMethod;
|
||||
import javassist.LoaderClassPath;
|
||||
import ru.gravit.launcher.LauncherClassLoader;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
|
||||
public class SystemClassLoaderTransformer implements ClassFileTransformer {
|
||||
@Override
|
||||
|
@ -24,11 +24,11 @@ public byte[] transform(ClassLoader classLoader, String classname, Class<?> aCla
|
|||
if(classname.startsWith("jdk/")) return bytes;
|
||||
try {
|
||||
ClassPool pool = ClassPool.getDefault();
|
||||
pool.appendClassPath(new LoaderClassPath(LauncherClassLoader.systemclassloader));
|
||||
pool.appendClassPath(new LoaderClassPath(PublicURLClassLoader.systemclassloader));
|
||||
pool.appendClassPath(new LoaderClassPath(classLoader));
|
||||
CtClass s1 = pool.get("java.lang.ClassLoader");
|
||||
CtMethod m11 = s1.getDeclaredMethod("getSystemClassLoader"); // Находим метод, который нам нужно заменить
|
||||
CtClass s2 = pool.get(LauncherClassLoader.class.getName());
|
||||
CtClass s2 = pool.get(PublicURLClassLoader.class.getName());
|
||||
CtMethod m21 = s2.getDeclaredMethod("getSystemClassLoader"); // Находим метод, на который мы будем заменять
|
||||
CodeConverter cc = new CodeConverter();
|
||||
cc.redirectMethodCall(m11, m21); // Указываем что на что нам нужно заменить
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package ru.gravit.launcher;
|
||||
package ru.gravit.utils;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class LauncherClassLoader extends URLClassLoader {
|
||||
public class PublicURLClassLoader extends URLClassLoader {
|
||||
@LauncherAPI
|
||||
public static ClassLoader systemclassloader = ClassLoader.getSystemClassLoader();
|
||||
@LauncherAPI
|
||||
public static ClassLoader getSystemClassLoader()
|
||||
{
|
||||
LogHelper.debug("Used FAKECLASSLOADER!!!!!!!!!");
|
||||
return systemclassloader;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public static ClassLoader getSystemClassLoader()
|
|||
* @throws NullPointerException if {@code urls} is {@code null}.
|
||||
* @see SecurityManager#checkCreateClassLoader
|
||||
*/
|
||||
public LauncherClassLoader(URL[] urls) {
|
||||
public PublicURLClassLoader(URL[] urls) {
|
||||
super(urls);
|
||||
}
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ public LauncherClassLoader(URL[] urls) {
|
|||
* @throws NullPointerException if {@code urls} is {@code null}.
|
||||
* @see SecurityManager#checkCreateClassLoader
|
||||
*/
|
||||
public LauncherClassLoader(URL[] urls, ClassLoader parent) {
|
||||
public PublicURLClassLoader(URL[] urls, ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
}
|
||||
@Override
|
|
@ -1,51 +1,38 @@
|
|||
package ru.gravit.launcher;
|
||||
package ru.gravit.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
|
||||
public class LauncherVersion {
|
||||
public static int MAJOR = 4;
|
||||
public static int MINOR = 0;
|
||||
public static int PATCH = 0;
|
||||
public static int BUILD = readBuildNumber();
|
||||
public static Type RELEASE = Type.DEV;
|
||||
|
||||
public static LauncherVersion getVersion() {
|
||||
return new LauncherVersion(MAJOR,MINOR,PATCH,BUILD,RELEASE);
|
||||
}
|
||||
static int readBuildNumber() {
|
||||
try {
|
||||
return Integer.valueOf(IOHelper.request(IOHelper.getResourceURL("buildnumber")));
|
||||
} catch (IOException ignored) {
|
||||
return 0; // Maybe dev env?
|
||||
}
|
||||
}
|
||||
public class Version {
|
||||
@LauncherAPI
|
||||
public final int major;
|
||||
@LauncherAPI
|
||||
public final int minor;
|
||||
|
||||
@LauncherAPI
|
||||
public final int patch;
|
||||
|
||||
@LauncherAPI
|
||||
public final int build;
|
||||
@LauncherAPI
|
||||
public final Type release;
|
||||
|
||||
public LauncherVersion(int major, int minor, int patch) {
|
||||
@LauncherAPI
|
||||
public Version(int major, int minor, int patch) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
build = 0;
|
||||
release = Type.UNKNOWN;
|
||||
}
|
||||
|
||||
public LauncherVersion(int major, int minor, int patch,int build) {
|
||||
@LauncherAPI
|
||||
public Version(int major, int minor, int patch, int build) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
this.build = build;
|
||||
release = Type.UNKNOWN;
|
||||
}
|
||||
public LauncherVersion(int major, int minor, int patch,int build,Type release) {
|
||||
@LauncherAPI
|
||||
public Version(int major, int minor, int patch, int build, Type release) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
|
@ -54,24 +41,27 @@ public LauncherVersion(int major, int minor, int patch,int build,Type release) {
|
|||
}
|
||||
|
||||
@Override
|
||||
@LauncherAPI
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
LauncherVersion that = (LauncherVersion) o;
|
||||
Version that = (Version) o;
|
||||
return major == that.major &&
|
||||
minor == that.minor &&
|
||||
patch == that.patch &&
|
||||
build == that.build;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public String getVersionString() {
|
||||
return String.format("%d.%d.%d", major, minor, patch);
|
||||
}
|
||||
|
||||
@Override
|
||||
@LauncherAPI
|
||||
public int hashCode() {
|
||||
return Objects.hash(major, minor, patch, build);
|
||||
}
|
||||
@LauncherAPI
|
||||
public String getReleaseStatus()
|
||||
{
|
||||
String result;
|
||||
|
@ -104,9 +94,11 @@ public String getReleaseStatus()
|
|||
return result;
|
||||
}
|
||||
@Override
|
||||
@LauncherAPI
|
||||
public String toString() {
|
||||
return String.format("%d.%d.%d-%d %s", major, minor, patch, build,getReleaseStatus());
|
||||
}
|
||||
@LauncherAPI
|
||||
public enum Type
|
||||
{
|
||||
LTS,
|
|
@ -9,7 +9,6 @@
|
|||
import javax.script.ScriptEngineManager;
|
||||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
|
||||
public final class CommonHelper {
|
||||
@LauncherAPI
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
import org.fusesource.jansi.AnsiConsole;
|
||||
import org.fusesource.jansi.AnsiOutputStream;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherVersion;
|
||||
|
||||
public final class LogHelper {
|
||||
@LauncherAPI
|
||||
|
@ -234,8 +234,8 @@ private static String ansiFormatVersion(String product) {
|
|||
return new Ansi().bold(). // Setup
|
||||
fgBright(Color.MAGENTA).a("sashok724's "). // sashok724's
|
||||
fgBright(Color.CYAN).a(product). // Product
|
||||
fgBright(Color.WHITE).a(" v").fgBright(Color.BLUE).a(LauncherVersion.getVersion().toString()). // Version
|
||||
fgBright(Color.WHITE).a(" (build #").fgBright(Color.RED).a(LauncherVersion.getVersion().build).fgBright(Color.WHITE).a(')'). // Build#
|
||||
fgBright(Color.WHITE).a(" v").fgBright(Color.BLUE).a(Launcher.getVersion().toString()). // Version
|
||||
fgBright(Color.WHITE).a(" (build #").fgBright(Color.RED).a(Launcher.getVersion().build).fgBright(Color.WHITE).a(')'). // Build#
|
||||
reset().toString(); // To string
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ private static String formatLog(Level level, String message, String dateTime, bo
|
|||
}
|
||||
|
||||
private static String formatVersion(String product) {
|
||||
return String.format("sashok724's %s v%s", product, LauncherVersion.getVersion().toString());
|
||||
return String.format("sashok724's %s v%s", product, Launcher.getVersion().toString());
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
Loading…
Reference in a new issue