Skip to content

Commit 57ba5bb

Browse files
Merge branch 'master' into feat/translations
2 parents 3649f72 + 969a6ef commit 57ba5bb

233 files changed

Lines changed: 6875 additions & 3704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DockerFiles/Dockerfile.game_server

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ RUN curl -fSL -o /tmp/worlds.tar.gz "https://files.catbox.moe/9uas8z.gz" && \
2828

2929
EXPOSE 25565 65535 8080 20000
3030

31-
RUN cp configuration_files/NanoLimbo-1.10.2.jar ./NanoLimbo-1.10.2.jar && \
32-
cp configuration_files/settings.yml ./settings.yml && \
31+
RUN cp configuration_files/server.toml ./server.toml && \
3332
cp -a configuration_files/skyblock/. configuration/skyblock/ && \
3433
cp configuration_files/entrypoint.sh ./entrypoint.sh && \
35-
chmod +x entrypoint.sh && \
36-
sed -i "s/ip: 'localhost'/ip: '0.0.0.0'/" ./settings.yml
34+
chmod +x entrypoint.sh
3735

3836
CMD ["sh", "entrypoint.sh"]

DockerFiles/Dockerfile.proxy

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM eclipse-temurin:25-jdk
22

33
WORKDIR /app
44

5-
RUN apt-get update && apt-get install -y jq expect netcat-traditional curl && apt-get clean
5+
RUN apt-get update && apt-get install -y jq netcat-traditional curl && apt-get clean
66

77
# Download Velocity proxy JAR
88
RUN curl -fSL -o velocity.jar "https://fill-data.papermc.io/v1/objects/ef1a852bfae7397e84907837925e7ad21c6312066290edaae401b77f6f423ac3/velocity-3.4.0-SNAPSHOT-558.jar"
@@ -14,22 +14,14 @@ RUN mkdir -p plugins && \
1414
# Copy configuration data
1515
COPY ./configuration /app/configuration_files
1616

17-
# Run Velocity to generate forwarding.secret, then shut it down
18-
RUN printf '#!/usr/bin/expect -f\nset timeout 120\nspawn java -jar velocity.jar\nexpect ">"\nsend "shutdown\\r"\nexpect eof\n' > /tmp/run_velocity.exp && \
19-
chmod +x /tmp/run_velocity.exp && \
20-
/tmp/run_velocity.exp && \
21-
rm /tmp/run_velocity.exp
22-
2317
# Replace generated velocity.toml with our own
2418
RUN rm -f velocity.toml && \
2519
cp configuration_files/velocity.toml velocity.toml
2620

27-
# Set up config.yml with the generated forwarding secret
21+
# Set up config.yml template
2822
RUN mkdir -p configuration && \
29-
cp configuration_files/config.example.yml ./configuration/config.yml && \
30-
secret=$(cat forwarding.secret) && \
31-
sed -i "s/velocity-secret: .*/velocity-secret: '$secret'/" ./configuration/config.yml
23+
cp configuration_files/config.example.yml ./configuration/config.yml
3224

3325
EXPOSE 25565
3426

35-
CMD ["sh", "-c", "cp forwarding.secret /app/configuration_files/forwarding.secret && java -jar velocity.jar"]
27+
CMD ["sh", "-c", "[ -n \"$FORWARDING_SECRET\" ] || { echo 'FORWARDING_SECRET is required' >&2; exit 1; }; printf '%s' \"$FORWARDING_SECRET\" > /app/forwarding.secret; sed -i \"s/velocity-secret: .*/velocity-secret: '$FORWARDING_SECRET'/\" /app/configuration/config.yml; java -jar velocity.jar"]

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ subprojects {
2828
}
2929

3030
dependencies {
31-
testImplementation("org.junit.jupiter:junit-jupiter:6.0.2")
31+
testImplementation("org.junit.jupiter:junit-jupiter:6.0.3")
3232

3333
implementation("org.reflections:reflections:0.10.2")
34-
implementation("org.json:json:20240303")
34+
implementation("org.json:json:20251224")
3535
implementation("io.sentry:sentry-async-profiler:8.30.0")
3636

3737
compileOnly("org.projectlombok:lombok:1.18.42")

commons/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ dependencies {
2525
exclude(group = "org.jboss.shrinkwrap.resolver", module = "shrinkwrap-resolver-depchain")
2626
}
2727

28-
implementation("org.spongepowered:configurate-yaml:4.2.0")
28+
// Must match AtlasRedisAPI's Jedis version to avoid conflicts
29+
implementation("redis.clients:jedis:7.2.0")
30+
31+
implementation("de.exlll:configlib-yaml:4.8.1")
2932
}

commons/src/main/java/net/swofty/commons/ServiceType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public enum ServiceType {
99
PARTY,
1010
DARK_AUCTION,
1111
ORCHESTRATOR,
12-
FRIEND
12+
FRIEND,
13+
PUNISHMENT,
1314
;
1415
}

commons/src/main/java/net/swofty/commons/StringUtility.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,21 @@ public static String ntify(int i) {
378378
};
379379
};
380380
}
381+
382+
public static long parseDuration(String duration) {
383+
long totalMillis = 0;
384+
Pattern pattern = Pattern.compile("(\\d+)([dhms])");
385+
Matcher matcher = pattern.matcher(duration);
386+
while (matcher.find()) {
387+
int value = Integer.parseInt(matcher.group(1));
388+
char unit = matcher.group(2).charAt(0);
389+
switch (unit) {
390+
case 'd' -> totalMillis += TimeUnit.DAYS.toMillis(value);
391+
case 'h' -> totalMillis += TimeUnit.HOURS.toMillis(value);
392+
case 'm' -> totalMillis += TimeUnit.MINUTES.toMillis(value);
393+
case 's' -> totalMillis += TimeUnit.SECONDS.toMillis(value);
394+
}
395+
}
396+
return totalMillis;
397+
}
381398
}
Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
11
package net.swofty.commons.config;
22

3+
import de.exlll.configlib.ConfigurationProperties;
4+
import de.exlll.configlib.NameFormatters;
5+
import de.exlll.configlib.YamlConfigurationProperties;
6+
import de.exlll.configlib.YamlConfigurations;
37
import lombok.Getter;
48
import lombok.Setter;
59
import lombok.experimental.Accessors;
6-
import org.spongepowered.configurate.CommentedConfigurationNode;
7-
import org.spongepowered.configurate.yaml.NodeStyle;
8-
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
10+
import org.jetbrains.annotations.NotNull;
911
import org.tinylog.Logger;
1012

11-
import java.io.IOException;
13+
import java.nio.charset.StandardCharsets;
1214
import java.nio.file.Path;
1315

1416
public class ConfigProvider {
1517

18+
final static ConfigurationProperties.EnvVarResolutionConfiguration envResolution = ConfigurationProperties.EnvVarResolutionConfiguration
19+
.resolveEnvVarsWithPrefix("HYPIXEL_", false);
20+
21+
@NotNull
22+
static final YamlConfigurationProperties properties = YamlConfigurationProperties.newBuilder()
23+
.setNameFormatter(NameFormatters.LOWER_KEBAB_CASE)
24+
.charset(StandardCharsets.UTF_8)
25+
.setEnvVarResolutionConfiguration(envResolution)
26+
.build();
27+
1628
@Getter
1729
@Setter
1830
@Accessors(fluent = true)
1931
private static Settings settings;
2032

2133
static {
22-
try {
23-
Logger.info("Loading config...");
24-
25-
YamlConfigurationLoader loader = YamlConfigurationLoader.builder()
26-
.path(Path.of("./configuration/config.yml"))
27-
.nodeStyle(NodeStyle.BLOCK)
28-
.build();
29-
30-
CommentedConfigurationNode root = loader.load();
31-
CommentedConfigurationNode defaults = loader.createNode();
32-
defaults.set(Settings.class, new Settings());
33-
root.mergeFrom(defaults);
34-
35-
Settings loaded = root.get(Settings.class);
36-
if (loaded == null) {
37-
loaded = new Settings();
38-
}
39-
40-
loader.save(root);
41-
settings(loaded);
42-
} catch (IOException e) {
43-
throw new RuntimeException("Failed to load configuration", e);
44-
}
34+
Logger.info("Loading config...");
35+
settings(
36+
YamlConfigurations.update(
37+
Path.of("./configuration/config.yml"),
38+
Settings.class,
39+
properties
40+
)
41+
);
4542
}
43+
4644
}
Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,76 @@
11
package net.swofty.commons.config;
22

3+
import de.exlll.configlib.Comment;
4+
import de.exlll.configlib.Configuration;
35
import lombok.AccessLevel;
46
import lombok.Getter;
57
import lombok.NoArgsConstructor;
6-
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
7-
import org.spongepowered.configurate.objectmapping.meta.Comment;
8+
9+
import java.util.HashMap;
10+
import java.util.Map;
811

912
@Getter
10-
@ConfigSerializable
13+
@Configuration
1114
@SuppressWarnings({"unused", "FieldMayBeFinal"})
1215
public class Settings {
1316

14-
private String hostName = "0.0.0.0";
15-
private long transferTimeout = 800;
17+
@Comment("The host name or IP address to bind the server to")
18+
private String hostName = "0.0.0.0";
1619

17-
@Comment("The MongoDB connection URI")
18-
private String mongodb = "mongodb://localhost";
20+
@Comment("The MongoDB connection URI")
21+
private String mongodb = "mongodb://localhost";
1922

20-
@Comment("The Redis connection URI")
21-
private String redisUri = "redis://localhost:6379";
23+
@Comment("The Redis connection URI")
24+
private String redisUri = "redis://localhost:6379";
2225

23-
@Comment("The secret key used to authenticate with Velocity proxy")
24-
private String velocitySecret = "ixmSUgWOgvs7";
26+
@Comment("The secret key used to authenticate with Velocity proxy")
27+
private String velocitySecret = "ixmSUgWOgvs7";
2528

26-
private boolean requireAuth = false;
29+
private boolean requireAuth = false;
2730

28-
@Comment("Whether to enable sandbox features (such as editing items)")
29-
private boolean sandbox = false;
31+
@Comment("Whether to enable sandbox features (such as editing items)")
32+
private boolean sandbox = false;
3033

31-
@Comment("Integrations with services")
32-
private IntegrationSettings integrations = new IntegrationSettings();
34+
@Comment("Integrations with services")
35+
private IntegrationSettings integrations = new IntegrationSettings();
3336

34-
@Comment("Settings related to configuration of Limbo server connections")
35-
private LimboSettings limbo = new LimboSettings();
37+
@Comment("Settings related to configuration of Limbo server connections")
38+
private LimboSettings limbo = new LimboSettings();
3639

37-
@Comment("Resource pack settings keyed by pack name (e.g. testingpack, bedwarspack)")
38-
private java.util.Map<String, ResourcePackSettings> resourcePacks = new java.util.HashMap<>();
40+
@Comment("Resource pack settings keyed by pack name (e.g. testingpack, bedwarspack)")
41+
private Map<String, ResourcePackSettings> resourcePacks = new HashMap<>();
3942

40-
@Getter
41-
@ConfigSerializable
42-
@NoArgsConstructor(access = AccessLevel.PRIVATE)
43-
public static class LimboSettings {
44-
private String hostName = "127.0.0.1";
45-
private int port = 65535;
46-
}
43+
@Getter
44+
@Configuration
45+
@NoArgsConstructor(access = AccessLevel.PRIVATE)
46+
public static class LimboSettings {
47+
private String hostName = "127.0.0.1";
48+
private int port = 65535;
49+
}
4750

48-
@Getter
49-
@ConfigSerializable
50-
@NoArgsConstructor
51-
public static class ResourcePackSettings {
52-
@Comment("Base URL of the pack server (e.g. http://0.0.0.0:7270)")
53-
private String serverUrl = "http://127.0.0.1:7270";
54-
}
51+
@Getter
52+
@Configuration
53+
@NoArgsConstructor
54+
public static class ResourcePackSettings {
55+
@Comment("Base URL of the pack server (e.g. http://0.0.0.0:7270)")
56+
private String serverUrl = "http://127.0.0.1:7270";
57+
}
5558

56-
@Getter
57-
@ConfigSerializable
58-
@NoArgsConstructor(access = AccessLevel.PRIVATE)
59-
public static class IntegrationSettings {
60-
@Comment("Whether to enable Spark for performance monitoring")
61-
private boolean spark = false;
59+
@Getter
60+
@Configuration
61+
@NoArgsConstructor(access = AccessLevel.PRIVATE)
62+
public static class IntegrationSettings {
63+
@Comment("Whether to enable Spark for performance monitoring")
64+
private boolean spark = false;
6265

63-
@Comment("Whether to enable anti-cheat measures")
64-
private boolean anticheat = false;
66+
@Comment("Whether to enable anti-cheat measures")
67+
private boolean anticheat = false;
6568

66-
@Comment("Whether to enable ViaVersion for supporting multiple Minecraft versions. This may cause issues of any kind")
67-
private boolean viaVersion = false;
69+
@Comment("Whether to enable ViaVersion for supporting multiple Minecraft versions. This may cause issues of any kind")
70+
private boolean viaVersion = false;
6871

69-
private String sentryDsn = "";
70-
}
72+
@Comment("The DSN to use for Sentry error tracking. If empty, Sentry will be disabled")
73+
private String sentryDsn = "";
74+
}
7175

7276
}

0 commit comments

Comments
 (0)