mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 22:47:49 +01:00
Revert BinaryReader changes
This commit is contained in:
parent
2a6f9a8bc8
commit
a2e2461d22
@ -1,6 +1,6 @@
|
||||
package net.minestom.server.data;
|
||||
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public abstract class DataType<T> {
|
||||
/**
|
||||
* Encodes the data type.
|
||||
* <p>
|
||||
* Be sure that the encoded value can be decoded back using {@link #decode(BinaryBuffer)}.
|
||||
* Be sure that the encoded value can be decoded back using {@link #decode(BinaryReader)}.
|
||||
*
|
||||
* @param writer the data writer
|
||||
* @param value the value to encode
|
||||
@ -31,6 +31,6 @@ public abstract class DataType<T> {
|
||||
* @return the decoded value
|
||||
*/
|
||||
@NotNull
|
||||
public abstract T decode(@NotNull BinaryBuffer reader);
|
||||
public abstract T decode(@NotNull BinaryReader reader);
|
||||
|
||||
}
|
@ -2,7 +2,7 @@ package net.minestom.server.data;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ShortMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ShortOpenHashMap;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -16,8 +16,8 @@ public abstract class SerializableData extends Data {
|
||||
/**
|
||||
* Serializes the data into an array of bytes.
|
||||
* <p>
|
||||
* Use {@link #readIndexedSerializedData(BinaryBuffer)} if {@code indexed} is true,
|
||||
* {@link #readSerializedData(BinaryBuffer, Object2ShortMap)} otherwise with the index map
|
||||
* Use {@link #readIndexedSerializedData(BinaryReader)} if {@code indexed} is true,
|
||||
* {@link #readSerializedData(BinaryReader, Object2ShortMap)} otherwise with the index map
|
||||
* to convert it back to a {@link SerializableData}.
|
||||
*
|
||||
* @param typeToIndexMap the type to index map, will create entries if new types are discovered.
|
||||
@ -32,16 +32,17 @@ public abstract class SerializableData extends Data {
|
||||
* Reads the data of a {@link SerializableData} when you already have the index map.
|
||||
* <p>
|
||||
* WARNING: the data to read should not have any index to read and your index map should be COMPLETE.
|
||||
* Use {@link #readIndexedSerializedData(BinaryBuffer)} if you need to read the header.
|
||||
* @param reader the binary reader
|
||||
* Use {@link #readIndexedSerializedData(BinaryReader)} if you need to read the header.
|
||||
*
|
||||
* @param reader the binary reader
|
||||
* @param typeToIndexMap the index map
|
||||
*/
|
||||
public abstract void readSerializedData(@NotNull BinaryBuffer reader, @NotNull Object2ShortMap<String> typeToIndexMap);
|
||||
public abstract void readSerializedData(@NotNull BinaryReader reader, @NotNull Object2ShortMap<String> typeToIndexMap);
|
||||
|
||||
/**
|
||||
* Serializes the data into an array of bytes.
|
||||
* <p>
|
||||
* Use {@link #readIndexedSerializedData(BinaryBuffer)}
|
||||
* Use {@link #readIndexedSerializedData(BinaryReader)}
|
||||
* to convert it back to a {@link SerializableData}.
|
||||
* <p>
|
||||
* This will create a type index map which will be present in the header.
|
||||
@ -60,7 +61,7 @@ public abstract class SerializableData extends Data {
|
||||
*
|
||||
* @param reader the binary reader
|
||||
*/
|
||||
public void readIndexedSerializedData(@NotNull BinaryBuffer reader) {
|
||||
public void readIndexedSerializedData(@NotNull BinaryReader reader) {
|
||||
final Object2ShortMap<String> typeToIndexMap = SerializableData.readDataIndexes(reader);
|
||||
readSerializedData(reader, typeToIndexMap);
|
||||
}
|
||||
@ -96,13 +97,13 @@ public abstract class SerializableData extends Data {
|
||||
/**
|
||||
* Reads a data index map (type name -> type index).
|
||||
* <p>
|
||||
* Can then be used with {@link SerializableData#readSerializedData(BinaryBuffer, Object2ShortMap)}.
|
||||
* Can then be used with {@link SerializableData#readSerializedData(BinaryReader, Object2ShortMap)}.
|
||||
*
|
||||
* @param binaryReader the reader
|
||||
* @return a map containing the indexes of your data
|
||||
*/
|
||||
@NotNull
|
||||
public static Object2ShortMap<String> readDataIndexes(@NotNull BinaryBuffer binaryReader) {
|
||||
public static Object2ShortMap<String> readDataIndexes(@NotNull BinaryReader binaryReader) {
|
||||
Object2ShortMap<String> typeToIndexMap = new Object2ShortOpenHashMap<>();
|
||||
{
|
||||
final int dataIndexSize = binaryReader.readVarInt();
|
||||
|
@ -5,7 +5,7 @@ import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.utils.PrimitiveConversion;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.utils.validate.Check;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -153,7 +153,7 @@ public class SerializableDataImpl extends SerializableData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSerializedData(@NotNull BinaryBuffer reader, @NotNull Object2ShortMap<String> typeToIndexMap) {
|
||||
public void readSerializedData(@NotNull BinaryReader reader, @NotNull Object2ShortMap<String> typeToIndexMap) {
|
||||
// Map used to convert an index to the class name (opposite of typeToIndexMap)
|
||||
final Short2ObjectMap<String> indexToTypeMap = new Short2ObjectOpenHashMap<>(typeToIndexMap.size());
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -13,7 +13,7 @@ public class BooleanData extends DataType<Boolean> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Boolean decode(@NotNull BinaryBuffer reader) {
|
||||
public Boolean decode(@NotNull BinaryReader reader) {
|
||||
return reader.readBoolean();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -13,7 +13,7 @@ public class ByteData extends DataType<Byte> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Byte decode(@NotNull BinaryBuffer reader) {
|
||||
public Byte decode(@NotNull BinaryReader reader) {
|
||||
return reader.readByte();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class CharacterData extends DataType<Character> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Character decode(@NotNull BinaryBuffer reader) {
|
||||
public Character decode(@NotNull BinaryReader reader) {
|
||||
return reader.readChar();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class DoubleData extends DataType<Double> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Double decode(@NotNull BinaryBuffer reader) {
|
||||
public Double decode(@NotNull BinaryReader reader) {
|
||||
return reader.readDouble();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class FloatData extends DataType<Float> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Float decode(@NotNull BinaryBuffer reader) {
|
||||
public Float decode(@NotNull BinaryReader reader) {
|
||||
return reader.readFloat();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class IntegerData extends DataType<Integer> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Integer decode(@NotNull BinaryBuffer reader) {
|
||||
public Integer decode(@NotNull BinaryReader reader) {
|
||||
return reader.readVarInt();
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import net.kyori.adventure.text.Component;
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.inventory.Inventory;
|
||||
import net.minestom.server.inventory.InventoryType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -27,7 +27,7 @@ public class InventoryData extends DataType<Inventory> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Inventory decode(@NotNull BinaryBuffer reader) {
|
||||
public Inventory decode(@NotNull BinaryReader reader) {
|
||||
final Component title = reader.readComponent();
|
||||
final InventoryType inventoryType = InventoryType.valueOf(reader.readSizedString());
|
||||
final int size = inventoryType.getSize();
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class ItemStackData extends DataType<ItemStack> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemStack decode(@NotNull BinaryBuffer reader) {
|
||||
public ItemStack decode(@NotNull BinaryReader reader) {
|
||||
return reader.readItemStack();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -13,7 +13,7 @@ public class LongData extends DataType<Long> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Long decode(@NotNull BinaryBuffer reader) {
|
||||
public Long decode(@NotNull BinaryReader reader) {
|
||||
return reader.readLong();
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.data.type;
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.data.SerializableData;
|
||||
import net.minestom.server.data.SerializableDataImpl;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class SerializableDataData extends DataType<SerializableData> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SerializableData decode(@NotNull BinaryBuffer reader) {
|
||||
public SerializableData decode(@NotNull BinaryReader reader) {
|
||||
SerializableData serializableData = new SerializableDataImpl();
|
||||
serializableData.readIndexedSerializedData(reader);
|
||||
return serializableData;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class ShortData extends DataType<Short> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Short decode(@NotNull BinaryBuffer reader) {
|
||||
public Short decode(@NotNull BinaryReader reader) {
|
||||
return reader.readShort();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class StringData extends DataType<String> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String decode(@NotNull BinaryBuffer reader) {
|
||||
public String decode(@NotNull BinaryReader reader) {
|
||||
return reader.readSizedString();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -15,7 +15,7 @@ public class UuidType extends DataType<UUID> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public UUID decode(@NotNull BinaryBuffer reader) {
|
||||
public UUID decode(@NotNull BinaryReader reader) {
|
||||
return reader.readUuid();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class BooleanArrayData extends DataType<boolean[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public boolean[] decode(@NotNull BinaryBuffer reader) {
|
||||
public boolean[] decode(@NotNull BinaryReader reader) {
|
||||
boolean[] array = new boolean[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readBoolean();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -13,7 +13,7 @@ public class ByteArrayData extends DataType<byte[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public byte[] decode(@NotNull BinaryBuffer reader) {
|
||||
public byte[] decode(@NotNull BinaryReader reader) {
|
||||
return decodeByteArray(reader);
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class ByteArrayData extends DataType<byte[]> {
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] decodeByteArray(@NotNull BinaryBuffer binaryReader) {
|
||||
public static byte[] decodeByteArray(@NotNull BinaryReader binaryReader) {
|
||||
byte[] array = new byte[binaryReader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = binaryReader.readByte();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -16,7 +16,7 @@ public class CharacterArrayData extends DataType<char[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public char[] decode(@NotNull BinaryBuffer reader) {
|
||||
public char[] decode(@NotNull BinaryReader reader) {
|
||||
char[] array = new char[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readChar();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class DoubleArrayData extends DataType<double[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public double[] decode(@NotNull BinaryBuffer reader) {
|
||||
public double[] decode(@NotNull BinaryReader reader) {
|
||||
double[] array = new double[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readDouble();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class FloatArrayData extends DataType<float[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public float[] decode(@NotNull BinaryBuffer reader) {
|
||||
public float[] decode(@NotNull BinaryReader reader) {
|
||||
float[] array = new float[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readFloat();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,10 +17,10 @@ public class IntegerArrayData extends DataType<int[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public int[] decode(@NotNull BinaryBuffer reader) {
|
||||
public int[] decode(@NotNull BinaryReader reader) {
|
||||
int[] array = new int[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readInt();
|
||||
array[i] = reader.readInteger();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class ItemStackArrayData extends DataType<ItemStack[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemStack[] decode(@NotNull BinaryBuffer reader) {
|
||||
public ItemStack[] decode(@NotNull BinaryReader reader) {
|
||||
ItemStack[] items = new ItemStack[reader.readVarInt()];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i] = reader.readItemStack();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class LongArrayData extends DataType<long[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public long[] decode(@NotNull BinaryBuffer reader) {
|
||||
public long[] decode(@NotNull BinaryReader reader) {
|
||||
long[] array = new long[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readLong();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class ShortArrayData extends DataType<short[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public short[] decode(@NotNull BinaryBuffer reader) {
|
||||
public short[] decode(@NotNull BinaryReader reader) {
|
||||
short[] array = new short[reader.readVarInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = reader.readShort();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.data.type.array;
|
||||
|
||||
import net.minestom.server.data.DataType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class StringArrayData extends DataType<String[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String[] decode(@NotNull BinaryBuffer reader) {
|
||||
public String[] decode(@NotNull BinaryReader reader) {
|
||||
return reader.readSizedStringArray(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import net.minestom.server.coordinate.Vec;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.network.packet.server.play.EntityMetaDataPacket;
|
||||
import net.minestom.server.utils.Direction;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.utils.binary.Readable;
|
||||
import net.minestom.server.utils.binary.Writeable;
|
||||
@ -28,23 +28,23 @@ public class Metadata {
|
||||
// METADATA TYPES
|
||||
|
||||
public static Value<Byte> Byte(byte value) {
|
||||
return new Value<>(TYPE_BYTE, value, writer -> writer.writeByte(value), BinaryBuffer::readByte);
|
||||
return new Value<>(TYPE_BYTE, value, writer -> writer.writeByte(value), BinaryReader::readByte);
|
||||
}
|
||||
|
||||
public static Value<Integer> VarInt(int value) {
|
||||
return new Value<>(TYPE_VARINT, value, writer -> writer.writeVarInt(value), BinaryBuffer::readVarInt);
|
||||
return new Value<>(TYPE_VARINT, value, writer -> writer.writeVarInt(value), BinaryReader::readVarInt);
|
||||
}
|
||||
|
||||
public static Value<Float> Float(float value) {
|
||||
return new Value<>(TYPE_FLOAT, value, writer -> writer.writeFloat(value), BinaryBuffer::readFloat);
|
||||
return new Value<>(TYPE_FLOAT, value, writer -> writer.writeFloat(value), BinaryReader::readFloat);
|
||||
}
|
||||
|
||||
public static Value<String> String(@NotNull String value) {
|
||||
return new Value<>(TYPE_STRING, value, writer -> writer.writeSizedString(value), BinaryBuffer::readSizedString);
|
||||
return new Value<>(TYPE_STRING, value, writer -> writer.writeSizedString(value), BinaryReader::readSizedString);
|
||||
}
|
||||
|
||||
public static Value<Component> Chat(@NotNull Component value) {
|
||||
return new Value<>(TYPE_CHAT, value, writer -> writer.writeComponent(value), BinaryBuffer::readComponent);
|
||||
return new Value<>(TYPE_CHAT, value, writer -> writer.writeComponent(value), BinaryReader::readComponent);
|
||||
}
|
||||
|
||||
public static Value<Component> OptChat(@Nullable Component value) {
|
||||
@ -64,11 +64,11 @@ public class Metadata {
|
||||
}
|
||||
|
||||
public static Value<ItemStack> Slot(@NotNull ItemStack value) {
|
||||
return new Value<>(TYPE_SLOT, value, writer -> writer.writeItemStack(value), BinaryBuffer::readItemStack);
|
||||
return new Value<>(TYPE_SLOT, value, writer -> writer.writeItemStack(value), BinaryReader::readItemStack);
|
||||
}
|
||||
|
||||
public static Value<Boolean> Boolean(boolean value) {
|
||||
return new Value<>(TYPE_BOOLEAN, value, writer -> writer.writeBoolean(value), BinaryBuffer::readBoolean);
|
||||
return new Value<>(TYPE_BOOLEAN, value, writer -> writer.writeBoolean(value), BinaryReader::readBoolean);
|
||||
}
|
||||
|
||||
public static Value<Point> Rotation(@NotNull Point value) {
|
||||
@ -80,7 +80,7 @@ public class Metadata {
|
||||
}
|
||||
|
||||
public static Value<Point> Position(@NotNull Point value) {
|
||||
return new Value<>(TYPE_POSITION, value, writer -> writer.writeBlockPosition(value), BinaryBuffer::readBlockPosition);
|
||||
return new Value<>(TYPE_POSITION, value, writer -> writer.writeBlockPosition(value), BinaryReader::readBlockPosition);
|
||||
}
|
||||
|
||||
public static Value<Point> OptPosition(@Nullable Point value) {
|
||||
@ -268,7 +268,7 @@ public class Metadata {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Entry(BinaryBuffer reader) {
|
||||
public Entry(BinaryReader reader) {
|
||||
this.index = reader.readByte();
|
||||
int type = reader.readVarInt();
|
||||
value = Metadata.read(type, reader);
|
||||
@ -336,7 +336,7 @@ public class Metadata {
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> Value<T> read(int type, BinaryBuffer reader) {
|
||||
private static <T> Value<T> read(int type, BinaryReader reader) {
|
||||
Value<T> value = getCorrespondingNewEmptyValue(type);
|
||||
value.read(reader);
|
||||
return value;
|
||||
@ -347,9 +347,9 @@ public class Metadata {
|
||||
protected final int type;
|
||||
protected T value;
|
||||
protected final Consumer<BinaryWriter> valueWriter;
|
||||
protected final Function<BinaryBuffer, T> readingFunction;
|
||||
protected final Function<BinaryReader, T> readingFunction;
|
||||
|
||||
public Value(int type, T value, @NotNull Consumer<BinaryWriter> valueWriter, @NotNull Function<BinaryBuffer, T> readingFunction) {
|
||||
public Value(int type, T value, @NotNull Consumer<BinaryWriter> valueWriter, @NotNull Function<BinaryReader, T> readingFunction) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
this.valueWriter = valueWriter;
|
||||
@ -363,7 +363,7 @@ public class Metadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
// skip type, will be read somewhere else
|
||||
value = readingFunction.apply(reader);
|
||||
}
|
||||
|
@ -2,13 +2,14 @@ package net.minestom.server.extras.velocity;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.entity.PlayerSkin;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@ -46,16 +47,18 @@ public final class VelocityProxy {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static boolean checkIntegrity(@NotNull BinaryBuffer reader) {
|
||||
public static boolean checkIntegrity(@NotNull BinaryReader reader) {
|
||||
if (!enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final byte[] signature = reader.readBytes(32);
|
||||
|
||||
final var mark = reader.mark();
|
||||
final byte[] data = reader.readBytes(reader.readableBytes());
|
||||
reader.reset(mark);
|
||||
ByteBuffer buf = reader.getBuffer();
|
||||
buf.mark();
|
||||
final byte[] data = new byte[buf.remaining()];
|
||||
buf.get(data);
|
||||
buf.reset();
|
||||
|
||||
try {
|
||||
final Mac mac = Mac.getInstance("HmacSHA256");
|
||||
@ -72,7 +75,7 @@ public final class VelocityProxy {
|
||||
return version == SUPPORTED_FORWARDING_VERSION;
|
||||
}
|
||||
|
||||
public static InetAddress readAddress(@NotNull BinaryBuffer reader) {
|
||||
public static InetAddress readAddress(@NotNull BinaryReader reader) {
|
||||
try {
|
||||
return InetAddress.getByName(reader.readSizedString());
|
||||
} catch (UnknownHostException e) {
|
||||
@ -81,7 +84,7 @@ public final class VelocityProxy {
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayerSkin readSkin(@NotNull BinaryBuffer reader) {
|
||||
public static PlayerSkin readSkin(@NotNull BinaryReader reader) {
|
||||
String skinTexture = null;
|
||||
String skinSignature = null;
|
||||
|
||||
|
@ -10,12 +10,14 @@ import net.minestom.server.network.packet.client.handler.ClientStatusPacketsHand
|
||||
import net.minestom.server.network.packet.client.handshake.HandshakePacket;
|
||||
import net.minestom.server.network.player.NettyPlayerConnection;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.Readable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Responsible for processing client packets.
|
||||
* <p>
|
||||
@ -40,17 +42,18 @@ public final class PacketProcessor {
|
||||
this.playPacketsHandler = new ClientPlayPacketsHandler();
|
||||
}
|
||||
|
||||
public void process(@NotNull NettyPlayerConnection playerConnection, int packetId, BinaryBuffer content) {
|
||||
public void process(@NotNull NettyPlayerConnection playerConnection, int packetId, ByteBuffer body) {
|
||||
if (MinecraftServer.getRateLimit() > 0) {
|
||||
// Increment packet count (checked in PlayerConnection#update)
|
||||
playerConnection.getPacketCounter().incrementAndGet();
|
||||
}
|
||||
BinaryReader binaryReader = new BinaryReader(body);
|
||||
final ConnectionState connectionState = playerConnection.getConnectionState();
|
||||
if (connectionState == ConnectionState.UNKNOWN) {
|
||||
// Should be handshake packet
|
||||
if (packetId == 0) {
|
||||
HandshakePacket handshakePacket = new HandshakePacket();
|
||||
safeRead(playerConnection, handshakePacket, content);
|
||||
safeRead(playerConnection, handshakePacket, binaryReader);
|
||||
handshakePacket.process(playerConnection);
|
||||
}
|
||||
return;
|
||||
@ -59,18 +62,18 @@ public final class PacketProcessor {
|
||||
case PLAY:
|
||||
final Player player = playerConnection.getPlayer();
|
||||
ClientPlayPacket playPacket = (ClientPlayPacket) playPacketsHandler.getPacketInstance(packetId);
|
||||
safeRead(playerConnection, playPacket, content);
|
||||
safeRead(playerConnection, playPacket, binaryReader);
|
||||
assert player != null;
|
||||
player.addPacketToQueue(playPacket);
|
||||
break;
|
||||
case LOGIN:
|
||||
final ClientPreplayPacket loginPacket = (ClientPreplayPacket) loginPacketsHandler.getPacketInstance(packetId);
|
||||
safeRead(playerConnection, loginPacket, content);
|
||||
safeRead(playerConnection, loginPacket, binaryReader);
|
||||
loginPacket.process(playerConnection);
|
||||
break;
|
||||
case STATUS:
|
||||
final ClientPreplayPacket statusPacket = (ClientPreplayPacket) statusPacketsHandler.getPacketInstance(packetId);
|
||||
safeRead(playerConnection, statusPacket, content);
|
||||
safeRead(playerConnection, statusPacket, binaryReader);
|
||||
statusPacket.process(playerConnection);
|
||||
break;
|
||||
}
|
||||
@ -107,14 +110,16 @@ public final class PacketProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link Readable#read(BinaryBuffer)} and catch all the exceptions to be printed using the packet processor logger.
|
||||
* Calls {@link Readable#read(BinaryReader)} and catch all the exceptions to be printed using the packet processor logger.
|
||||
*
|
||||
* @param connection the connection who sent the packet
|
||||
* @param readable the readable interface
|
||||
* @param reader the buffer containing the packet
|
||||
*/
|
||||
private void safeRead(@NotNull PlayerConnection connection, @NotNull Readable readable, @NotNull BinaryBuffer reader) {
|
||||
if (reader.readableBytes() == 0) {
|
||||
private void safeRead(@NotNull PlayerConnection connection, @NotNull Readable readable, @NotNull BinaryReader reader) {
|
||||
final int readableBytes = reader.available();
|
||||
// Check if there is anything to read
|
||||
if (readableBytes == 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.handler;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPacket;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
@ -11,7 +12,7 @@ import java.util.function.Supplier;
|
||||
* Packets are register using {@link #register(int, ClientPacketSupplier)}
|
||||
* (you can override a packet id even if not recommended and not officially supported) and retrieved with {@link #getPacketInstance(int)}.
|
||||
* <p>
|
||||
* If you want to fill the packet from a buffer, consider using {@link Readable#read(net.minestom.server.utils.binary.BinaryBuffer)} after getting the packet instance.
|
||||
* If you want to fill the packet from a buffer, consider using {@link ClientPacket#read(BinaryReader)} after getting the packet instance.
|
||||
*/
|
||||
public class ClientPacketsHandler {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import net.minestom.server.network.packet.client.ClientPreplayPacket;
|
||||
import net.minestom.server.network.packet.server.login.LoginDisconnectPacket;
|
||||
import net.minestom.server.network.player.NettyPlayerConnection;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -31,7 +31,7 @@ public class HandshakePacket implements ClientPreplayPacket {
|
||||
private int nextState;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.protocolVersion = reader.readVarInt();
|
||||
this.serverAddress = reader.readSizedString(BungeeCordProxy.isEnabled() ? Short.MAX_VALUE : 255);
|
||||
this.serverPort = reader.readUnsignedShort();
|
||||
|
@ -10,7 +10,7 @@ import net.minestom.server.network.packet.client.ClientPreplayPacket;
|
||||
import net.minestom.server.network.player.NettyPlayerConnection;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.async.AsyncUtils;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -84,7 +84,7 @@ public class EncryptionResponsePacket implements ClientPreplayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
sharedSecret = ByteArrayData.decodeByteArray(reader);
|
||||
verifyToken = ByteArrayData.decodeByteArray(reader);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import net.minestom.server.network.packet.client.ClientPreplayPacket;
|
||||
import net.minestom.server.network.packet.server.login.LoginDisconnectPacket;
|
||||
import net.minestom.server.network.player.NettyPlayerConnection;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -49,7 +49,7 @@ public class LoginPluginResponsePacket implements ClientPreplayPacket {
|
||||
// Velocity
|
||||
if (VelocityProxy.isEnabled() && channel.equals(VelocityProxy.PLAYER_INFO_CHANNEL)) {
|
||||
if (data != null && data.length > 0) {
|
||||
BinaryBuffer reader = BinaryBuffer.ofArray(data);
|
||||
BinaryReader reader = new BinaryReader(data);
|
||||
success = VelocityProxy.checkIntegrity(reader);
|
||||
if (success) {
|
||||
// Get the real connection address
|
||||
@ -90,7 +90,7 @@ public class LoginPluginResponsePacket implements ClientPreplayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.messageId = reader.readVarInt();
|
||||
this.successful = reader.readBoolean();
|
||||
if (successful) {
|
||||
|
@ -14,7 +14,7 @@ import net.minestom.server.network.packet.server.login.LoginDisconnectPacket;
|
||||
import net.minestom.server.network.packet.server.login.LoginPluginRequestPacket;
|
||||
import net.minestom.server.network.player.NettyPlayerConnection;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -98,7 +98,7 @@ public class LoginStartPacket implements ClientPreplayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.username = reader.readSizedString(16);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.advancements.AdvancementAction;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientAdvancementTabPacket extends ClientPlayPacket {
|
||||
public String tabIdentifier = "";
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.action = AdvancementAction.values()[reader.readVarInt()];
|
||||
|
||||
if (action == AdvancementAction.OPENED_TAB) {
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientAnimationPacket extends ClientPlayPacket {
|
||||
public Player.Hand hand = Player.Hand.MAIN;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.hand = Player.Hand.values()[reader.readVarInt()];
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientChatMessagePacket extends ClientPlayPacket {
|
||||
public String message = "";
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.message = reader.readSizedString(256);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientClickWindowButtonPacket extends ClientPlayPacket {
|
||||
public byte buttonId;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.windowId = reader.readByte();
|
||||
this.buttonId = reader.readByte();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -19,7 +19,7 @@ public class ClientClickWindowPacket extends ClientPlayPacket {
|
||||
public ItemStack item = ItemStack.AIR;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.windowId = reader.readByte();
|
||||
this.stateId = reader.readVarInt();
|
||||
this.slot = reader.readShort();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientCloseWindowPacket extends ClientPlayPacket {
|
||||
public byte windowId;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.windowId = reader.readByte();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientCraftRecipeRequest extends ClientPlayPacket {
|
||||
public boolean makeAll;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.windowId = reader.readByte();
|
||||
this.recipe = reader.readSizedString(256);
|
||||
this.makeAll = reader.readBoolean();
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientCreativeInventoryActionPacket extends ClientPlayPacket {
|
||||
public ItemStack item = ItemStack.AIR;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.slot = reader.readShort();
|
||||
this.item = reader.readItemStack();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -22,7 +22,7 @@ public class ClientEditBookPacket extends ClientPlayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.slot = reader.readVarInt();
|
||||
final int pageLength = reader.readVarInt();
|
||||
this.pages = new String[pageLength];
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientEntityActionPacket extends ClientPlayPacket {
|
||||
public int horseJumpBoost;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.playerId = reader.readVarInt();
|
||||
this.action = Action.values()[reader.readVarInt()];
|
||||
this.horseJumpBoost = reader.readVarInt();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -14,7 +14,7 @@ public class ClientGenerateStructurePacket extends ClientPlayPacket {
|
||||
public boolean keepJigsaws;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.level = reader.readVarInt();
|
||||
this.keepJigsaws = reader.readBoolean();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientHeldItemChangePacket extends ClientPlayPacket {
|
||||
public short slot;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.slot = reader.readShort();
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,7 +17,7 @@ public class ClientInteractEntityPacket extends ClientPlayPacket {
|
||||
public boolean sneaking;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.targetId = reader.readVarInt();
|
||||
this.type = Type.values()[reader.readVarInt()];
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientKeepAlivePacket extends ClientPlayPacket {
|
||||
public long id;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.id = reader.readLong();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientNameItemPacket extends ClientPlayPacket {
|
||||
public String itemName = "";
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.itemName = reader.readSizedString(Short.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientPickItemPacket extends ClientPlayPacket {
|
||||
public int slotToUse;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.slotToUse = reader.readVarInt();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientPlayerAbilitiesPacket extends ClientPlayPacket {
|
||||
public byte flags;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.flags = reader.readByte();
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.instance.block.BlockFace;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -18,7 +18,7 @@ public class ClientPlayerBlockPlacementPacket extends ClientPlayPacket {
|
||||
public boolean insideBlock;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.hand = Player.Hand.values()[reader.readVarInt()];
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.blockFace = BlockFace.values()[reader.readVarInt()];
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.instance.block.BlockFace;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -15,7 +15,7 @@ public class ClientPlayerDiggingPacket extends ClientPlayPacket {
|
||||
public BlockFace blockFace = BlockFace.TOP;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.status = Status.values()[reader.readVarInt()];
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.blockFace = BlockFace.values()[reader.readByte()];
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientPlayerPacket extends ClientPlayPacket {
|
||||
public boolean onGround;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.onGround = reader.readBoolean();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientPlayerPositionAndRotationPacket extends ClientPlayPacket {
|
||||
public boolean onGround;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.x = reader.readDouble();
|
||||
this.y = reader.readDouble();
|
||||
this.z = reader.readDouble();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientPlayerPositionPacket extends ClientPlayPacket {
|
||||
public boolean onGround;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.x = reader.readDouble();
|
||||
this.y = reader.readDouble();
|
||||
this.z = reader.readDouble();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientPlayerRotationPacket extends ClientPlayPacket {
|
||||
public boolean onGround;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.yaw = reader.readFloat();
|
||||
this.pitch = reader.readFloat();
|
||||
this.onGround = reader.readBoolean();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientPluginMessagePacket extends ClientPlayPacket {
|
||||
public byte[] data = new byte[0];
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.channel = reader.readSizedString(256);
|
||||
this.data = reader.readRemainingBytes();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientPongPacket extends ClientPlayPacket {
|
||||
public int id;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.id = reader.readInt();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -13,7 +13,7 @@ public class ClientQueryBlockNbtPacket extends ClientPlayPacket {
|
||||
public Point blockPosition = Vec.ZERO;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.transactionId = reader.readVarInt();
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientQueryEntityNbtPacket extends ClientPlayPacket {
|
||||
public int entityId;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.transactionId = reader.readVarInt();
|
||||
this.entityId = reader.readVarInt();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.resourcepack.ResourcePackStatus;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientResourcePackStatusPacket extends ClientPlayPacket {
|
||||
public ResourcePackStatus result = ResourcePackStatus.SUCCESS;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.result = ResourcePackStatus.values()[reader.readVarInt()];
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientSelectTradePacket extends ClientPlayPacket {
|
||||
public int selectedSlot;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.selectedSlot = reader.readVarInt();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientSetBeaconEffectPacket extends ClientPlayPacket {
|
||||
public int secondaryEffect;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.primaryEffect = reader.readVarInt();
|
||||
this.secondaryEffect = reader.readVarInt();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientSetDisplayedRecipePacket extends ClientPlayPacket {
|
||||
public String recipeId = "";
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.recipeId = reader.readSizedString(256);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientSetRecipeBookStatePacket extends ClientPlayPacket {
|
||||
public boolean filterActive;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.type = BookType.values()[reader.readVarInt()];
|
||||
this.bookOpen = reader.readBoolean();
|
||||
this.filterActive = reader.readBoolean();
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.message.ChatMessageType;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -18,7 +18,7 @@ public class ClientSettingsPacket extends ClientPlayPacket {
|
||||
public boolean disableTextFiltering;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.locale = reader.readSizedString(128);
|
||||
this.viewDistance = reader.readByte();
|
||||
this.chatMessageType = ChatMessageType.fromPacketID(reader.readVarInt());
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientSpectatePacket extends ClientPlayPacket {
|
||||
public UUID targetUuid = new UUID(0,0);
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.targetUuid = reader.readUuid();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -14,7 +14,7 @@ public class ClientStatusPacket extends ClientPlayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.action = Action.values()[reader.readVarInt()];
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientSteerBoatPacket extends ClientPlayPacket {
|
||||
public boolean rightPaddleTurning;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.leftPaddleTurning = reader.readBoolean();
|
||||
this.rightPaddleTurning = reader.readBoolean();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientSteerVehiclePacket extends ClientPlayPacket {
|
||||
public byte flags;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.sideways = reader.readFloat();
|
||||
this.forward = reader.readFloat();
|
||||
this.flags = reader.readByte();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientTabCompletePacket extends ClientPlayPacket {
|
||||
public String text = "";
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.transactionId = reader.readVarInt();
|
||||
this.text = reader.readSizedString(Short.MAX_VALUE);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientTeleportConfirmPacket extends ClientPlayPacket {
|
||||
public int teleportId;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.teleportId = reader.readVarInt();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientUpdateCommandBlockMinecartPacket extends ClientPlayPacket {
|
||||
public boolean trackOutput;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.entityId = reader.readVarInt();
|
||||
this.command = reader.readSizedString(Short.MAX_VALUE);
|
||||
this.trackOutput = reader.readBoolean();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -21,7 +21,7 @@ public class ClientUpdateCommandBlockPacket extends ClientPlayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.command = reader.readSizedString(Short.MAX_VALUE);
|
||||
this.mode = Mode.values()[reader.readVarInt()];
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -16,7 +16,7 @@ public class ClientUpdateSignPacket extends ClientPlayPacket {
|
||||
public String line4 = "";
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.line1 = reader.readSizedString(384);
|
||||
this.line2 = reader.readSizedString(384);
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.Rotation;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -51,7 +51,7 @@ public class ClientUpdateStructureBlockPacket extends ClientPlayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
location = reader.readBlockPosition();
|
||||
action = Action.values()[reader.readVarInt()];
|
||||
mode = Mode.values()[reader.readVarInt()];
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientUseItemPacket extends ClientPlayPacket {
|
||||
public Player.Hand hand = Player.Hand.MAIN;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.hand = Player.Hand.values()[reader.readVarInt()];
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.client.play;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPlayPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -11,7 +11,7 @@ public class ClientVehicleMovePacket extends ClientPlayPacket {
|
||||
public float yaw, pitch;
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.x = reader.readDouble();
|
||||
this.y = reader.readDouble();
|
||||
this.z = reader.readDouble();
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.client.status;
|
||||
|
||||
import net.minestom.server.network.packet.client.ClientPreplayPacket;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -16,7 +16,7 @@ public class LegacyServerListPingPacket implements ClientPreplayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.payload = reader.readByte();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import net.minestom.server.event.server.ClientPingServerEvent;
|
||||
import net.minestom.server.network.packet.client.ClientPreplayPacket;
|
||||
import net.minestom.server.network.packet.server.status.PongPacket;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -38,7 +38,7 @@ public class PingPacket implements ClientPreplayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.number = reader.readLong();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import net.minestom.server.network.packet.client.ClientPreplayPacket;
|
||||
import net.minestom.server.network.packet.server.handshake.ResponsePacket;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.ping.ServerListPingType;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -21,7 +21,7 @@ public class StatusRequestPacket implements ClientPreplayPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.server;
|
||||
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.Readable;
|
||||
import net.minestom.server.utils.binary.Writeable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public interface ServerPacket extends Readable, Writeable {
|
||||
|
||||
@Override
|
||||
default void read(@NotNull BinaryBuffer reader) {
|
||||
default void read(@NotNull BinaryReader reader) {
|
||||
// FIXME: remove when all packets are written and read properly
|
||||
throw new UnsupportedOperationException("WIP: This packet is not set up to be read from Minestom code at the moment.");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.minestom.server.network.packet.server.handshake;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -19,7 +19,7 @@ public class ResponsePacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
jsonResponse = reader.readSizedString();
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import net.minestom.server.extras.MojangAuth;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.network.player.NettyPlayerConnection;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -38,7 +38,7 @@ public class EncryptionRequestPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
reader.readSizedString(); // server id, apparently empty
|
||||
|
||||
publicKey = ByteArrayData.decodeByteArray(reader);
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.server.login;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minestom.server.network.packet.server.ComponentHoldingServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -28,7 +28,7 @@ public class LoginDisconnectPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
kickMessage = reader.readComponent();
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.server.login;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -22,7 +22,7 @@ public class LoginPluginRequestPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
messageId = reader.readVarInt();
|
||||
channel = reader.readSizedString();
|
||||
data = reader.readRemainingBytes();
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.server.login;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -32,7 +32,7 @@ public class LoginSuccessPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
uuid = reader.readUuid();
|
||||
username = reader.readSizedString();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.server.login;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -27,7 +27,7 @@ public class SetCompressionPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
threshold = reader.readVarInt();
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
import net.minestom.server.network.packet.client.play.ClientPlayerDiggingPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -37,7 +37,7 @@ public class AcknowledgePlayerDiggingPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.blockStateId = reader.readVarInt();
|
||||
this.status = ClientPlayerDiggingPacket.Status.values()[reader.readVarInt()];
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -20,7 +20,7 @@ public class ActionBarPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.actionBarText = reader.readComponent();
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,10 @@ import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.network.packet.server.ComponentHoldingServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.*;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.utils.binary.Readable;
|
||||
import net.minestom.server.utils.binary.Writeable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -43,7 +45,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
resetAdvancements = reader.readBoolean();
|
||||
|
||||
int mappingCount = reader.readVarInt();
|
||||
@ -109,7 +111,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
key = reader.readSizedString();
|
||||
value = new Advancement();
|
||||
value.read(reader);
|
||||
@ -146,7 +148,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
boolean hasParent = reader.readBoolean();
|
||||
if (hasParent) {
|
||||
parentIdentifier = reader.readSizedString();
|
||||
@ -198,7 +200,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
title = reader.readComponent();
|
||||
description = reader.readComponent();
|
||||
icon = reader.readItemStack();
|
||||
@ -224,7 +226,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
requirements = reader.readSizedStringArray(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
@ -240,7 +242,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
key = reader.readSizedString();
|
||||
value = new AdvancementProgress();
|
||||
value.read(reader);
|
||||
@ -259,7 +261,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
int count = reader.readVarInt();
|
||||
criteria = new Criteria[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
@ -280,7 +282,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
criterionIdentifier = reader.readSizedString();
|
||||
criterionProgress = new CriterionProgress();
|
||||
criterionProgress.read(reader);
|
||||
@ -299,7 +301,7 @@ public class AdvancementsPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
achieved = reader.readBoolean();
|
||||
if (achieved) {
|
||||
dateOfAchieving = reader.readLong();
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -33,7 +33,7 @@ public class AttachEntityPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
attachedEntityId = reader.readInt();
|
||||
holdingEntityId = reader.readInt();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import net.minestom.server.coordinate.Vec;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -40,7 +40,7 @@ public class BlockActionPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.actionId = reader.readByte();
|
||||
this.actionParam = reader.readByte();
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -32,7 +32,7 @@ public class BlockBreakAnimationPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.entityId = reader.readVarInt();
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.destroyStage = reader.readByte();
|
||||
|
@ -5,7 +5,7 @@ import net.minestom.server.coordinate.Vec;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -34,7 +34,7 @@ public class BlockChangePacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
this.blockPosition = reader.readBlockPosition();
|
||||
this.blockStateId = reader.readVarInt();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.coordinate.Vec;
|
||||
@ -37,7 +37,7 @@ public class BlockEntityDataPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
blockPosition = reader.readBlockPosition();
|
||||
action = reader.readByte();
|
||||
try {
|
||||
|
@ -6,7 +6,7 @@ import net.minestom.server.adventure.AdventurePacketConvertor;
|
||||
import net.minestom.server.network.packet.server.ComponentHoldingServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -62,7 +62,7 @@ public class BossBarPacket implements ComponentHoldingServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
uuid = reader.readUuid();
|
||||
action = Action.values()[reader.readVarInt()];
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -29,7 +29,7 @@ public class CameraPacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
cameraId = reader.readVarInt();
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package net.minestom.server.network.packet.server.play;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.binary.BinaryBuffer;
|
||||
import net.minestom.server.utils.binary.BinaryReader;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -22,7 +22,7 @@ public class ChangeGameStatePacket implements ServerPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull BinaryBuffer reader) {
|
||||
public void read(@NotNull BinaryReader reader) {
|
||||
reason = Reason.values()[reader.readByte()];
|
||||
value = reader.readFloat();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user