Allow setting a custom MOTD for <= beta 1.7.3 servers

Closes #88
This commit is contained in:
RaphiMC 2024-10-30 19:25:03 +01:00
parent f000cdb2c3
commit 550dc71315
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
5 changed files with 16 additions and 1 deletions

View File

@ -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")

View File

@ -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;
@ -56,6 +57,7 @@ public class ViaLegacyConfig extends Config implements net.raphimc.vialegacy.pla
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);
}
@ -109,6 +111,11 @@ public class ViaLegacyConfig extends Config implements net.raphimc.vialegacy.pla
return this.enableB1_7_3Sprinting;
}
@Override
public String getB1_7_3Motd() {
return this.b1_7_3Motd;
}
@Override
public int getClassicChunkRange() {
return this.classicChunkRange;

View File

@ -35,6 +35,8 @@ public interface ViaLegacyConfig extends Config {
boolean enableB1_7_3Sprinting();
String getB1_7_3Motd();
int getClassicChunkRange();
boolean enableClassicFly();

View File

@ -243,7 +243,7 @@ public class Protocolb1_7_0_3Tob1_8_0_1 extends StatelessProtocol<ClientboundPac
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() {

View File

@ -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
#