From 297dcd351f31fd08321c6028af1d89715da4b8dd Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 4 Jun 2014 08:48:47 +1200 Subject: [PATCH] Check the current disguise is also the current flagwatcher --- src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java | 4 ++-- .../disguise/disguisetypes/watchers/FallingBlockWatcher.java | 3 ++- .../disguise/disguisetypes/watchers/LivingWatcher.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index ca33d3d3..52519e1b 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -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 list = new ArrayList(); 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; diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java index 0727bc22..12648745 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java @@ -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()); } } diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java index 1be68c7d..12e6b5f8 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java @@ -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 attributes = new ArrayList(); Builder builder;