Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
3d4655c
Trying to change UI to look how it work
suerion Dec 16, 2024
7a18905
change language file for UI Buttons
suerion Dec 16, 2024
f3234ba
deutsch angepasst
suerion Dec 16, 2024
0fcc519
Update Modpack updater for new buttons
suerion Dec 20, 2024
74d2417
Update Modpack updater for new buttons
suerion Dec 20, 2024
40e3614
Update Modpack updater for new buttons
suerion Dec 20, 2024
e94bb74
update buttons on danger screen, hope look better now
suerion Dec 20, 2024
4003198
update buttons on danger screen, hope look better now
suerion Dec 21, 2024
08091bd
added new screen for Download selection, added english language, chan…
suerion Dec 21, 2024
2bed8d2
hopefull added new screen without linking
suerion Dec 21, 2024
a219ae5
added selectionManager file for selection screen, need toDo. changed …
suerion Dec 22, 2024
35bfb94
Merge pull request #1 from suerion/main
suerion Dec 22, 2024
30f5de5
fix build
Skidamek Dec 22, 2024
ba027f9
updated english and german language file, next is Selection manager a…
suerion Dec 23, 2024
4a64961
Merge branch 'Skidamek:main' into patch-1
suerion Feb 17, 2025
8c1eba1
Merge branch 'patch-1' into main-1
suerion Mar 15, 2025
dfe17f1
Merge pull request #2 from suerion/main-1
suerion Mar 15, 2025
db9e255
trying to update the restart button
suerion Mar 15, 2025
d47157e
Revert "trying to update the restart button"
suerion Mar 15, 2025
f858b09
Merge branch 'Skidamek:main' into main
suerion Mar 20, 2025
b4feb5c
Merge branch 'Skidamek:main' into patch-1
suerion Mar 20, 2025
086247e
Changed SelectionManger to get folders from server, added dynamical b…
suerion Mar 20, 2025
e959520
changed config tools, and jsons to exclude files with IP or BOT tokke…
suerion Mar 24, 2025
8e32276
Merge branch 'Skidamek:main' into main
suerion Mar 24, 2025
87dd783
Merge pull request #3 from suerion/main
suerion Mar 24, 2025
16819aa
create helper content build for full server and create on update excl…
suerion Mar 24, 2025
d3955e9
should fixed murmur check
suerion Mar 24, 2025
93eb022
fixed error on screen impl
suerion Mar 24, 2025
229ca1a
updated button to different versions
suerion Mar 24, 2025
53e857f
added full server pack button, and added an config line if server pac…
suerion Mar 25, 2025
aeff7a1
created FullServerPackContent.java and deleted all content file creat…
suerion Mar 26, 2025
8b7f055
changed deleted in ModpackContentTools the build from full server con…
suerion Mar 26, 2025
27d0091
add Fullserverpackcontent generation on modpack generation,
suerion Mar 26, 2025
1ae3eb0
correcting path to servermodpack config
suerion Mar 26, 2025
1eea4f7
add debbuging log
suerion Mar 26, 2025
f97e338
changed the FullServerPack creation in the new FullServerPack.java fi…
suerion Mar 28, 2025
14727d4
make it *work*
Skidamek Mar 29, 2025
a98e0bb
whoops
Skidamek Mar 29, 2025
ada6577
Revert "whoops"
suerion Mar 29, 2025
a998740
Revert "make it *work*"
suerion Mar 29, 2025
fcf375b
Revert config catch from Skidam, added some loggers to debug informat…
suerion Mar 29, 2025
bd1070f
something went wrong in the FullServerPack, without INIT, added Conte…
suerion Mar 29, 2025
1a15178
found in common.java the startserver init, updated the files to check…
suerion Mar 29, 2025
6fcdb16
Merge branch 'Skidamek:main' into main
suerion Mar 29, 2025
7e72460
Merge pull request #5 from suerion/main
suerion Mar 29, 2025
31819c6
updated path from fullserver-content.json file, and changed logger text
suerion Mar 29, 2025
48a406d
fixed path and added logger
suerion Mar 29, 2025
a444ea4
fixed path again
suerion Mar 29, 2025
94408c8
should fixed the path now
suerion Mar 30, 2025
7382b4a
added in the FullServerPack file the ModpackName, MC Version and Loader
suerion Mar 30, 2025
6a8da24
preapared modpack loader, selection manger for fullservermodpack, and…
suerion Mar 30, 2025
d760678
Merge branch 'Skidamek:main' into main
suerion May 4, 2025
dc924e2
Merge branch 'patch-1' into patchforpatch1
suerion May 4, 2025
64e702b
Merge pull request #6 from suerion/patchforpatch1
suerion May 4, 2025
56f1ec0
Merge branch 'Skidamek:main' into main
suerion May 12, 2025
3ac5b0a
Merge branch 'patch-1' into main
suerion May 12, 2025
48b6697
Merge pull request #7 from suerion/main
suerion May 12, 2025
e0c3e30
Merge branch 'Skidamek:main' into main
suerion May 15, 2025
0c2e722
Merge pull request #8 from suerion/main
suerion May 15, 2025
22a1cd2
update main from latest beta
suerion May 19, 2025
b03f2a3
Merge pull request #10 from suerion/Skidamek-main
suerion May 19, 2025
8fce8dd
Merge pull request #11 from suerion/main
suerion May 19, 2025
171a543
fix issues on update to bete36
suerion May 19, 2025
f439c6f
fix false config input
suerion May 19, 2025
603742f
fix false adresses from full modpack
suerion May 19, 2025
f669a83
fix typo error in preload
suerion May 19, 2025
8328a95
update gradle to 4.1.0-beta1, new feature selection screen should be …
suerion May 19, 2025
8381786
Refactor modpack handling to support group-based configurations with …
Skidamek Jul 25, 2025
71bfad2
groups in the protocol
Skidamek Jul 26, 2025
2942104
update to latest beta
suerion Jul 27, 2025
308fbed
Merge pull request #12 from Skidamek/main
suerion Jul 27, 2025
5cffc6d
Merge branch 'patch-1' into main
suerion Jul 27, 2025
d825df6
Merge pull request #13 from suerion/main
suerion Jul 27, 2025
3c6f77b
Merge pull request #16 from Skidamek/main
suerion Aug 20, 2025
83e51f7
Merge pull request #17 from suerion/main
suerion Aug 20, 2025
0bf1d0a
Merge branch 'patch-1' into groups
suerion Aug 20, 2025
f8a759a
Merge pull request #14 from suerion/groups
suerion Aug 20, 2025
b59d884
update to groups....
suerion Aug 21, 2025
577d7dc
added an versioned util, but builds on 1.19 and 1.18 are agein proble…
suerion Aug 21, 2025
2505ae5
fix problems with stonecutter, had not a lot issues anymore
suerion Aug 21, 2025
b588ec3
most version that has only litle issues
suerion Aug 21, 2025
ba83083
try to fix stonecutter versioning screen...
suerion Aug 28, 2025
3b7df81
try to fix stonecutter versioning screen... again, 1.21.6 will not wo…
suerion Aug 28, 2025
a56ef93
try to fix stonecutter versioning screen... again, 1.21.6 bruhhh, yet…
suerion Aug 28, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pl.skidam.automodpack_core.config.Jsons;
import pl.skidam.automodpack_core.loader.*;
import pl.skidam.automodpack_core.modpack.ModpackExecutor;
import pl.skidam.automodpack_core.modpack.FullServerPack;
import pl.skidam.automodpack_core.protocol.netty.NettyServer;

import java.nio.file.Path;
Expand All @@ -23,9 +24,11 @@ public class GlobalVariables {
public static GameCallService GAME_CALL = new NullGameCall();
public static Path THIZ_JAR;
public static Path MODS_DIR;
// new modpack class, now gen about the Executor
public static ModpackExecutor modpackExecutor;
public static FullServerPack fullpacks;
public static NettyServer hostServer;
public static Jsons.ServerConfigFieldsV2 serverConfig;
public static Jsons.ServerConfigFieldsV3 serverConfig;
public static Jsons.ClientConfigFieldsV2 clientConfig;
public static Jsons.KnownHostsFields knownHosts;
public static final Path automodpackDir = Path.of("automodpack");
Expand All @@ -34,8 +37,8 @@ public class GlobalVariables {
// Main - required
// Addons - optional addon packs
// Switches - optional or required packs, chosen by the player, only one can be installed at a time
public static final Path hostContentModpackDir = hostModpackDir.resolve("main");
public static Path hostModpackContentFile = hostModpackDir.resolve("automodpack-content.json");
public static final Path mainHostContentModpackDir = hostModpackDir.resolve("main");
public static final Path hostModpackContentFile = hostModpackDir.resolve("automodpack-content.json");
public static Path serverConfigFile = automodpackDir.resolve("automodpack-server.json");
public static Path serverCoreConfigFile = automodpackDir.resolve("automodpack-core.json");
public static final Path privateDir = automodpackDir.resolve(".private");
Expand All @@ -50,6 +53,7 @@ public class GlobalVariables {
public static final Path clientConfigFile = automodpackDir.resolve("automodpack-client.json");
public static final Path clientSecretsFile = privateDir.resolve("automodpack-client-secrets.json");
public static final Path modpacksDir = automodpackDir.resolve("modpacks");
public static final Path hostFullServerPackDir = automodpackDir.resolve("serverpack");

public static final String clientConfigFileOverrideResource = "overrides-automodpack-client.json";
public static String clientConfigOverride; // read from inside a jar file on preload, used instead of clientConfigFile if exists
Expand Down
53 changes: 42 additions & 11 deletions core/src/main/java/pl/skidam/automodpack_core/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

import pl.skidam.automodpack_core.config.ConfigTools;
import pl.skidam.automodpack_core.config.Jsons;
import pl.skidam.automodpack_core.modpack.FullServerPackContent;
import pl.skidam.automodpack_core.modpack.ModpackExecutor;
import pl.skidam.automodpack_core.modpack.ModpackContent;
import pl.skidam.automodpack_core.modpack.FullServerPack;
import pl.skidam.automodpack_core.protocol.netty.NettyServer;
import pl.skidam.automodpack_core.utils.CustomFileUtils;

import java.nio.file.Path;
import java.util.ArrayList;

import static pl.skidam.automodpack_core.GlobalVariables.*;

public class Server {

//hostmodpack folder
private static final Path hostContentModpackDir = CustomFileUtils.getPathFromCWD("automodpack/host-modpack");


// TODO Finish this class that it will be able to host the server without mod
public static void main(String[] args) {

Expand All @@ -31,13 +36,12 @@ public static void main(String[] args) {

modpackDir.toFile().mkdirs();

hostModpackContentFile = modpackDir.resolve("automodpack-content.json");
// hostModpackContentFile = modpackDir.resolve("automodpack-content.json");
serverConfigFile = modpackDir.resolve("automodpack-server.json");
serverCoreConfigFile = modpackDir.resolve("automodpack-core.json");

serverConfig = ConfigTools.load(serverConfigFile, Jsons.ServerConfigFieldsV2.class);
serverConfig = ConfigTools.load(serverConfigFile, Jsons.ServerConfigFieldsV3.class);
if (serverConfig != null) {
serverConfig.syncedFiles = new ArrayList<>();
serverConfig.validateSecrets = false;
ConfigTools.save(serverConfigFile, serverConfig);

Expand All @@ -60,18 +64,45 @@ public static void main(String[] args) {
mainModpackDir.toFile().mkdirs();

ModpackExecutor modpackExecutor = new ModpackExecutor();
ModpackContent modpackContent = new ModpackContent(serverConfig.modpackName, null, mainModpackDir, serverConfig.syncedFiles, serverConfig.allowEditsInFiles, serverConfig.forceCopyFilesToStandardLocation, modpackExecutor.getExecutor());
boolean generated = modpackExecutor.generateNew(modpackContent);
// ModpackContent modpackContent = new ModpackContent(serverConfig.modpackName, null, mainModpackDir, serverConfig.syncedFiles, serverConfig.allowEditsInFiles, serverConfig.forceCopyFilesToStandardLocation, modpackExecutor.getExecutor());
// boolean generated = modpackExecutor.generateNew(modpackContent);

// if (generated) {
// LOGGER.info("Modpack generated!");
// } else {
// LOGGER.error("Failed to generate modpack!");
// }

//beta modpack Executor
//modpackExecutor.stop();

// change hostPort to bindPort?
//LOGGER.info("Starting server on port {}", serverConfig.bindPort);

if (generated) {
LOGGER.info("Modpack generated!");
FullServerPack fullserverpack = new FullServerPack(modpackExecutor);

String modpackName = serverConfig.groups.get("host").groupName;
FullServerPackContent fullServerPackContent = new FullServerPackContent(modpackName, hostContentModpackDir, fullserverpack.executor.getExecutor());
boolean fullpackgenerated = fullserverpack.generateNew(fullServerPackContent);

if (fullpackgenerated) {
LOGGER.info("FullServerPack generated!");
} else {
LOGGER.error("Failed to generate modpack!");
LOGGER.error("Failed to generate serverpack!");
}

modpackExecutor.stop();
fullserverpack.shutdownExecutor();
//port from Config
Jsons.GroupDeclaration hostGroup = serverConfig.groups.get("host");
if (hostGroup == null) {
LOGGER.error("Host group not found in server config!");
return;
}

int port = serverConfig.bindPort;
LOGGER.info("Starting server on port {}", port);

LOGGER.info("Starting server on port {}", serverConfig.bindPort);
server.start();
// wait for server to stop
while (server.isRunning()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
package pl.skidam.automodpack_core.config;

import com.google.gson.*;
import pl.skidam.automodpack_core.utils.AddressHelpers;

import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import java.lang.reflect.Type;
import java.net.InetSocketAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.io.Reader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import pl.skidam.automodpack_core.utils.AddressHelpers;


import static pl.skidam.automodpack_core.GlobalVariables.*;

Expand Down Expand Up @@ -91,6 +103,7 @@ public static <T> T load(Path configFile, Class<T> configClass) {
}
}


public static <T> T load(String json, Class<T> configClass) {
try {
if (json != null) {
Expand Down Expand Up @@ -123,19 +136,19 @@ public static void save(Path configFile, Object configObject) {


// Modpack content stuff
public static Jsons.ModpackContentFields loadModpackContent(Path modpackContentFile) {
public static Jsons.ModpackGroupFields loadModpackContent(Path modpackContentFile) {
try {
if (Files.isRegularFile(modpackContentFile)) {
String json = Files.readString(modpackContentFile);
return GSON.fromJson(json, Jsons.ModpackContentFields.class);
return GSON.fromJson(json, Jsons.ModpackGroupFields.class);
}
} catch (Exception e) {
LOGGER.error("Couldn't load modpack content! {}", modpackContentFile.toAbsolutePath().normalize(), e);
}
return null;
}

public static void saveModpackContent(Path modpackContentFile, Jsons.ModpackContentFields configObject) {
public static void saveModpackContent(Path modpackContentFile, Jsons.ModpackGroupFields configObject) {
try {
if (!Files.isDirectory(modpackContentFile.getParent())) {
Files.createDirectories(modpackContentFile.getParent());
Expand All @@ -147,4 +160,37 @@ public static void saveModpackContent(Path modpackContentFile, Jsons.ModpackCont
e.printStackTrace();
}
}

public static void saveFullServerPackContent(Path modpackContentFile, Jsons.FullServerPackContentFields configObject) {
try {
if (!Files.isDirectory(modpackContentFile.getParent())) {
Files.createDirectories(modpackContentFile.getParent());
}

Files.writeString(modpackContentFile, GSON.toJson(configObject), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (Exception e) {
LOGGER.error("Couldn't save full server pack content! " + configObject.getClass());
e.printStackTrace();
}
}

public static Set<String> loadFullServerPackExclude(Path serverConfigPath) {
Set<String> excludedFiles = new HashSet<>();

if (!Files.exists(serverConfigPath)) return excludedFiles;

try (Reader reader = Files.newBufferedReader(serverConfigPath)) {
JsonObject json = JsonParser.parseReader(reader).getAsJsonObject();
JsonArray excluded = json.getAsJsonArray("ServerPackExcluded");
if (excluded != null) {
for (JsonElement e : excluded) {
excludedFiles.add(e.getAsString());
}
}
} catch (IOException | JsonParseException e) {
LOGGER.error("Error in automodpack-server.json with FullServerPack exclude", e);
}

return excludedFiles;
}
}
Loading