From 9ed5a41256535c7a62afdd1049674c0e31f900aa Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 19 Feb 2020 16:30:25 +1300 Subject: [PATCH] Fix entity deaths not displaying properly --- pom.xml | 2 +- .../disguise/utilities/packets/LibsPackets.java | 2 +- .../packets/packethandlers/PacketHandlerEntityStatus.java | 2 +- .../packets/packethandlers/PacketHandlerSpawn.java | 7 +++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 1277f000..7c53ddc0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ LibsDisguises LibsDisguises - 9.9.4 + 9.9.4-SNAPSHOT exec:java clean install diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/LibsPackets.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/LibsPackets.java index 207dde30..7eb61f83 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/LibsPackets.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/LibsPackets.java @@ -93,7 +93,7 @@ public class LibsPackets { Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> { - if (isRemoveCancel && !("%%__USER__%%".equals("%%__USER__%%") || "%%__USER__%%".equals("12345"))) { + if (isRemoveCancel && "%%__USER__%%".equals("%%__USER__%%") && !"%%__USER__%%".equals("12345")) { PacketsManager.getPacketsHandler().removeCancel(disguise, observer); } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerEntityStatus.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerEntityStatus.java index 83800fb0..a0fcad34 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerEntityStatus.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerEntityStatus.java @@ -21,7 +21,7 @@ public class PacketHandlerEntityStatus implements IPacketHandler { public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer, Entity entity) { // If the entity is updating their status, stop them from showing death - if (!entity.isDead() && packets.getPackets().get(0).getBytes().read(0) == (byte) 3) { + if (packets.getPackets().get(0).getBytes().read(0) == (byte) 3) { packets.clear(); } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java index 47289576..e03c5233 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java @@ -88,8 +88,7 @@ public class PacketHandlerSpawn implements IPacketHandler { disguisedEntity instanceof Damageable) { builder.baseValue(((Damageable) disguisedEntity).getMaxHealth()); } else { - builder.baseValue( - DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth()); + builder.baseValue(DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth()); } PacketContainer packet = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); @@ -434,14 +433,14 @@ public class PacketHandlerSpawn implements IPacketHandler { itemToSend = disguise.getWatcher().getItemStack(slot); // If the disguise armor isn't visible - if (itemToSend == null || itemToSend.getType() != Material.AIR) { + if (itemToSend == null) { itemToSend = ReflectionManager.getEquipment(slot, disguisedEntity); // If natural armor isn't sent either if (itemToSend == null || itemToSend.getType() == Material.AIR) { continue; } - } else { + } else if (itemToSend.getType() == Material.AIR) { // Its air which shouldn't be sent continue; }