Skip to content

Commit

Permalink
clone-remote-port option Updated (GeyserMC#1061)
Browse files Browse the repository at this point in the history
* Added clone remote port option for bukkit, bungee and velocity

* Added clone remote port option for sponge

* Changed clone-remote-port description in config.yml

* Update config.yml

Updated config.yml to include a better description of the clone-remote-port option

* Updated GeyserSpongePlugin

An incorrect port was being edited before (remote instead of bedrock)

* Update config.yml

Co-authored-by: TeaNoDonuts <[email protected]>
  • Loading branch information
toinouH and blackalegator authored Jul 30, 2020
1 parent 600c54d commit 427cb69
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 0 deletions.
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

0 comments on commit 427cb69

Please sign in to comment.