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