Skip to content

Commit

Permalink
Update bridge-asm
Browse files Browse the repository at this point in the history
  • Loading branch information
ME1312 committed Jan 24, 2024
1 parent ba3d615 commit 1c594d5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions java/vanillacord/Downloader.java
Expand Up @@ -92,7 +92,7 @@ public static void main(String[] args) {

MessageDigest sha1;
(sha1 = MessageDigest.getInstance("SHA-1")).update(data);
if (!Digest.isEqual(digest = sha1.digest(), location.getString("sha1"))) {
if (!Digest.equals(digest = sha1.digest(), location.getString("sha1"))) {
throw new IllegalStateException("Downloaded profile is not as expected: SHA-1 checksum: " + Digest.toHex(digest) + " != " + location.getString("sha1"));
}

Expand All @@ -107,7 +107,7 @@ public static void main(String[] args) {
file.close();
if (in.length() != profile.getLong("size")) {
throw new IllegalStateException("Downloaded jarfile is not as expected: File size: " + in.length() + " != " + profile.getLong("size"));
} else if (!Digest.isEqual(digest = sha1.digest(), profile.getString("sha1"))) {
} else if (!Digest.equals(digest = sha1.digest(), profile.getString("sha1"))) {
throw new IllegalStateException("Downloaded jarfile is not as expected: SHA-1 checksum: " + Digest.toHex(digest) + " != " + profile.getString("sha1"));
}
} catch (Throwable e) {
Expand Down
6 changes: 3 additions & 3 deletions java/vanillacord/data/Digest.java
Expand Up @@ -3,7 +3,7 @@
public class Digest {
private Digest() {}

public static boolean isEqual(byte[] digest, String target) {
public static boolean equals(byte[] digest, String target) {
int c, i, d = digest.length, t = target.length();
while (d != 0 && t != 0) {
i = (c = target.charAt(--t)) - ((c >= 'a')? 87 : ((c >= 'A')? 55 : 48));
Expand All @@ -19,8 +19,8 @@ public static boolean isEqual(byte[] digest, String target) {
public static String toHex(byte[] array) {
StringBuilder hex = new StringBuilder(array.length * 2);
for (int c, i = 0; i != array.length;) {
hex.append((char) ((((c = array[i++] & 0xFF) > 0x9F)? 87 : 48) + (c >>> 4)));
hex.append((char) ((((c &= 0x0F) > 0x09)? 87 : 48) + c));
hex.append((char) ((((c = array[i++] & 0xFF) > 0x9F)? 87 : 48) + (c >>> 4)))
.append((char) ((((c &= 0x0F) > 0x09)? 87 : 48) + c));
}
return hex.toString();
}
Expand Down
10 changes: 5 additions & 5 deletions java/vanillacord/data/HierarchyVisitor.java
Expand Up @@ -12,7 +12,7 @@ public class HierarchyVisitor extends HierarchyScanner {
private boolean hasTID;

public HierarchyVisitor(Package file) {
super(file.types);
super(Opcodes.ASM9, file.types);
this.file = file;
}

Expand Down Expand Up @@ -42,23 +42,23 @@ public void visitLdcInsn(Object value) {
if (value instanceof String) {
if ("Server console handler".equals(value)) {
System.out.print("Found the dedicated server: ");
System.out.println(HierarchyVisitor.super.type.getClassName());
System.out.println(HierarchyVisitor.super.name);
file.sources.startup = data;
} else if ("Unexpected hello packet".equals(value)) {
System.out.print("Found the login listener: ");
System.out.println(HierarchyVisitor.super.type.getClassName());
System.out.println(HierarchyVisitor.super.name);
file.sources.login = data;
} else if (hasTID && "Payload may not be larger than 1048576 bytes".equals(value)) {
System.out.print("Found a login extension packet: ");
System.out.println(HierarchyVisitor.super.type.getClassName());
System.out.println(HierarchyVisitor.super.name);
if (file.sources.send == null) {
file.sources.send = data;
} else {
file.sources.receive = data;
}
} else if ("multiplayer.disconnect.incompatible".equals(value) || "multiplayer.disconnect.outdated_server".equals(value) || ((String) value).startsWith("Outdated client! Please use")) {
System.out.print("Found the handshake listener: ");
System.out.println(HierarchyVisitor.super.type.getClassName());
System.out.println(HierarchyVisitor.super.name);
file.sources.handshake = data;
}
}
Expand Down
2 changes: 1 addition & 1 deletion java/vanillacord/server/VanillaCord.java
Expand Up @@ -28,7 +28,7 @@ public class VanillaCord {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), UTF_8))) {
for (String line; (line = reader.readLine()) != null;) {
int start, end;
if (line.lastIndexOf('#', 0) < 0 && (start = line.indexOf('=')) >= 0) {
if (line.lastIndexOf('#', 0) != 0 && (start = line.indexOf('=')) >= 0) {
for (end = start + 1; start != 0 && line.codePointBefore(start) == ' '; --start) {
if (end != line.length() && line.codePointAt(end) == ' ') ++end;
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -9,7 +9,7 @@

<repositories>
<repository>
<id>minecraft-repo></id>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository>
Expand All @@ -26,7 +26,7 @@
</pluginRepositories>

<properties>
<bridge.version>23w51e</bridge.version>
<bridge.version>24w04b</bridge.version>
</properties>

<dependencies>
Expand Down

0 comments on commit 1c594d5

Please sign in to comment.