Skip to content

Commit

Permalink
Fix splitting lines on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Sep 18, 2023
1 parent df99e3b commit 41046f8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ public void loadFromString(String file, AuthType authType) {
throw new IllegalArgumentException("Invalid JSON!");
}
} else {
String[] accountLines = file.split("\n");

Arrays.stream(accountLines)
file.lines()
.filter(line -> !line.isBlank())
.distinct()
.map(account -> fromString(account, authType))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public record BlockShapeType(int id, List<BlockShape> blockShapes) {
throw new IllegalStateException("blockshapes.txt not found!");
}

String[] lines = new String(inputStream.readAllBytes()).split("\n");

for (String line : lines) {
new String(inputStream.readAllBytes()).lines().forEach(line -> {
String[] parts = line.split("\\|");

int id = Integer.parseInt(parts[0]);
Expand All @@ -58,7 +56,7 @@ public record BlockShapeType(int id, List<BlockShape> blockShapes) {
}

VALUES.add(new BlockShapeType(id, blockShapes));
}
});
} catch (IOException e) {
throw new IllegalStateException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public class BlockStateLoader {
throw new IllegalStateException("blockstates.txt not found!");
}

String[] lines = new String(inputStream.readAllBytes()).split("\n");

for (String line : lines) {
new String(inputStream.readAllBytes()).lines().forEach(line -> {
String[] parts = line.split("\\|");
String name = parts[0];

Expand All @@ -55,7 +53,7 @@ public class BlockStateLoader {
}

BLOCK_SHAPES.put(name, blockShapeTypes);
}
});
} catch (IOException e) {
throw new IllegalStateException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public void loadFromFile(Path file, ProxyType proxyType) throws IOException {
public void loadFromString(String file, ProxyType proxyType) {
List<SWProxy> newProxies = new ArrayList<>();

String[] proxyLines = file.split("\n");

Arrays.stream(proxyLines)
file.lines()
.filter(line -> !line.isBlank())
.distinct()
.map(line -> fromString(line, proxyType))
Expand Down

0 comments on commit 41046f8

Please sign in to comment.