Don't bother checking if watcher is null. If they have a entity, they can't have a null watcher
This commit is contained in:
parent
567a84b8dc
commit
f3a81a84a4
@ -230,7 +230,7 @@ public class FlagWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendData(int data) {
|
protected void sendData(int data) {
|
||||||
if (getDisguise().getWatcher() == null || !DisguiseAPI.isDisguiseInUse(getDisguise()))
|
if (!DisguiseAPI.isDisguiseInUse(getDisguise()))
|
||||||
return;
|
return;
|
||||||
if (!entityValues.containsKey(data) || entityValues.get(data) == null)
|
if (!entityValues.containsKey(data) || entityValues.get(data) == null)
|
||||||
return;
|
return;
|
||||||
@ -307,21 +307,21 @@ public class FlagWatcher {
|
|||||||
if (itemStack != null && itemStack.getTypeId() != 0)
|
if (itemStack != null && itemStack.getTypeId() != 0)
|
||||||
itemToSend = ReflectionManager.getNmsItem(itemStack);
|
itemToSend = ReflectionManager.getNmsItem(itemStack);
|
||||||
items[slot] = itemStack;
|
items[slot] = itemStack;
|
||||||
if (!DisguiseAPI.isDisguiseInUse(getDisguise()))
|
if (DisguiseAPI.isDisguiseInUse(getDisguise())) {
|
||||||
return;
|
slot++;
|
||||||
slot++;
|
if (slot > 4)
|
||||||
if (slot > 4)
|
slot = 0;
|
||||||
slot = 0;
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT);
|
||||||
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT);
|
StructureModifier<Object> mods = packet.getModifier();
|
||||||
StructureModifier<Object> mods = packet.getModifier();
|
mods.write(0, getDisguise().getEntity().getEntityId());
|
||||||
mods.write(0, getDisguise().getEntity().getEntityId());
|
mods.write(1, slot);
|
||||||
mods.write(1, slot);
|
mods.write(2, itemToSend);
|
||||||
mods.write(2, itemToSend);
|
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
|
||||||
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
|
try {
|
||||||
try {
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
} catch (InvocationTargetException e) {
|
||||||
} catch (InvocationTargetException e) {
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ public class LivingWatcher extends FlagWatcher {
|
|||||||
public void setMaxHealth(double newHealth) {
|
public void setMaxHealth(double newHealth) {
|
||||||
this.maxHealth = newHealth;
|
this.maxHealth = newHealth;
|
||||||
this.maxHealthSet = true;
|
this.maxHealthSet = true;
|
||||||
if (getDisguise().getWatcher() != null && DisguiseAPI.isDisguiseInUse(getDisguise())) {
|
if (DisguiseAPI.isDisguiseInUse(getDisguise())) {
|
||||||
PacketContainer packet = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
|
||||||
List<WrappedAttribute> attributes = new ArrayList<WrappedAttribute>();
|
List<WrappedAttribute> attributes = new ArrayList<WrappedAttribute>();
|
||||||
Builder builder;
|
Builder builder;
|
||||||
|
Loading…
Reference in New Issue
Block a user