Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clone-remote-port option Updated #1061

Merged
merged 7 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public void onEnable() {
this.geyserConfig.getRemote().setAddress(javaAddr.getHostString());
}

if (geyserConfig.getBedrock().isCloneRemotePort()) {
geyserConfig.getBedrock().setPort(javaAddr.getPort());
}

this.geyserConfig.getRemote().setPort(javaAddr.getPort());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public void onEnable() {
geyserConfig.getRemote().setAddress(Bukkit.getIp());
}

if (geyserConfig.getBedrock().isCloneRemotePort()) {
geyserConfig.getBedrock().setPort(Bukkit.getPort());
}

geyserConfig.getRemote().setPort(Bukkit.getPort());

this.geyserLogger = new GeyserSpigotLogger(getLogger(), geyserConfig.isDebugMode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ public int getPort() {
return node.getNode("port").getInt(19132);
}

@Override
public boolean isCloneRemotePort() {
return node.getNode("clone-remote-port").getBoolean(false);
}

@Override
public String getMotd1() {
return node.getNode("motd1").getString("GeyserMC");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public void onEnable() {
serverPort.setValue(javaAddr.getPort());
}

ConfigurationNode bedrockPort = config.getNode("bedrock").getNode("port");
if (geyserConfig.getBedrock().isCloneRemotePort()){
bedrockPort.setValue(serverPort.getValue());
}

this.geyserLogger = new GeyserSpongeLogger(logger, geyserConfig.isDebugMode());
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
this.connector = GeyserConnector.start(PlatformType.SPONGE, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public void onEnable() {
geyserConfig.getRemote().setAddress(javaAddr.getHostString());
}

if (geyserConfig.getBedrock().isCloneRemotePort()) {
geyserConfig.getBedrock().setPort(javaAddr.getPort());
}

geyserConfig.getRemote().setPort(javaAddr.getPort());

this.geyserLogger = new GeyserVelocityLogger(logger, geyserConfig.isDebugMode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ interface IBedrockConfiguration {

int getPort();

boolean isCloneRemotePort();

String getMotd1();

String getMotd2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
public static class BedrockConfiguration implements IBedrockConfiguration {

private String address;
@Setter
private int port;
private boolean isCloneRemotePort;

private String motd1;
private String motd2;
Expand Down
4 changes: 4 additions & 0 deletions connector/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ bedrock:
address: 0.0.0.0
# The port that will listen for connections
port: 19132
# Some hosting services change your Java port everytime you open the server, and require the same port to be used for Bedrock.
# This option makes the Bedrock port the same as the Java port every time you start the server.
# This option is for the plugin version only.
clone-remote-port: false
# The MOTD that will be broadcasted to Minecraft: Bedrock Edition clients. Irrelevant if "passthrough-motd" is set to true
motd1: "GeyserMC"
motd2: "Another GeyserMC forced host."
Expand Down