Skip to content

Commit

Permalink
Update connectiontest command usage, adapt /ping command to work the …
Browse files Browse the repository at this point in the history
…same way
  • Loading branch information
onebeastchris committed Nov 1, 2023
1 parent 541eff7 commit 97d7d75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
20 changes: 14 additions & 6 deletions src/main/java/org/geysermc/discordbot/commands/PingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ public class PingCommand extends SlashCommand {
public PingCommand() {
this.name = "ping";
this.aliases = new String[] { "status" };
this.arguments = "<server>";
this.arguments = "<ip> [port]";
this.help = "Ping a server to check if its accessible";
this.guildOnly = false;

this.options = Collections.singletonList(
new OptionData(OptionType.STRING, "server", "The IP Address of the server you want to ping", true)
this.options = List.of(
new OptionData(OptionType.STRING, "ip", "The IP Address of the server you want to ping", true),
new OptionData(OptionType.INTEGER, "port", "The port of the server you want to ping", false)
);
}

Expand All @@ -72,8 +73,10 @@ protected void execute(SlashCommandEvent event) {
// Defer to wait for us to load a response and allows for files to be uploaded
InteractionHook interactionHook = event.deferReply().complete();

String ip = event.getOption("server").getAsString();

String ip = event.getOption("ip").getAsString();
if (event.getOption("port") != null) {
ip += ":" + event.getOption("port").getAsInt();
}
interactionHook.editOriginalEmbeds(handle(ip)).queue();
}

Expand All @@ -87,7 +90,12 @@ protected void execute(CommandEvent event) {
return;
}

event.getMessage().replyEmbeds(handle(args.get(0))).queue();
String ip = args.get(0);
if (args.size() > 1) {
ip += ":" + args.get(1);
}

event.getMessage().replyEmbeds(handle(ip)).queue();
}

private MessageEmbed handle(String ip) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/tags/errors/unabletoconnect.tag
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ issues: Unable to connect to world

This means that the Bedrock client cannot find the server specified.
If you have not already, follow our [setup instructions](https://wiki.geysermc.org/geyser/setup/). Then, check the server console for any errors.
To verify Bedrock clients can connect, you can try running the `geyser connectiontest <ip>:<port>` command with your server IP and Geyser port.
To verify Bedrock clients can connect, you can try running the `geyser connectiontest <ip> <port>` command with your server IP and Geyser port.

Additionally, there are various fixes for this on our wiki, please see [here](https://wiki.geysermc.org/geyser/fixing-unable-to-connect-to-world/).
4 changes: 2 additions & 2 deletions src/main/resources/tags/util/connectiontest.tag
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ aliases: test, serverstatus

To check whether Bedrock players can connect or if port forwarding for Geyser is working, run the following command in your Minecraft server console:

`geyser connectiontest <ip>:<port>`
`geyser connectiontest <ip> <port>`

For example, if your server is running on the IP 12.34.56.78 and port 19132, you would run `geyser connectiontest 12.34.56.78:19132`.
For example, if your server is running on the IP 12.34.56.78 and port 19132, you would run `geyser connectiontest 12.34.56.78 19132`.

0 comments on commit 97d7d75

Please sign in to comment.