|
31 | 31 | import org.geysermc.geyser.api.util.PlatformType;
|
32 | 32 | import org.geysermc.geyser.command.GeyserCommand;
|
33 | 33 | import org.geysermc.geyser.command.GeyserCommandSource;
|
| 34 | +import org.geysermc.geyser.configuration.GeyserConfiguration; |
34 | 35 | import org.geysermc.geyser.session.GeyserSession;
|
35 | 36 | import org.geysermc.geyser.text.GeyserLocale;
|
36 | 37 | import org.geysermc.geyser.util.LoopbackUtil;
|
@@ -84,7 +85,7 @@ public void execute(@Nullable GeyserSession session, GeyserCommandSource sender,
|
84 | 85 | return;
|
85 | 86 | }
|
86 | 87 | } else {
|
87 |
| - port = 19132; |
| 88 | + port = geyser.getConfig().getBedrock().broadcastPort(); |
88 | 89 | }
|
89 | 90 | String ip = fullAddress[0];
|
90 | 91 |
|
@@ -112,30 +113,41 @@ public void execute(@Nullable GeyserSession session, GeyserCommandSource sender,
|
112 | 113 | return;
|
113 | 114 | }
|
114 | 115 |
|
115 |
| - // Issue: do the ports not line up? |
116 |
| - if (port != geyser.getConfig().getBedrock().port()) { |
117 |
| - if (fullAddress.length == 2) { |
118 |
| - sender.sendMessage("The port you are testing with (" + port + ") is not the same as you set in your Geyser configuration (" |
119 |
| - + geyser.getConfig().getBedrock().port() + ")"); |
120 |
| - sender.sendMessage("Re-run the command with the port in the config, or change the `bedrock` `port` in the config."); |
121 |
| - if (geyser.getConfig().getBedrock().isCloneRemotePort()) { |
122 |
| - sender.sendMessage("You have `clone-remote-port` enabled. This option ignores the `bedrock` `port` in the config, and uses the Java server port instead."); |
| 116 | + GeyserConfiguration config = geyser.getConfig(); |
| 117 | + |
| 118 | + // Issue: do the ports not line up? We only check this if players don't override the broadcast port - if they do, they (hopefully) know what they're doing |
| 119 | + if (config.getBedrock().broadcastPort() == config.getBedrock().port()) { |
| 120 | + if (port != config.getBedrock().port()) { |
| 121 | + if (fullAddress.length == 2) { |
| 122 | + sender.sendMessage("The port you are testing with (" + port + ") is not the same as you set in your Geyser configuration (" |
| 123 | + + config.getBedrock().port() + ")"); |
| 124 | + sender.sendMessage("Re-run the command with the port in the config, or change the `bedrock` `port` in the config."); |
| 125 | + if (config.getBedrock().isCloneRemotePort()) { |
| 126 | + sender.sendMessage("You have `clone-remote-port` enabled. This option ignores the `bedrock` `port` in the config, and uses the Java server port instead."); |
| 127 | + } |
| 128 | + } else { |
| 129 | + sender.sendMessage("You did not specify the port to check (add it with \":<port>\"), " + |
| 130 | + "and the default port 19132 does not match the port in your Geyser configuration (" |
| 131 | + + config.getBedrock().port() + ")!"); |
| 132 | + sender.sendMessage("Re-run the command with that port, or change the port in the config under `bedrock` `port`."); |
123 | 133 | }
|
124 |
| - } else { |
125 |
| - sender.sendMessage("You did not specify the port to check (add it with \":<port>\"), " + |
126 |
| - "and the default port 19132 does not match the port in your Geyser configuration (" |
127 |
| - + geyser.getConfig().getBedrock().port() + ")!"); |
128 |
| - sender.sendMessage("Re-run the command with that port, or change the port in the config under `bedrock` `port`."); |
| 134 | + } |
| 135 | + } else { |
| 136 | + if (config.getBedrock().broadcastPort() != port) { |
| 137 | + sender.sendMessage("The port you are testing with (" + port + ") is not the same as the broadcast port set in your Geyser configuration (" |
| 138 | + + config.getBedrock().broadcastPort() + "). "); |
| 139 | + sender.sendMessage("You ONLY need to change the broadcast port if clients connects with a port different from the port Geyser is running on."); |
| 140 | + sender.sendMessage("Re-run the command with the port in the config, or change the `bedrock` `broadcast-port` in the config."); |
129 | 141 | }
|
130 | 142 | }
|
131 | 143 |
|
132 | 144 | // Issue: is the `bedrock` `address` in the config different?
|
133 |
| - if (!geyser.getConfig().getBedrock().address().equals("0.0.0.0")) { |
| 145 | + if (!config.getBedrock().address().equals("0.0.0.0")) { |
134 | 146 | sender.sendMessage("The address specified in `bedrock` `address` is not \"0.0.0.0\" - this may cause issues unless this is deliberate and intentional.");
|
135 | 147 | }
|
136 | 148 |
|
137 | 149 | // Issue: did someone turn on enable-proxy-protocol, and they didn't mean it?
|
138 |
| - if (geyser.getConfig().getBedrock().isEnableProxyProtocol()) { |
| 150 | + if (config.getBedrock().isEnableProxyProtocol()) { |
139 | 151 | sender.sendMessage("You have the `enable-proxy-protocol` setting enabled. " +
|
140 | 152 | "Unless you're deliberately using additional software that REQUIRES this setting, you may not need it enabled.");
|
141 | 153 | }
|
@@ -166,7 +178,7 @@ public void execute(@Nullable GeyserSession session, GeyserCommandSource sender,
|
166 | 178 | String connectionTestMotd = "Geyser Connection Test " + randomStr;
|
167 | 179 | CONNECTION_TEST_MOTD = connectionTestMotd;
|
168 | 180 |
|
169 |
| - sender.sendMessage("Testing server connection now. Please wait..."); |
| 181 | + sender.sendMessage("Testing server connection to " + ip + " with port: " + port + " now. Please wait..."); |
170 | 182 | JsonNode output;
|
171 | 183 | try {
|
172 | 184 | String hostname = URLEncoder.encode(ip, StandardCharsets.UTF_8);
|
|
0 commit comments