mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Перевод конфигов на Json часть 9
Порция фиксов Теперь работает!
This commit is contained in:
parent
08d7f61a19
commit
c65124a21e
3 changed files with 65 additions and 9 deletions
|
@ -1,9 +1,14 @@
|
|||
package ru.gravit.launchserver.command.basic;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.command.Command;
|
||||
import ru.gravit.launchserver.socket.NettyServerSocketHandler;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
public class TestCommand extends Command {
|
||||
public TestCommand(LaunchServer server) {
|
||||
|
@ -29,6 +34,15 @@ public void invoke(String... args) throws Exception {
|
|||
handler = new NettyServerSocketHandler(server);
|
||||
if (args[0].equals("start")) {
|
||||
CommonHelper.newThread("Netty Server", true, handler).start();
|
||||
}
|
||||
if (args[0].equals("profile")) {
|
||||
ClientProfile profile = new ClientProfile("1.7.10","asset1.7.10",0,"Test1.7.10","localhost",25535,true,false,"net.minecraft.launchwrapper.Launch");
|
||||
try(Writer writer = IOHelper.newWriter(LaunchServer.server.dir.resolve("profiles").resolve("Test.cfg")))
|
||||
{
|
||||
Launcher.gson.toJson(profile,writer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (args[0].equals("stop")) {
|
||||
handler.close();
|
||||
|
|
|
@ -230,7 +230,7 @@ var digest = profile.isUpdateFastCheck();
|
|||
|
||||
// Update asset dir
|
||||
update.resetOverlay("Обновление файлов ресурсов");
|
||||
var assetDirName = profile.block.getEntryValue("assetDir", StringConfigEntryClass);
|
||||
var assetDirName = profile.getAssetDir();
|
||||
var assetDir = settings.updatesDir.resolve(assetDirName);
|
||||
var assetMatcher = profile.getAssetUpdateMatcher();
|
||||
makeSetProfileRequest(profile, function() {
|
||||
|
@ -240,7 +240,7 @@ var digest = profile.isUpdateFastCheck();
|
|||
|
||||
// Update client dir
|
||||
update.resetOverlay("Обновление файлов клиента");
|
||||
var clientDirName = profile.block.getEntryValue("dir", StringConfigEntryClass);
|
||||
var clientDirName = profile.getDir();
|
||||
var clientDir = settings.updatesDir.resolve(clientDirName);
|
||||
var clientMatcher = profile.getClientUpdateMatcher();
|
||||
makeUpdateRequest(clientDirName, clientDir, clientMatcher, digest, function(clientHDir) {
|
||||
|
|
|
@ -12,6 +12,21 @@
|
|||
|
||||
@SuppressWarnings("ComparableImplementedButEqualsNotOverridden")
|
||||
public final class ClientProfile implements Comparable<ClientProfile> {
|
||||
public ClientProfile(String version, String assetIndex, int sortIndex, String title, String serverAddress, int serverPort, boolean updateFastCheck, boolean useWhitelist, String mainClass) {
|
||||
this.version = version;
|
||||
this.assetIndex = assetIndex;
|
||||
this.sortIndex = sortIndex;
|
||||
this.title = title;
|
||||
this.serverAddress = serverAddress;
|
||||
this.serverPort = serverPort;
|
||||
this.updateFastCheck = updateFastCheck;
|
||||
this.useWhitelist = useWhitelist;
|
||||
this.mainClass = mainClass;
|
||||
}
|
||||
|
||||
public ClientProfile() {
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public enum Version {
|
||||
MC147("1.4.7", 51),
|
||||
|
@ -60,14 +75,23 @@ public String toString() {
|
|||
private static final FileNameMatcher ASSET_MATCHER = new FileNameMatcher(
|
||||
new String[0], new String[]{"indexes", "objects"}, new String[0]);
|
||||
// Version
|
||||
@LauncherAPI
|
||||
private String version;
|
||||
|
||||
@LauncherAPI
|
||||
private String assetIndex;
|
||||
// Client
|
||||
private int sortIndex;
|
||||
private String title;
|
||||
private String serverAddress;
|
||||
|
||||
@LauncherAPI
|
||||
private String dir;
|
||||
@LauncherAPI
|
||||
private String assetDir;
|
||||
// Client
|
||||
@LauncherAPI
|
||||
private int sortIndex;
|
||||
@LauncherAPI
|
||||
private String title;
|
||||
@LauncherAPI
|
||||
private String serverAddress;
|
||||
@LauncherAPI
|
||||
private int serverPort;
|
||||
|
||||
public static class MarkedString {
|
||||
|
@ -101,20 +125,30 @@ public int hashCode() {
|
|||
}
|
||||
|
||||
// Updater and client watch service
|
||||
@LauncherAPI
|
||||
private final List<String> update = new ArrayList<>();
|
||||
@LauncherAPI
|
||||
private final List<String> updateExclusions = new ArrayList<>();
|
||||
@LauncherAPI
|
||||
private final List<String> updateShared = new ArrayList<>();
|
||||
@LauncherAPI
|
||||
private final List<String> updateVerify = new ArrayList<>();
|
||||
@LauncherAPI
|
||||
private final Set<MarkedString> updateOptional = new HashSet<>();
|
||||
@LauncherAPI
|
||||
private boolean updateFastCheck;
|
||||
|
||||
@LauncherAPI
|
||||
private boolean useWhitelist;
|
||||
// Client launcher
|
||||
@LauncherAPI
|
||||
private String mainClass;
|
||||
@LauncherAPI
|
||||
private final List<String> jvmArgs = new ArrayList<>();
|
||||
@LauncherAPI
|
||||
private final List<String> classPath = new ArrayList<>();
|
||||
@LauncherAPI
|
||||
private final List<String> clientArgs = new ArrayList<>();
|
||||
|
||||
@LauncherAPI
|
||||
private final List<String> whitelist = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
|
@ -141,6 +175,14 @@ public String[] getClassPath() {
|
|||
public String[] getClientArgs() {
|
||||
return clientArgs.toArray(new String[0]);
|
||||
}
|
||||
@LauncherAPI
|
||||
public String getDir() {
|
||||
return dir;
|
||||
}
|
||||
@LauncherAPI
|
||||
public String getAssetDir() {
|
||||
return assetDir;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public FileNameMatcher getClientUpdateMatcher(/*boolean excludeOptional*/) {
|
||||
|
|
Loading…
Reference in a new issue