diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java new file mode 100644 index 00000000..2fae0844 --- /dev/null +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java @@ -0,0 +1,33 @@ +package me.libraryaddict.disguise.disguisetypes.watchers; + +import org.bukkit.inventory.ItemStack; + +import me.libraryaddict.disguise.disguisetypes.Disguise; +import me.libraryaddict.disguise.disguisetypes.FlagWatcher; +import me.libraryaddict.disguise.utilities.DisguiseUtilities; + +public class FallingBlockWatcher extends FlagWatcher { + private ItemStack block; + + public FallingBlockWatcher(Disguise disguise) { + super(disguise); + } + + public void setBlock(ItemStack block) { + this.block = block; + if (getDisguise().getEntity() != null && getDisguise().getWatcher() == this) { + DisguiseUtilities.refreshTrackers(getDisguise().getEntity()); + } + } + + public ItemStack getBlock() { + return block; + } + + @Override + public FallingBlockWatcher clone(Disguise disguise) { + FallingBlockWatcher watcher = (FallingBlockWatcher) super.clone(disguise); + watcher.setBlock(getBlock()); + return watcher; + } +}