mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Minecraft 1.21 (#500)
* 1.21 * address URL constructor deprecation * Update metadata * Update loom to 1.7
This commit is contained in:
1 parent
c9a3f2c35d
commit
6b786911b7
8 files changed
+16
-13
No files matched your search
@@ -27,6 +27,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -98,7 +99,7 @@ public final class CarbonMessageSource implements IMessageSource<Audience, Strin
|
||||
if (sourceUrl.getProtocol().equals("jar")) {
|
||||
final int exclamationIdx = sourceUrl.getPath().lastIndexOf('!');
|
||||
if (exclamationIdx != -1) {
|
||||
sourceUrl = new URL(sourceUrl.getPath().substring(0, exclamationIdx));
|
||||
sourceUrl = URI.create(sourceUrl.getPath().substring(0, exclamationIdx)).toURL();
|
||||
}
|
||||
}
|
||||
return Paths.get(sourceUrl.toURI());
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
@@ -92,7 +93,7 @@ public record UpdateChecker(Logger logger) {
|
||||
|
||||
private Releases fetchReleases() throws IOException {
|
||||
final JsonArray result;
|
||||
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL("https://api.github.com/repos/%s/releases".formatted(GITHUB_REPO)).openStream(), StandardCharsets.UTF_8))) {
|
||||
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(URI.create("https://api.github.com/repos/%s/releases".formatted(GITHUB_REPO)).toURL().openStream(), StandardCharsets.UTF_8))) {
|
||||
result = GSON.fromJson(reader, JsonArray.class);
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ public record UpdateChecker(Logger logger) {
|
||||
}
|
||||
final String classFilePath = resource.toString().replace("\\", "/");
|
||||
final String archivePath = classFilePath.substring(0, classFilePath.length() - classLocation.length());
|
||||
try (final InputStream stream = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) {
|
||||
try (final InputStream stream = URI.create(archivePath + "/META-INF/MANIFEST.MF").toURL().openStream()) {
|
||||
return new Manifest(stream);
|
||||
} catch (final IOException ex) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user