Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 23:30:26 +01:00
Fix Checkstyle issue for the umpteenth time...
Dieser Commit ist enthalten in:
Ursprung
4f6d238b39
Commit
501853e807
@ -97,22 +97,6 @@ public enum ProtocolUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String readString(ByteBuf buf) {
|
||||
return readString(buf, DEFAULT_MAX_STRING_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a VarInt length-prefixed UTF-8 string from the {@code buf}, making sure to not go over
|
||||
* {@code cap} size.
|
||||
* @param buf the buffer to read from
|
||||
* @param cap the maximum size of the string, in UTF-8 character length
|
||||
* @return the decoded string
|
||||
*/
|
||||
public static String readString(ByteBuf buf, int cap) {
|
||||
int length = readVarInt(buf);
|
||||
return readString(buf, cap, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a VarInt length-prefixed ASCII string from the {@code buf}, making sure to not go over
|
||||
* {@code cap} size. This method is specialized for select parts of the Minecraft protocol where
|
||||
@ -131,6 +115,22 @@ public enum ProtocolUtils {
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String readString(ByteBuf buf) {
|
||||
return readString(buf, DEFAULT_MAX_STRING_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a VarInt length-prefixed UTF-8 string from the {@code buf}, making sure to not go over
|
||||
* {@code cap} size.
|
||||
* @param buf the buffer to read from
|
||||
* @param cap the maximum size of the string, in UTF-8 character length
|
||||
* @return the decoded string
|
||||
*/
|
||||
public static String readString(ByteBuf buf, int cap) {
|
||||
int length = readVarInt(buf);
|
||||
return readString(buf, cap, length);
|
||||
}
|
||||
|
||||
private static String readString(ByteBuf buf, int cap, int length) {
|
||||
checkFrame(length >= 0, "Got a negative-length string (%s)", length);
|
||||
// `cap` is interpreted as a UTF-8 character length. To cover the full Unicode plane, we must
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren