Fix entity deaths not displaying properly

This commit is contained in:
libraryaddict
2020-02-19 16:30:25 +13:00
parent cff2dc6e4a
commit 9ed5a41256
4 changed files with 6 additions and 7 deletions

View File

@@ -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);
}

View File

@@ -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();
}
}

View File

@@ -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;
}