Add Server Name config option (#1170)

* Add bedrock.server-name config option

* Fix spelling mistake oops!

* Remove trailing whitespace
This commit is contained in:
James Cahill 2020-08-25 14:29:55 +01:00 committed by GitHub
parent c1a70c7754
commit 81f58ee9bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 2 deletions

View file

@ -205,6 +205,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
public String getMotd2() { public String getMotd2() {
return node.getNode("motd2").getString("GeyserMC"); return node.getNode("motd2").getString("GeyserMC");
} }
@Override
public String getServerName() {
return node.getNode("server-name").getString("Geyser");
}
} }
@AllArgsConstructor @AllArgsConstructor

View file

@ -95,6 +95,8 @@ public interface GeyserConfiguration {
String getMotd1(); String getMotd1();
String getMotd2(); String getMotd2();
String getServerName();
} }
interface IRemoteConfiguration { interface IRemoteConfiguration {

View file

@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.connector.common.serializer.AsteriskSerializer;
import java.nio.file.Path; import java.nio.file.Path;
@ -118,6 +119,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
private String motd1; private String motd1;
private String motd2; private String motd2;
@JsonProperty("server-name")
private String serverName = GeyserConnector.NAME;
} }
@Getter @Getter

View file

@ -590,8 +590,10 @@ public class GeyserSession implements CommandSender {
startGamePacket.setFromWorldTemplate(false); startGamePacket.setFromWorldTemplate(false);
startGamePacket.setWorldTemplateOptionLocked(false); startGamePacket.setWorldTemplateOptionLocked(false);
startGamePacket.setLevelId("world"); String serverName = connector.getConfig().getBedrock().getServerName();
startGamePacket.setLevelName("world"); startGamePacket.setLevelId(serverName);
startGamePacket.setLevelName(serverName);
startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000"); startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000");
// startGamePacket.setCurrentTick(0); // startGamePacket.setCurrentTick(0);
startGamePacket.setEnchantmentSeed(0); startGamePacket.setEnchantmentSeed(0);

View file

@ -20,6 +20,8 @@ bedrock:
# The MOTD that will be broadcasted to Minecraft: Bedrock Edition clients. Irrelevant if "passthrough-motd" is set to true # The MOTD that will be broadcasted to Minecraft: Bedrock Edition clients. Irrelevant if "passthrough-motd" is set to true
motd1: "GeyserMC" motd1: "GeyserMC"
motd2: "Another GeyserMC forced host." motd2: "Another GeyserMC forced host."
# The Server Name that will be sent to Minecraft: Bedrock Edition clients. Visible in both the pause menu and the settings menu.
server-name: "Geyser"
remote: remote:
# The IP address of the remote (Java Edition) server # The IP address of the remote (Java Edition) server
# If it is "auto", for standalone version the remote address will be set to 127.0.0.1, # If it is "auto", for standalone version the remote address will be set to 127.0.0.1,