Skip to content

Commit

Permalink
Allow setting a custom MOTD for <= beta 1.7.3 servers
Browse files Browse the repository at this point in the history
Closes #88
  • Loading branch information
RaphiMC committed Oct 30, 2024
1 parent f000cdb commit 550dc71
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ tasks.register("runViaProxy", JavaExec) {
mainClass = "net.raphimc.viaproxy.ViaProxy"
classpath = viaProxyConfiguration
workingDir = file("run")
jvmArgs = ["-DskipUpdateCheck"]

doFirst {
def jarsDir = file("$workingDir/jars")
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/raphimc/vialegacy/ViaLegacyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ViaLegacyConfig extends Config implements net.raphimc.vialegacy.pla
private boolean soundEmulation;
private boolean oldBiomes;
private boolean enableB1_7_3Sprinting;
private String b1_7_3Motd;
private int classicChunkRange;
private boolean enableClassicFly;

Expand All @@ -56,6 +57,7 @@ private void loadFields() {
this.soundEmulation = this.getBoolean("sound-emulation", true);
this.oldBiomes = this.getBoolean("old-biomes", true);
this.enableB1_7_3Sprinting = this.getBoolean("enable-b1_7_3-sprinting", false);
this.b1_7_3Motd = this.getString("b1_7_3-motd", "The server seems to be running!\nWait 5 seconds between each connection");
this.classicChunkRange = this.getInt("classic-chunk-range", 10);
this.enableClassicFly = this.getBoolean("enable-classic-fly", false);
}
Expand Down Expand Up @@ -109,6 +111,11 @@ public boolean enableB1_7_3Sprinting() {
return this.enableB1_7_3Sprinting;
}

@Override
public String getB1_7_3Motd() {
return this.b1_7_3Motd;
}

@Override
public int getClassicChunkRange() {
return this.classicChunkRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public interface ViaLegacyConfig extends Config {

boolean enableB1_7_3Sprinting();

String getB1_7_3Motd();

int getClassicChunkRange();

boolean enableClassicFly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void register() {
wrapper.cancel();
}
final PacketWrapper pingResponse = PacketWrapper.create(ClientboundPacketsb1_8.DISCONNECT, wrapper.user());
pingResponse.write(Types1_6_4.STRING, "The server seems to be running!\nWait 5 seconds between each connection§0§1");
pingResponse.write(Types1_6_4.STRING, ViaLegacy.getConfig().getB1_7_3Motd() + "§0§1");
pingResponse.send(Protocolb1_7_0_3Tob1_8_0_1.class);
});
this.registerServerbound(ServerboundPacketsb1_8.LOGIN, new PacketHandlers() {
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/assets/vialegacy/vialegacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ old-biomes: true
# Enables sprinting for versions below beta 1.8. !THIS CAN CAUSE ISSUES WITH ANTI-CHEAT PLUGINS!
enable-b1_7_3-sprinting: false
#
# The MOTD to use for <= beta 1.7.3 servers. Supports newlines. Doesn't support color codes.
b1_7_3-motd: |
The server seems to be running!
Wait 5 seconds between each connection
#
# Classic chunk loading range
classic-chunk-range: 10
#
Expand Down

0 comments on commit 550dc71

Please sign in to comment.