From 1f5bea5f8eec5f964e13289ea433a74ad253effb Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Wed, 3 May 2023 16:43:16 +0100 Subject: [PATCH] make npcs always have teams --- .../java/lol/pyr/znpcsplus/packets/V1_8Factory.java | 3 ++- .../java/lol/pyr/znpcsplus/packets/V1_9Factory.java | 12 ------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java index af561da..4d1e731 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java @@ -51,12 +51,13 @@ public class V1_8Factory implements PacketFactory { new WrapperPlayServerSpawnEntity(entity.getEntityId(), Optional.of(entity.getUuid()), entity.getType(), location.toVector3d(), location.getPitch(), location.getYaw(), location.getYaw(), 0, Optional.empty())); sendAllMetadata(player, entity, properties); + createTeam(player, entity, properties); } @Override public void destroyEntity(Player player, PacketEntity entity, PropertyHolder properties) { sendPacket(player, new WrapperPlayServerDestroyEntities(entity.getEntityId())); - if (entity.getType() == EntityTypes.PLAYER) removeTeam(player, entity); + removeTeam(player, entity); } @Override diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java index e52f492..2f5fb41 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_9Factory.java @@ -23,16 +23,4 @@ public class V1_9Factory extends V1_8Factory { if (properties.hasProperty(EntityProperty.NAME)) data.addAll(MetadataFactory.get().name(properties.getProperty(EntityProperty.NAME))); sendMetadata(player, entity, data); } - - @Override - public void spawnEntity(Player player, PacketEntity entity, PropertyHolder properties) { - super.spawnEntity(player, entity, properties); - if (properties.hasProperty(EntityProperty.GLOW)) createTeam(player, entity, properties); - } - - @Override - public void destroyEntity(Player player, PacketEntity entity, PropertyHolder properties) { - super.destroyEntity(player, entity, properties); - if (entity.getType() != EntityTypes.PLAYER && properties.hasProperty(EntityProperty.GLOW)) removeTeam(player, entity); - } }