3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-01 23:50:11 +02:00

Initial changes

Dieser Commit ist enthalten in:
Tim203 2021-11-30 00:33:53 +01:00
Ursprung eb7d71017c
Commit c0d605dd77
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 064EE9F5BF7C3EE8
3 geänderte Dateien mit 7 neuen und 32 gelöschten Zeilen

Datei anzeigen

@ -91,7 +91,7 @@ public final class AesCipher implements FloodgateCipher {
if (topping != null) {
int mark = buffer.position();
// we need the first index, the second is for the optional RawSkin
// we need the first index, the second is for the actual data
boolean found = false;
while (buffer.hasRemaining() && !found) {
if (buffer.get() == 0x21) {

Datei anzeigen

@ -130,25 +130,18 @@ public interface FloodgateCipher {
final int identifierLength = IDENTIFIER.length;
if (data.length <= HEADER_LENGTH) {
throw new InvalidFormatException("Data length is smaller then header." +
"Needed " + HEADER_LENGTH + ", got " + data.length,
true
throw new InvalidFormatException(
"Data length is smaller then header." +
"Needed " + HEADER_LENGTH + ", got " + data.length
);
}
for (int i = 0; i < identifierLength; i++) {
if (IDENTIFIER[i] != data[i]) {
StringBuilder receivedIdentifier = new StringBuilder();
for (byte b : IDENTIFIER) {
receivedIdentifier.append(b);
}
String identifier = new String(IDENTIFIER, StandardCharsets.UTF_8);
String received = new String(data, 0, IDENTIFIER.length, StandardCharsets.UTF_8);
throw new InvalidFormatException(
String.format("Expected identifier %s, got %s",
new String(IDENTIFIER, StandardCharsets.UTF_8),
receivedIdentifier.toString()
),
true
"Expected identifier " + identifier + ", got " + received
);
}
}

Datei anzeigen

@ -26,26 +26,8 @@
package org.geysermc.floodgate.util;
import lombok.Getter;
@Getter
public class InvalidFormatException extends Exception {
private boolean header = false;
public InvalidFormatException() {
super();
}
public InvalidFormatException(String message) {
super(message);
}
public InvalidFormatException(String message, boolean header) {
super(message);
this.header = header;
}
public InvalidFormatException(String message, Throwable cause) {
super(message, cause);
}
}