Add setTargets to wither watcher
This commit is contained in:
		| @@ -1,5 +1,9 @@ | |||||||
| package me.libraryaddict.disguise.disguisetypes.watchers; | package me.libraryaddict.disguise.disguisetypes.watchers; | ||||||
|  |  | ||||||
|  | import java.security.InvalidParameterException; | ||||||
|  |  | ||||||
|  | import org.bukkit.ChatColor; | ||||||
|  |  | ||||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||||
|  |  | ||||||
| public class WitherWatcher extends LivingWatcher { | public class WitherWatcher extends LivingWatcher { | ||||||
| @@ -17,7 +21,7 @@ public class WitherWatcher extends LivingWatcher { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setInvul(int invulnerability) { |     public void setInvul(int invulnerability) { | ||||||
|         setValue(20, invulnerability); |         setInvulnerability(invulnerability); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setInvulnerability(int invulnerability) { |     public void setInvulnerability(int invulnerability) { | ||||||
| @@ -25,4 +29,19 @@ public class WitherWatcher extends LivingWatcher { | |||||||
|         sendData(20); |         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) }; | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user