Use Disguise instead of entity id in watcher

This commit is contained in:
Andrew 2013-07-21 15:14:40 +12:00
parent dcb8bc427e
commit ff8542c80a
29 changed files with 108 additions and 59 deletions

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public abstract class AgeableWatcher extends LivingWatcher { public abstract class AgeableWatcher extends LivingWatcher {
public AgeableWatcher(int entityId) { public AgeableWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isAdult() { public boolean isAdult() {

View File

@ -1,11 +1,12 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher; import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class ArrowWatcher extends FlagWatcher { public class ArrowWatcher extends FlagWatcher {
public ArrowWatcher(int entityId) { public ArrowWatcher(Disguise disguise) {
super(entityId); super(disguise);
setValue(16, (byte) 0); setValue(16, (byte) 0);
} }

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class BatWatcher extends LivingWatcher { public class BatWatcher extends LivingWatcher {
public BatWatcher(int entityId) { public BatWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isFlying() { public boolean isFlying() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class BlazeWatcher extends LivingWatcher { public class BlazeWatcher extends LivingWatcher {
public BlazeWatcher(int entityId) { public BlazeWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isBlazing() { public boolean isBlazing() {

View File

@ -1,11 +1,12 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher; import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class BoatWatcher extends FlagWatcher { public class BoatWatcher extends FlagWatcher {
public BoatWatcher(int entityId) { public BoatWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public int getDamage() { public int getDamage() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class ChickenWatcher extends AgeableWatcher { public class ChickenWatcher extends AgeableWatcher {
public ChickenWatcher(int entityId) { public ChickenWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class CowWatcher extends AgeableWatcher { public class CowWatcher extends AgeableWatcher {
public CowWatcher(int entityId) { public CowWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class CreeperWatcher extends LivingWatcher { public class CreeperWatcher extends LivingWatcher {
public CreeperWatcher(int entityId) { public CreeperWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isFused() { public boolean isFused() {

View File

@ -3,12 +3,13 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher; import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class DroppedItemWatcher extends FlagWatcher { public class DroppedItemWatcher extends FlagWatcher {
public DroppedItemWatcher(int entityId) { public DroppedItemWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class EnderDragonWatcher extends LivingWatcher { public class EnderDragonWatcher extends LivingWatcher {
public EnderDragonWatcher(int entityId) { public EnderDragonWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class EndermanWatcher extends LivingWatcher { public class EndermanWatcher extends LivingWatcher {
public EndermanWatcher(int entityId) { public EndermanWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public int getCarriedData() { public int getCarriedData() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class GhastWatcher extends LivingWatcher { public class GhastWatcher extends LivingWatcher {
public GhastWatcher(int entityId) { public GhastWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isAgressive() { public boolean isAgressive() {

View File

@ -2,13 +2,15 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import java.util.Random; import java.util.Random;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Style;
public class HorseWatcher extends AgeableWatcher { public class HorseWatcher extends AgeableWatcher {
public HorseWatcher(int entityId) { public HorseWatcher(Disguise disguise) {
super(entityId); super(disguise);
setValue(20, new Random().nextInt(7)); setValue(20, new Random().nextInt(7));
} }

View File

@ -3,12 +3,13 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher; import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class ItemFrameWatcher extends FlagWatcher { public class ItemFrameWatcher extends FlagWatcher {
public ItemFrameWatcher(int entityId) { public ItemFrameWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {

View File

@ -8,14 +8,14 @@ import net.minecraft.server.v1_6_R2.PotionBrewer;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher; import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class LivingWatcher extends FlagWatcher { public class LivingWatcher extends FlagWatcher {
private HashSet<MobEffect> potionEffects = new HashSet<MobEffect>(); private HashSet<MobEffect> potionEffects = new HashSet<MobEffect>();
public LivingWatcher(int entityId) { public LivingWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public void addPotionEffect(PotionEffect potionEffect) { public void addPotionEffect(PotionEffect potionEffect) {

View File

@ -1,8 +1,10 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class MagmaCubeWatcher extends SlimeWatcher { public class MagmaCubeWatcher extends SlimeWatcher {
public MagmaCubeWatcher(int entityId) { public MagmaCubeWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,11 +1,12 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher; import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class MinecartWatcher extends FlagWatcher { public class MinecartWatcher extends FlagWatcher {
public MinecartWatcher(int entityId) { public MinecartWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public float getDamage() { public float getDamage() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class MushroomCowWatcher extends AgeableWatcher { public class MushroomCowWatcher extends AgeableWatcher {
public MushroomCowWatcher(int entityId) { public MushroomCowWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,12 +1,14 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import org.bukkit.entity.Ocelot; import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Ocelot.Type; import org.bukkit.entity.Ocelot.Type;
public class OcelotWatcher extends AgeableWatcher { public class OcelotWatcher extends AgeableWatcher {
public OcelotWatcher(int entityId) { public OcelotWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public String getOwner() { public String getOwner() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class PigWatcher extends AgeableWatcher { public class PigWatcher extends AgeableWatcher {
public PigWatcher(int entityId) { public PigWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isSaddled() { public boolean isSaddled() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class PigZombieWatcher extends ZombieWatcher { public class PigZombieWatcher extends ZombieWatcher {
public PigZombieWatcher(int entityId) { public PigZombieWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class PlayerWatcher extends LivingWatcher { public class PlayerWatcher extends LivingWatcher {
public PlayerWatcher(int entityId) { public PlayerWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public int getArrowsSticking() { public int getArrowsSticking() {

View File

@ -1,11 +1,12 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.AnimalColor; import me.libraryaddict.disguise.DisguiseTypes.AnimalColor;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class SheepWatcher extends AgeableWatcher { public class SheepWatcher extends AgeableWatcher {
public SheepWatcher(int entityId) { public SheepWatcher(Disguise disguise) {
super(entityId); super(disguise);
setValue(16, (byte) 0); setValue(16, (byte) 0);
} }

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class SkeletonWatcher extends LivingWatcher { public class SkeletonWatcher extends LivingWatcher {
public SkeletonWatcher(int entityId) { public SkeletonWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -2,10 +2,12 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import java.util.Random; import java.util.Random;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class SlimeWatcher extends LivingWatcher { public class SlimeWatcher extends LivingWatcher {
public SlimeWatcher(int entityId) { public SlimeWatcher(Disguise disguise) {
super(entityId); super(disguise);
setValue(16, (byte) (new Random().nextInt(4) + 1)); setValue(16, (byte) (new Random().nextInt(4) + 1));
} }

View File

@ -2,12 +2,14 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import java.util.Random; import java.util.Random;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import org.bukkit.entity.Villager.Profession; import org.bukkit.entity.Villager.Profession;
public class VillagerWatcher extends AgeableWatcher { public class VillagerWatcher extends AgeableWatcher {
public VillagerWatcher(int entityId) { public VillagerWatcher(Disguise disguise) {
super(entityId); super(disguise);
setValue(16, Profession.values()[new Random().nextInt(Profession.values().length)].getId()); setValue(16, Profession.values()[new Random().nextInt(Profession.values().length)].getId());
} }

View File

@ -1,8 +1,10 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class WitherWatcher extends EnderDragonWatcher { public class WitherWatcher extends EnderDragonWatcher {
public WitherWatcher(int entityId) { public WitherWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
} }

View File

@ -1,11 +1,12 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.AnimalColor; import me.libraryaddict.disguise.DisguiseTypes.AnimalColor;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class WolfWatcher extends AgeableWatcher { public class WolfWatcher extends AgeableWatcher {
public WolfWatcher(int entityId) { public WolfWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public AnimalColor getCollarColor() { public AnimalColor getCollarColor() {

View File

@ -1,9 +1,11 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
public class ZombieWatcher extends LivingWatcher { public class ZombieWatcher extends LivingWatcher {
public ZombieWatcher(int entityId) { public ZombieWatcher(Disguise disguise) {
super(entityId); super(disguise);
} }
public boolean isAdult() { public boolean isAdult() {