From 15eab31347858a39732e6e555af33337cd5b6287 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 24 Nov 2013 08:26:40 +1300 Subject: [PATCH] Add painting watcher --- .../watchers/PaintingWatcher.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java new file mode 100644 index 00000000..82ba2258 --- /dev/null +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/PaintingWatcher.java @@ -0,0 +1,33 @@ +package me.libraryaddict.disguise.disguisetypes.watchers; + +import org.bukkit.Art; +import me.libraryaddict.disguise.disguisetypes.Disguise; +import me.libraryaddict.disguise.disguisetypes.FlagWatcher; +import me.libraryaddict.disguise.utilities.DisguiseUtilities; + +public class PaintingWatcher extends FlagWatcher { + private Art painting; + + public PaintingWatcher(Disguise disguise) { + super(disguise); + } + + public Art getPainting() { + return painting; + } + + @Override + public PaintingWatcher clone(Disguise disguise) { + PaintingWatcher watcher = (PaintingWatcher) super.clone(disguise); + watcher.setPainting(getPainting()); + return watcher; + } + + public void setPainting(Art newPainting) { + this.painting = newPainting; + if (getDisguise().getEntity() != null && getDisguise().getWatcher() == this) { + DisguiseUtilities.refreshTrackers(getDisguise().getEntity()); + } + } + +}