Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-01 22:23:56 +01:00
parent 9d26fa8137
commit 9083f87153
4 changed files with 5 additions and 9 deletions

View File

@ -6,7 +6,7 @@ import net.minestom.server.utils.binary.BinaryReader;
import net.minestom.server.utils.binary.BinaryWriter;
import org.jetbrains.annotations.NotNull;
public record ChangeGameStatePacket(Reason reason, float value) implements ServerPacket {
public record ChangeGameStatePacket(@NotNull Reason reason, float value) implements ServerPacket {
public ChangeGameStatePacket(BinaryReader reader) {
this(Reason.values()[reader.readByte()], reader.readFloat());
}

View File

@ -6,7 +6,7 @@ import net.minestom.server.utils.binary.BinaryReader;
import net.minestom.server.utils.binary.BinaryWriter;
import org.jetbrains.annotations.NotNull;
public record ExplosionPacket(float x, float y, float z, float radius, byte[] records,
public record ExplosionPacket(float x, float y, float z, float radius, byte @NotNull [] records,
float playerMotionX, float playerMotionY, float playerMotionZ) implements ServerPacket {
public ExplosionPacket(BinaryReader reader) {
this(reader.readFloat(), reader.readFloat(), reader.readFloat(),
@ -21,7 +21,7 @@ public record ExplosionPacket(float x, float y, float z, float radius, byte[] re
writer.writeFloat(z);
writer.writeFloat(radius);
writer.writeVarInt(records.length / 3); // each record is 3 bytes long
for (byte record : records) writer.writeByte(record);
writer.writeBytes(records);
writer.writeFloat(playerMotionX);
writer.writeFloat(playerMotionY);
writer.writeFloat(playerMotionZ);

View File

@ -15,8 +15,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public record ChunkData(NBTCompound heightmaps, byte[] data,
Map<Integer, Block> blockEntities) implements Writeable {
public record ChunkData(@NotNull NBTCompound heightmaps, byte @NotNull [] data,
@NotNull Map<Integer, Block> blockEntities) implements Writeable {
public ChunkData {
heightmaps = heightmaps.deepClone();
data = data.clone();

View File

@ -8,7 +8,6 @@ import net.minestom.server.MinecraftServer;
import net.minestom.server.adventure.audience.PacketGroupingAudience;
import net.minestom.server.entity.LivingEntity;
import net.minestom.server.entity.Player;
import net.minestom.server.network.ConnectionManager;
import net.minestom.server.network.packet.server.play.TeamsPacket;
import net.minestom.server.network.packet.server.play.TeamsPacket.CollisionRule;
import net.minestom.server.network.packet.server.play.TeamsPacket.NameTagVisibility;
@ -25,9 +24,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
* This object represents a team on a scoreboard that has a common display theme and other properties.
*/
public class Team implements PacketGroupingAudience {
private static final ConnectionManager CONNECTION_MANAGER = MinecraftServer.getConnectionManager();
private static final byte ALLOW_FRIENDLY_FIRE_BIT = 0x01;
private static final byte SEE_INVISIBLE_PLAYERS_BIT = 0x02;