Make tests compile

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2022-12-07 18:21:28 +01:00
parent 1a606285c0
commit 220217fcc1
3 changed files with 16 additions and 13 deletions

View File

@ -1918,7 +1918,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
* @return a {@link PlayerInfoRemovePacket} to remove the player * @return a {@link PlayerInfoRemovePacket} to remove the player
*/ */
protected @NotNull PlayerInfoRemovePacket getRemovePlayerToList() { protected @NotNull PlayerInfoRemovePacket getRemovePlayerToList() {
return new PlayerInfoRemovePacket(List.of(getUuid())); return new PlayerInfoRemovePacket(getUuid());
} }
private PlayerInfoUpdatePacket.Entry infoEntry() { private PlayerInfoUpdatePacket.Entry infoEntry() {

View File

@ -9,6 +9,10 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public record PlayerInfoRemovePacket(@NotNull List<@NotNull UUID> uuids) implements ServerPacket { public record PlayerInfoRemovePacket(@NotNull List<@NotNull UUID> uuids) implements ServerPacket {
public PlayerInfoRemovePacket(@NotNull UUID uuid) {
this(List.of(uuid));
}
public PlayerInfoRemovePacket { public PlayerInfoRemovePacket {
uuids = List.copyOf(uuids); uuids = List.copyOf(uuids);
} }

View File

@ -7,6 +7,7 @@ import net.minestom.server.coordinate.Vec;
import net.minestom.server.entity.EquipmentSlot; import net.minestom.server.entity.EquipmentSlot;
import net.minestom.server.entity.GameMode; import net.minestom.server.entity.GameMode;
import net.minestom.server.entity.Metadata; import net.minestom.server.entity.Metadata;
import net.minestom.server.entity.PlayerSkin;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material; import net.minestom.server.item.Material;
import net.minestom.server.network.packet.client.ClientPacket; import net.minestom.server.network.packet.client.ClientPacket;
@ -110,18 +111,16 @@ public class PacketWriteReadTest {
SERVER_PACKETS.add(new EntityPropertiesPacket(5, List.of())); SERVER_PACKETS.add(new EntityPropertiesPacket(5, List.of()));
SERVER_PACKETS.add(new EntityRotationPacket(5, 45f, 45f, false)); SERVER_PACKETS.add(new EntityRotationPacket(5, 45f, 45f, false));
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.UPDATE_DISPLAY_NAME, final PlayerSkin skin = new PlayerSkin("hh", "hh");
new PlayerInfoPacket.UpdateDisplayName(UUID.randomUUID(), COMPONENT))); List<PlayerInfoUpdatePacket.Property> prop = List.of(new PlayerInfoUpdatePacket.Property("textures", skin.textures(), skin.signature()));
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.UPDATE_DISPLAY_NAME, var entry = new PlayerInfoUpdatePacket.Entry(UUID.randomUUID(), "TheMode911", prop,
new PlayerInfoPacket.UpdateDisplayName(UUID.randomUUID(), (Component) null))); true, 5, GameMode.CREATIVE, Component.text("display"));
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.UPDATE_GAMEMODE,
new PlayerInfoPacket.UpdateGameMode(UUID.randomUUID(), GameMode.CREATIVE))); SERVER_PACKETS.add(new PlayerInfoUpdatePacket(PlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, entry));
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.UPDATE_LATENCY, SERVER_PACKETS.add(new PlayerInfoUpdatePacket(PlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, entry));
new PlayerInfoPacket.UpdateLatency(UUID.randomUUID(), 5))); SERVER_PACKETS.add(new PlayerInfoUpdatePacket(PlayerInfoUpdatePacket.Action.UPDATE_LATENCY, entry));
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.ADD_PLAYER, SERVER_PACKETS.add(new PlayerInfoUpdatePacket(PlayerInfoUpdatePacket.Action.UPDATE_LISTED, entry));
new PlayerInfoPacket.AddPlayer(UUID.randomUUID(), "TheMode911", SERVER_PACKETS.add(new PlayerInfoRemovePacket(UUID.randomUUID()));
List.of(new PlayerInfoPacket.AddPlayer.Property("name", "value")), GameMode.CREATIVE, 5, COMPONENT, null)));
SERVER_PACKETS.add(new PlayerInfoPacket(PlayerInfoPacket.Action.REMOVE_PLAYER, new PlayerInfoPacket.RemovePlayer(UUID.randomUUID())));
//SERVER_PACKETS.add(new MultiBlockChangePacket(5,5,5,true, new long[]{0,5,543534,1321})); //SERVER_PACKETS.add(new MultiBlockChangePacket(5,5,5,true, new long[]{0,5,543534,1321}));
} }