From a19b3a7833bb6481ee03420db10d6fb249c9c2f7 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 24 Nov 2013 08:26:46 +1300 Subject: [PATCH] Add falling block watcher --- .../watchers/FallingBlockWatcher.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java 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; + } +}