From 56f3c2394920ad28d9a6f21be1793c6785e2b914 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 14 Jul 2014 12:25:48 +1200 Subject: [PATCH] Add setTargets to wither watcher --- .../disguisetypes/watchers/WitherWatcher.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java index 8c2c3756..d030e71b 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/WitherWatcher.java @@ -1,5 +1,9 @@ package me.libraryaddict.disguise.disguisetypes.watchers; +import java.security.InvalidParameterException; + +import org.bukkit.ChatColor; + import me.libraryaddict.disguise.disguisetypes.Disguise; public class WitherWatcher extends LivingWatcher { @@ -17,7 +21,7 @@ public class WitherWatcher extends LivingWatcher { } public void setInvul(int invulnerability) { - setValue(20, invulnerability); + setInvulnerability(invulnerability); } public void setInvulnerability(int invulnerability) { @@ -25,4 +29,19 @@ public class WitherWatcher extends LivingWatcher { sendData(20); } + public void setTargets(int... targets) { + if (targets.length != 3) { + throw new InvalidParameterException(ChatColor.RED + "Expected 3 numbers for wither setTargets. Received " + + targets.length); + } + setValue(17, targets[0]); + setValue(18, targets[1]); + setValue(19, targets[2]); + sendData(17, 18, 19); + } + + public int[] getTargets() { + return new int[] { (Integer) getValue(17, 0), (Integer) getValue(18, 0), (Integer) getValue(19, 0) }; + } + }