so hard to fix ;-;

This commit is contained in:
NK 2023-03-06 15:45:36 +00:00
parent 072fcb2568
commit fbd989275c
2 changed files with 8 additions and 16 deletions

View file

@ -10,12 +10,8 @@ import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader; import java.io.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Flipper { public class Flipper {
@ -151,18 +147,14 @@ public class Flipper {
} }
public JsonObject getItemData() throws IOException { public JsonObject getItemData() throws IOException {
URL url = new URL("https://www.night0721.me/api//skyblock"); URL url = new URL("https://www.night0721.me/api/skyblock");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.addRequestProperty("Content-Type", "application/json"); connection.addRequestProperty("Content-Type", "text/plain");
connection.addRequestProperty("User-Agent", "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11");
connection.setDoOutput(true); connection.setDoOutput(true);
connection.setRequestMethod("GET"); connection.setRequestMethod("POST");
OutputStream stream = connection.getOutputStream(); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
JsonObject bd = new JsonObject(); out.write(bytedata);
bd.addProperty("ByteData", bytedata); out.close();
stream.write(bd.toString().getBytes(StandardCharsets.UTF_16));
stream.flush();
stream.close();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine; String inputLine;
StringBuilder content = new StringBuilder(); StringBuilder content = new StringBuilder();

View file

@ -20,7 +20,7 @@ public class ImageRenderer {
} }
@SubscribeEvent @SubscribeEvent
public void onRender(RenderGameOverlayEvent e) { public void onRender(RenderGameOverlayEvent.Post e) {
if (e.type == RenderGameOverlayEvent.ElementType.ALL) { if (e.type == RenderGameOverlayEvent.ElementType.ALL) {
draw(); draw();
} }