1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2026-01-06 15:41:50 +00:00

Fix bungeecord dump logs after 9fb5090

This commit is contained in:
rtm516
2021-08-25 11:31:12 +01:00
parent 9fb509010a
commit 65e85eb853
3 changed files with 20 additions and 10 deletions

View File

@@ -52,6 +52,7 @@ import java.net.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
@Getter
public class DumpInfo {
@@ -201,7 +202,7 @@ public class DumpInfo {
public LogsInfo() {
try {
Map<String, String> fields = new HashMap<>();
fields.put("content", String.join("\n", java.nio.file.Files.readAllLines(GeyserConnector.getInstance().getBootstrap().getLogsPath())));
fields.put("content", FileUtils.readAllLines(GeyserConnector.getInstance().getBootstrap().getLogsPath()).collect(Collectors.joining("\n")));
JsonNode logData = GeyserConnector.JSON_MAPPER.readTree(WebUtils.postForm("https://api.mclo.gs/1/log", fields));

View File

@@ -35,10 +35,12 @@ import java.io.*;
import java.lang.annotation.Annotation;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class FileUtils {
@@ -220,7 +222,21 @@ public class FileUtils {
}
return bytes;
} catch (IOException e) {
throw new RuntimeException("Error while trying to read input stream!");
throw new RuntimeException("Error while trying to read input stream!", e);
}
}
/**
* Read the lines of a file and return it as a stream
*
* @param path File path to read
* @return The lines as a stream
*/
public static Stream<String> readAllLines(Path path) {
try {
return new BufferedReader(new InputStreamReader(java.nio.file.Files.newInputStream(path))).lines();
} catch (IOException e) {
throw new RuntimeException("Error while trying to read file!", e);
}
}