fix: use formatter args in Check calls

This commit is contained in:
mworzala 2024-02-24 19:43:30 -05:00
parent fb7e4b10e0
commit a5e0641444
No known key found for this signature in database
GPG Key ID: B148F922E64797C7
2 changed files with 3 additions and 3 deletions

View File

@ -172,7 +172,7 @@ public final class NetworkBuffer {
public <T> @NotNull List<@NotNull T> readCollection(@NotNull Type<T> type, int maxSize) {
final int size = read(VAR_INT);
Check.argCondition(size > maxSize, "Collection size (" + size + ") is higher than the maximum allowed size (" + maxSize + ")");
Check.argCondition(size > maxSize, "Collection size ({0}) is higher than the maximum allowed size ({1})", size, maxSize);
final List<T> values = new java.util.ArrayList<>(size);
for (int i = 0; i < size; i++) {
values.add(read(type));
@ -182,7 +182,7 @@ public final class NetworkBuffer {
public <T> @NotNull List<@NotNull T> readCollection(@NotNull Function<@NotNull NetworkBuffer, @NotNull T> function, int maxSize) {
final int size = read(VAR_INT);
Check.argCondition(size > maxSize, "Collection size (" + size + ") is higher than the maximum allowed size (" + maxSize + ")");
Check.argCondition(size > maxSize, "Collection size ({0}) is higher than the maximum allowed size ({1})", size, maxSize);
final List<T> values = new java.util.ArrayList<>(size);
for (int i = 0; i < size; i++) {
values.add(function.apply(this));

View File

@ -221,7 +221,7 @@ final class NetworkBufferTypes {
buffer -> {
final int length = buffer.read(VAR_INT);
final int remaining = buffer.nioBuffer.limit() - buffer.readIndex();
Check.argCondition(length > remaining, "String is too long (length: " + length + ", readable: " + remaining + ")");
Check.argCondition(length > remaining, "String is too long (length: {0}, readable: {1})", length, remaining);
byte[] bytes = new byte[length];
buffer.nioBuffer.get(buffer.readIndex(), bytes);
buffer.readIndex += length;