Check the current disguise is also the current flagwatcher

This commit is contained in:
libraryaddict 2014-06-04 08:48:47 +12:00
parent 72f8aad151
commit 297dcd351f
3 changed files with 5 additions and 4 deletions

View File

@ -235,7 +235,7 @@ public class FlagWatcher {
}
protected void sendData(int... dataValues) {
if (!DisguiseAPI.isDisguiseInUse(getDisguise()))
if (!DisguiseAPI.isDisguiseInUse(getDisguise()) || getDisguise().getWatcher() != this)
return;
List<WrappedWatchableObject> list = new ArrayList<WrappedWatchableObject>();
for (int data : dataValues) {
@ -322,7 +322,7 @@ public class FlagWatcher {
itemToSend = ReflectionManager.getNmsItem(itemStack);
}
items[slot] = itemStack;
if (DisguiseAPI.isDisguiseInUse(getDisguise())) {
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
slot++;
if (slot > 4)
slot = 0;

View File

@ -3,6 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
@ -30,7 +31,7 @@ public class FallingBlockWatcher extends FlagWatcher {
if (block.getType() == null || block.getType() == Material.AIR) {
block.setType(Material.STONE);
}
if (getDisguise().getEntity() != null && getDisguise().getWatcher() == this) {
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
DisguiseUtilities.refreshTrackers(getDisguise());
}
}

View File

@ -168,7 +168,7 @@ public class LivingWatcher extends FlagWatcher {
public void setMaxHealth(double newHealth) {
this.maxHealth = newHealth;
this.maxHealthSet = true;
if (DisguiseAPI.isDisguiseInUse(getDisguise())) {
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
List<WrappedAttribute> attributes = new ArrayList<WrappedAttribute>();
Builder builder;