Remove broken command '/craftaro myip`

The API endpoint doesn't exist anymore.
The command is part of the old SongodaAuth license system.
This commit is contained in:
Christian Koop 2023-06-09 14:40:35 +02:00
parent c6d688b6b7
commit 1998fd7ff9
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
3 changed files with 1 additions and 76 deletions

View File

@ -8,7 +8,6 @@ import com.songoda.core.core.PluginInfo;
import com.songoda.core.core.PluginInfoModule; import com.songoda.core.core.PluginInfoModule;
import com.songoda.core.core.SongodaCoreCommand; import com.songoda.core.core.SongodaCoreCommand;
import com.songoda.core.core.SongodaCoreDiagCommand; import com.songoda.core.core.SongodaCoreDiagCommand;
import com.songoda.core.core.SongodaCoreIPCommand;
import com.songoda.core.core.SongodaCoreLicenseCommand; import com.songoda.core.core.SongodaCoreLicenseCommand;
import com.songoda.core.core.SongodaCoreUUIDCommand; import com.songoda.core.core.SongodaCoreUUIDCommand;
import com.songoda.core.verification.CraftaroProductVerification; import com.songoda.core.verification.CraftaroProductVerification;
@ -195,7 +194,7 @@ public class SongodaCore {
private void init() { private void init() {
shadingListener = new ShadedEventListener(); shadingListener = new ShadedEventListener();
commandManager.registerCommandDynamically(new SongodaCoreCommand()) commandManager.registerCommandDynamically(new SongodaCoreCommand())
.addSubCommands(new SongodaCoreDiagCommand(), new SongodaCoreIPCommand(), new SongodaCoreUUIDCommand(), new SongodaCoreLicenseCommand()); .addSubCommands(new SongodaCoreDiagCommand(), new SongodaCoreUUIDCommand(), new SongodaCoreLicenseCommand());
Bukkit.getPluginManager().registerEvents(loginListener, piggybackedPlugin); Bukkit.getPluginManager().registerEvents(loginListener, piggybackedPlugin);
Bukkit.getPluginManager().registerEvents(shadingListener, piggybackedPlugin); Bukkit.getPluginManager().registerEvents(shadingListener, piggybackedPlugin);

View File

@ -25,7 +25,6 @@ public class SongodaCoreCommand extends AbstractCommand {
guiManager.showGUI((Player) sender, new SongodaCoreOverviewGUI()); guiManager.showGUI((Player) sender, new SongodaCoreOverviewGUI());
} else { } else {
sender.sendMessage("/craftaro diag"); sender.sendMessage("/craftaro diag");
sender.sendMessage("/craftaro myip");
sender.sendMessage("/craftaro uuid"); sender.sendMessage("/craftaro uuid");
sender.sendMessage("/craftaro license"); sender.sendMessage("/craftaro license");
} }

View File

@ -1,73 +0,0 @@
package com.songoda.core.core;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.core.utils.SongodaAuth;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.List;
public class SongodaCoreIPCommand extends AbstractCommand {
public SongodaCoreIPCommand() {
super(CommandType.CONSOLE_OK, "myip");
}
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
Thread thread = new Thread(() -> {
String ip = SongodaAuth.getIP();
sender.sendMessage("");
sender.sendMessage("IP Information");
sender.sendMessage("");
if (sender instanceof Player) {
TextComponent component = new TextComponent("Your public IP is: " + ip);
component.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, ip));
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new BaseComponent[]{new TextComponent("Click to copy")}));
sender.spigot().sendMessage(component);
} else {
sender.sendMessage("Your public IP is: " + ip);
}
sender.sendMessage("");
});
thread.start();
return ReturnType.SUCCESS;
}
@Override
protected List<String> onTab(CommandSender sender, String... args) {
return null;
}
@Override
public String getPermissionNode() {
return "songoda.admin";
}
@Override
public String getSyntax() {
return "/craftaro myip";
}
@Override
public String getDescription() {
return "Displays your public IP address.";
}
}