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:
libraryaddict 2014-05-23 15:11:20 +12:00
parent 567a84b8dc
commit f3a81a84a4
2 changed files with 17 additions and 17 deletions

@ -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,8 +307,7 @@ 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;
@ -325,6 +324,7 @@ public class FlagWatcher {
} }
} }
} }
}
public void setItemStack(SlotType slot, ItemStack itemStack) { public void setItemStack(SlotType slot, ItemStack itemStack) {
setItemStack(slot.getSlot(), itemStack); setItemStack(slot.getSlot(), itemStack);

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