Fix entity deaths not displaying properly

This commit is contained in:
libraryaddict 2020-02-19 16:30:25 +13:00
parent cff2dc6e4a
commit 9ed5a41256
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
4 changed files with 6 additions and 7 deletions

View File

@ -5,7 +5,7 @@
<!-- A good example on why temporary names for project identification shouldn't be used --> <!-- A good example on why temporary names for project identification shouldn't be used -->
<groupId>LibsDisguises</groupId> <groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId> <artifactId>LibsDisguises</artifactId>
<version>9.9.4</version> <version>9.9.4-SNAPSHOT</version>
<build> <build>
<defaultGoal>exec:java clean install</defaultGoal> <defaultGoal>exec:java clean install</defaultGoal>

View File

@ -93,7 +93,7 @@ public class LibsPackets {
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> { 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); 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, public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer,
Entity entity) { Entity entity) {
// If the entity is updating their status, stop them from showing death // 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(); packets.clear();
} }
} }

View File

@ -88,8 +88,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
disguisedEntity instanceof Damageable) { disguisedEntity instanceof Damageable) {
builder.baseValue(((Damageable) disguisedEntity).getMaxHealth()); builder.baseValue(((Damageable) disguisedEntity).getMaxHealth());
} else { } else {
builder.baseValue( builder.baseValue(DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth());
DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth());
} }
PacketContainer packet = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); PacketContainer packet = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
@ -434,14 +433,14 @@ public class PacketHandlerSpawn implements IPacketHandler {
itemToSend = disguise.getWatcher().getItemStack(slot); itemToSend = disguise.getWatcher().getItemStack(slot);
// If the disguise armor isn't visible // If the disguise armor isn't visible
if (itemToSend == null || itemToSend.getType() != Material.AIR) { if (itemToSend == null) {
itemToSend = ReflectionManager.getEquipment(slot, disguisedEntity); itemToSend = ReflectionManager.getEquipment(slot, disguisedEntity);
// If natural armor isn't sent either // If natural armor isn't sent either
if (itemToSend == null || itemToSend.getType() == Material.AIR) { if (itemToSend == null || itemToSend.getType() == Material.AIR) {
continue; continue;
} }
} else { } else if (itemToSend.getType() == Material.AIR) {
// Its air which shouldn't be sent // Its air which shouldn't be sent
continue; continue;
} }