Skip to content

Commit 08d0300

Browse files
Merge pull request #729 from ArikSquad/feat/limbo
Limbo
2 parents a89de5f + 6a44bab commit 08d0300

File tree

29 files changed

+531
-487
lines changed

29 files changed

+531
-487
lines changed

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"]

commons/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626
}
2727

2828
// Must match AtlasRedisAPI's Jedis version to avoid conflicts
29-
implementation("redis.clients:jedis:4.2.3")
29+
implementation("redis.clients:jedis:7.2.0")
3030

31-
implementation("org.spongepowered:configurate-yaml:4.2.0")
31+
implementation("de.exlll:configlib-yaml:4.8.1")
3232
}
Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +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
}
4643

4744
}
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
}

configuration/NanoLimbo-1.10.2.jar

-4.33 MB
Binary file not shown.

configuration/PicoLimbo.jar

17.1 MB
Binary file not shown.

configuration/entrypoint.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
#!/bin/bash
22

3-
# Copy the Forwarding Secret
4-
cp configuration_files/forwarding.secret ./forwarding.secret
3+
if [ -n "$FORWARDING_SECRET" ]; then
4+
secret="$FORWARDING_SECRET"
5+
elif [ -f ./configuration_files/forwarding.secret ]; then
6+
secret=$(cat ./configuration_files/forwarding.secret)
7+
else
8+
echo "FORWARDING_SECRET is required (env var or configuration_files/forwarding.secret)" >&2
9+
exit 1
10+
fi
11+
12+
printf '%s' "$secret" > ./forwarding.secret
513

614
# Ensure configuration/config.yml exists
715
mkdir -p ./configuration
@@ -10,14 +18,7 @@ if [ ! -f ./configuration/config.yml ]; then
1018
fi
1119

1220
# Update config.yml with the forwarding secret (velocity-secret)
13-
secret=$(cat ./forwarding.secret)
1421
sed -i "s/velocity-secret: .*/velocity-secret: '$secret'/" ./configuration/config.yml
1522

16-
# Replace the secret in settings.yml
17-
sed -i "s/secret: '.*'/secret: '$secret'/" ./settings.yml
18-
19-
# Set the settings.yml bind: ip: 'localhost' to bind: ip: '0.0.0.0'
20-
sed -i "s/ip: 'localhost'/ip: '0.0.0.0'/" ./settings.yml
21-
2223
echo "$SERVICE_CMD"
2324
exec $SERVICE_CMD

configuration/server.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# configuration for PicoLimbo
2+
bind = "0.0.0.0:65535"
3+
welcome_message = ""
4+
action_bar = ""
5+
default_game_mode = "survival"
6+
hardcore = true
7+
fetch_player_skins = false
8+
reduced_debug_info = false
9+
allow_unsupported_versions = false
10+
allow_flight = false
11+
accept_transfers = false
12+
13+
[forwarding]
14+
method = "MODERN"
15+
secret = "${FORWARDING_SECRET}"
16+
17+
[world]
18+
spawn_position = [
19+
-22.5,
20+
31.06250,
21+
21.5,
22+
]
23+
spawn_rotation = [
24+
-90.0,
25+
0.0,
26+
]
27+
dimension = "end"
28+
time = "day"
29+
30+
[world.experimental]
31+
view_distance = 4
32+
schematic_file = ""
33+
polar_file = "limbo.polar"
34+
lock_time = false
35+
36+
[world.boundaries]
37+
enabled = false
38+
min_y = -64
39+
teleport_message = ""
40+
41+
[server_list]
42+
reply_to_status = false
43+
max_players = 20
44+
message_of_the_day = "Limbo"
45+
show_online_player_count = false
46+
server_icon = "server-icon.png"
47+
48+
[compression]
49+
threshold = -1
50+
level = 6
51+
52+
[tab_list]
53+
enabled = false
54+
header = ""
55+
footer = ""
56+
player_listed = false
57+
58+
[boss_bar]
59+
enabled = false
60+
title = ""
61+
health = 1.0
62+
color = "pink"
63+
division = 0
64+
65+
[title]
66+
enabled = false
67+
title = ""
68+
subtitle = ""
69+
fade_in = 10
70+
stay = 70
71+
fade_out = 20
72+
73+
[commands]
74+
spawn = ""
75+
fly = ""
76+
fly_speed = ""
77+
transfer = ""

0 commit comments

Comments
 (0)