Check the current disguise is also the current flagwatcher
This commit is contained in:
parent
72f8aad151
commit
297dcd351f
@ -235,7 +235,7 @@ public class FlagWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendData(int... dataValues) {
|
protected void sendData(int... dataValues) {
|
||||||
if (!DisguiseAPI.isDisguiseInUse(getDisguise()))
|
if (!DisguiseAPI.isDisguiseInUse(getDisguise()) || getDisguise().getWatcher() != this)
|
||||||
return;
|
return;
|
||||||
List<WrappedWatchableObject> list = new ArrayList<WrappedWatchableObject>();
|
List<WrappedWatchableObject> list = new ArrayList<WrappedWatchableObject>();
|
||||||
for (int data : dataValues) {
|
for (int data : dataValues) {
|
||||||
@ -322,7 +322,7 @@ public class FlagWatcher {
|
|||||||
itemToSend = ReflectionManager.getNmsItem(itemStack);
|
itemToSend = ReflectionManager.getNmsItem(itemStack);
|
||||||
}
|
}
|
||||||
items[slot] = itemStack;
|
items[slot] = itemStack;
|
||||||
if (DisguiseAPI.isDisguiseInUse(getDisguise())) {
|
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
|
||||||
slot++;
|
slot++;
|
||||||
if (slot > 4)
|
if (slot > 4)
|
||||||
slot = 0;
|
slot = 0;
|
||||||
|
@ -3,6 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
@ -30,7 +31,7 @@ public class FallingBlockWatcher extends FlagWatcher {
|
|||||||
if (block.getType() == null || block.getType() == Material.AIR) {
|
if (block.getType() == null || block.getType() == Material.AIR) {
|
||||||
block.setType(Material.STONE);
|
block.setType(Material.STONE);
|
||||||
}
|
}
|
||||||
if (getDisguise().getEntity() != null && getDisguise().getWatcher() == this) {
|
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
|
||||||
DisguiseUtilities.refreshTrackers(getDisguise());
|
DisguiseUtilities.refreshTrackers(getDisguise());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 (DisguiseAPI.isDisguiseInUse(getDisguise())) {
|
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
|
||||||
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