Fix entity destruction packet write method in HoverText.java

Updated the destroyPacket to utilize getIntLists(). This change ensures proper handling of entity IDs in line with the necessary method for destroying entities.
This commit is contained in:
Teriuihi 2024-10-20 19:34:48 +02:00
parent 3411a38946
commit 6c6a87e6c2

View File

@ -10,6 +10,7 @@ import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import lombok.extern.slf4j.Slf4j;
import org.bukkit.Location;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@ -40,7 +41,7 @@ public class HoverText {
.write(2, location.getZ());
spawnPacket.getIntegers().write(1, 78); // Armor Stand type
PacketContainer destroyPacket = protocolManager.createPacket(PacketType.Play.Server.ENTITY_DESTROY);
destroyPacket.getIntegers().write(0, entityId);
destroyPacket.getIntLists().write(0, List.of(entityId));
return Optional.of(new LeaderboardLineEntity(entityId, spawnPacket, destroyPacket));
} catch (Exception e) {
log.error("Failed to create hover text entity", e);