Renamed FlagType to MetaIndex which makes more sense

This commit is contained in:
libraryaddict 2017-02-07 06:12:00 +13:00
parent ad6e67569d
commit 57613dba37
54 changed files with 1694 additions and 1694 deletions

View File

@ -35,7 +35,7 @@ import me.libraryaddict.disguise.commands.UndisguiseEntityCommand;
import me.libraryaddict.disguise.commands.UndisguisePlayerCommand;
import me.libraryaddict.disguise.commands.UndisguiseRadiusCommand;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArrowWatcher;
@ -326,7 +326,7 @@ public class LibsDisguises extends JavaPlugin {
WrappedDataWatcher watcher = WrappedDataWatcher.getEntityWatcher(bukkitEntity);
for (WrappedWatchableObject watch : watcher.getWatchableObjects()) {
FlagType flagType = FlagType.getFlag(watcherClass, watch.getIndex());
MetaIndex flagType = MetaIndex.getFlag(watcherClass, watch.getIndex());
if (flagType == null) {
System.err.println("Error finding the FlagType for " + disguiseType.name() + "! Index " + watch.getIndex()

File diff suppressed because it is too large Load Diff

View File

@ -1,437 +0,0 @@
package me.libraryaddict.disguise.disguisetypes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
import com.comphenix.protocol.wrappers.Vector3F;
import com.comphenix.protocol.wrappers.WrappedBlockData;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractHorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.AreaEffectCloudWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArmorStandWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArrowWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BatWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BlazeWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BoatWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ChestedHorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.CreeperWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EnderCrystalWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EnderDragonWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EndermanWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EvokerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FireworkWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FishingHookWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GhastWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GuardianWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.InsentientWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.IronGolemWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ItemFrameWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LlamaWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.OcelotWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PigWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PolarBearWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.RabbitWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SheepWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ShulkerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SkeletonWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SlimeWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SnowmanWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SpiderWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SplashPotionWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.TNTWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.TameableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VexWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VillagerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VindicatorWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitchWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitherSkullWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitherWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WolfWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieVillagerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
public class FlagType<Y> {
private static FlagType[] _values = new FlagType[0];
public static FlagType<Boolean> AGEABLE_BABY = new FlagType<Boolean>(AgeableWatcher.class, 0, false);
public static FlagType<Integer> AREA_EFFECT_CLOUD_COLOR = new FlagType<Integer>(AreaEffectCloudWatcher.class, 1,
Color.BLACK.asRGB());
public static FlagType<Boolean> AREA_EFFECT_IGNORE_RADIUS = new FlagType<Boolean>(AreaEffectCloudWatcher.class, 2, false);
public static FlagType<Integer> AREA_EFFECT_PARTICLE = new FlagType<Integer>(AreaEffectCloudWatcher.class, 3, 0);
public static FlagType<Integer> AREA_EFFECT_PARTICLE_PARAM_1 = new FlagType<Integer>(AreaEffectCloudWatcher.class, 4, 0);
public static FlagType<Integer> AREA_EFFECT_PARTICLE_PARAM_2 = new FlagType<Integer>(AreaEffectCloudWatcher.class, 5, 0);
public static FlagType<Float> AREA_EFFECT_RADIUS = new FlagType<Float>(AreaEffectCloudWatcher.class, 0, 0F);
public static FlagType<Vector3F> ARMORSTAND_BODY = new FlagType<Vector3F>(ArmorStandWatcher.class, 2, new Vector3F(0, 0, 0));
public static FlagType<Vector3F> ARMORSTAND_HEAD = new FlagType<Vector3F>(ArmorStandWatcher.class, 1, new Vector3F(0, 0, 0));
public static FlagType<Vector3F> ARMORSTAND_LEFT_ARM = new FlagType<Vector3F>(ArmorStandWatcher.class, 3,
new Vector3F(0, 0, 0));
public static FlagType<Vector3F> ARMORSTAND_LEFT_LEG = new FlagType<Vector3F>(ArmorStandWatcher.class, 5,
new Vector3F(0, 0, 0));
public static FlagType<Byte> ARMORSTAND_META = new FlagType<Byte>(ArmorStandWatcher.class, 0, (byte) 0);
public static FlagType<Vector3F> ARMORSTAND_RIGHT_ARM = new FlagType<Vector3F>(ArmorStandWatcher.class, 4,
new Vector3F(0, 0, 0));
public static FlagType<Vector3F> ARMORSTAND_RIGHT_LEG = new FlagType<Vector3F>(ArmorStandWatcher.class, 6,
new Vector3F(0, 0, 0));
public static FlagType<Byte> ARROW_CRITICAL = new FlagType<Byte>(ArrowWatcher.class, 0, (byte) 0);
public static FlagType<Byte> BAT_HANGING = new FlagType<Byte>(BatWatcher.class, 0, (byte) 1);
public static FlagType<Byte> BLAZE_BLAZING = new FlagType<Byte>(BlazeWatcher.class, 0, (byte) 0);
public static FlagType<Float> BOAT_DAMAGE = new FlagType<Float>(BoatWatcher.class, 2, 40F);
public static FlagType<Integer> BOAT_DIRECTION = new FlagType<Integer>(BoatWatcher.class, 1, 0);
public static FlagType<Integer> BOAT_LAST_HIT = new FlagType<Integer>(BoatWatcher.class, 0, 0);
public static FlagType<Boolean> BOAT_LEFT_PADDLING = new FlagType<Boolean>(BoatWatcher.class, 5, false);
public static FlagType<Boolean> BOAT_RIGHT_PADDLING = new FlagType<Boolean>(BoatWatcher.class, 4, false);
public static FlagType<Integer> BOAT_TYPE = new FlagType<Integer>(BoatWatcher.class, 3, 0);
public static FlagType<Boolean> CREEPER_IGNITED = new FlagType<Boolean>(CreeperWatcher.class, 2, false);
public static FlagType<Boolean> CREEPER_POWERED = new FlagType<Boolean>(CreeperWatcher.class, 1, false);
public static FlagType<Integer> CREEPER_STATE = new FlagType<Integer>(CreeperWatcher.class, 0, -1);
public static FlagType<ItemStack> DROPPED_ITEM = new FlagType<ItemStack>(DroppedItemWatcher.class, 0,
new ItemStack(Material.STONE));
public static FlagType<Optional<BlockPosition>> ENDER_CRYSTAL_BEAM = new FlagType<Optional<BlockPosition>>(
EnderCrystalWatcher.class, 0, Optional.<BlockPosition> absent());
public static FlagType<Boolean> ENDER_CRYSTAL_PLATE = new FlagType<Boolean>(EnderCrystalWatcher.class, 1, false);
public static FlagType<Integer> ENDERD_RAGON_PHASE = new FlagType<Integer>(EnderDragonWatcher.class, 0, 0);
public static FlagType<Boolean> ENDERMAN_AGRESSIVE = new FlagType<Boolean>(EndermanWatcher.class, 1, false);
public static FlagType<Optional<WrappedBlockData>> ENDERMAN_ITEM = new FlagType<Optional<WrappedBlockData>>(
EndermanWatcher.class, 0, Optional.<WrappedBlockData> absent());
public static FlagType<Integer> ENTITY_AIR_TICKS = new FlagType<Integer>(FlagWatcher.class, 1, 0);
public static FlagType<String> ENTITY_CUSTOM_NAME = new FlagType<String>(FlagWatcher.class, 2, "");
public static FlagType<Boolean> ENTITY_CUSTOM_NAME_VISIBLE = new FlagType<Boolean>(FlagWatcher.class, 3, false);
public static FlagType<Byte> ENTITY_META = new FlagType<Byte>(FlagWatcher.class, 0, (byte) 0);
public static FlagType<Boolean> ENTITY_NO_GRAVITY = new FlagType<Boolean>(FlagWatcher.class, 5, false);
public static FlagType<Boolean> ENTITY_SILENT = new FlagType<Boolean>(FlagWatcher.class, 4, false);
public static FlagType<Byte> EVOKER_SPELL_TICKS = new FlagType<Byte>(EvokerWatcher.class, 0, (byte) 0);
public static FlagType<BlockPosition> FALLING_BLOCK_POSITION = new FlagType<BlockPosition>(FallingBlockWatcher.class, 0,
BlockPosition.ORIGIN);
public static FlagType<ItemStack> FIREWORK_ITEM = new FlagType<ItemStack>(FireworkWatcher.class, 0,
new ItemStack(Material.AIR));
public static FlagType<Integer> FIREWORK_ATTACHED_ENTITY = new FlagType<Integer>(FireworkWatcher.class, 1, 0);
public static FlagType<Integer> FISHING_HOOK_HOOKED = new FlagType<Integer>(FishingHookWatcher.class, 0, 0);
public static FlagType<Boolean> GHAST_AGRESSIVE = new FlagType<Boolean>(GhastWatcher.class, 0, false);
public static FlagType<Boolean> GUARDIAN_RETRACT_SPIKES = new FlagType<Boolean>(GuardianWatcher.class, 0, false);
public static FlagType<Integer> GUARDIAN_TARGET = new FlagType<Integer>(GuardianWatcher.class, 1, 0);
public static FlagType<Integer> HORSE_ARMOR = new FlagType<Integer>(HorseWatcher.class, 1, 0);
public static FlagType<Boolean> HORSE_CHESTED_CARRYING_CHEST = new FlagType<Boolean>(ChestedHorseWatcher.class, 0, false);
public static FlagType<Integer> HORSE_COLOR = new FlagType<Integer>(HorseWatcher.class, 0, 0);
public static FlagType<Byte> HORSE_META = new FlagType<Byte>(AbstractHorseWatcher.class, 0, (byte) 0);
public static FlagType<Optional<UUID>> HORSE_OWNER = new FlagType<Optional<UUID>>(AbstractHorseWatcher.class, 1,
Optional.<UUID> absent());
public static FlagType<Byte> INSENTIENT_META = new FlagType<Byte>(InsentientWatcher.class, 0, (byte) 0);
public static FlagType<Byte> IRON_GOLEM_PLAYER_CREATED = new FlagType<Byte>(IronGolemWatcher.class, 0, (byte) 0);
public static FlagType<ItemStack> ITEMFRAME_ITEM = new FlagType<ItemStack>(ItemFrameWatcher.class, 0,
new ItemStack(Material.AIR));
public static FlagType<Integer> ITEMFRAME_ROTATION = new FlagType<Integer>(ItemFrameWatcher.class, 1, 0);
public static FlagType<Integer> LIVING_ARROWS = new FlagType<Integer>(LivingWatcher.class, 4, 0);
public static FlagType<Byte> LIVING_HAND = new FlagType<Byte>(LivingWatcher.class, 0, (byte) 0);
public static FlagType<Float> LIVING_HEALTH = new FlagType<Float>(LivingWatcher.class, 1, 1F);
public static FlagType<Boolean> LIVING_POTION_AMBIENT = new FlagType<Boolean>(LivingWatcher.class, 3, false);
public static FlagType<Integer> LIVING_POTIONS = new FlagType<Integer>(LivingWatcher.class, 2, 0);
public static FlagType<Integer> LLAMA_CARPET = new FlagType<Integer>(LlamaWatcher.class, 1, 0);
public static FlagType<Integer> LLAMA_COLOR = new FlagType<Integer>(LlamaWatcher.class, 2, -1);
public static FlagType<Integer> LLAMA_STRENGTH = new FlagType<Integer>(LlamaWatcher.class, 0, 0);
public static FlagType<Integer> MINECART_BLOCK = new FlagType<Integer>(MinecartWatcher.class, 3, 0);
public static FlagType<Boolean> MINECART_BLOCK_VISIBLE = new FlagType<Boolean>(MinecartWatcher.class, 5, false);
public static FlagType<Integer> MINECART_BLOCK_Y = new FlagType<Integer>(MinecartWatcher.class, 4, 0);
public static FlagType<Integer> MINECART_SHAKING_DIRECTION = new FlagType<Integer>(MinecartWatcher.class, 1, 1);
public static FlagType<Float> MINECART_SHAKING_MULITPLIER = new FlagType<Float>(MinecartWatcher.class, 2, 0F);
public static FlagType<Integer> MINECART_SHAKING_POWER = new FlagType<Integer>(MinecartWatcher.class, 0, 0);
public static FlagType<Integer> OCELOT_TYPE = new FlagType<Integer>(OcelotWatcher.class, 0, 0);
public static FlagType<Boolean> PIG_SADDLED = new FlagType<Boolean>(PigWatcher.class, 0, false);
public static FlagType<Integer> PIG_UNKNOWN = new FlagType<Integer>(PigWatcher.class, 1, 0);
public static FlagType<Float> PLAYER_ABSORPTION = new FlagType<Float>(PlayerWatcher.class, 0, 0F);
public static FlagType<Byte> PLAYER_HAND = new FlagType<Byte>(PlayerWatcher.class, 3, (byte) 0);
public static FlagType<Integer> PLAYER_SCORE = new FlagType<Integer>(PlayerWatcher.class, 1, 0);
public static FlagType<Byte> PLAYER_SKIN = new FlagType<Byte>(PlayerWatcher.class, 2, (byte) 127);
public static FlagType<Boolean> POLAR_BEAR_STANDING = new FlagType<Boolean>(PolarBearWatcher.class, 0, false);
public static FlagType<Integer> RABBIT_TYPE = new FlagType<Integer>(RabbitWatcher.class, 0, 0);
public static FlagType<Byte> SHEEP_WOOL = new FlagType<Byte>(SheepWatcher.class, 0, (byte) 0);
public static FlagType<Optional<BlockPosition>> SHULKER_ATTACHED = new FlagType<Optional<BlockPosition>>(ShulkerWatcher.class,
1, Optional.<BlockPosition> absent());
public static FlagType<Byte> SHULKER_COLOR = new FlagType<Byte>(ShulkerWatcher.class, 3, (byte) 10);
public static FlagType<Direction> SHULKER_FACING = new FlagType<Direction>(ShulkerWatcher.class, 0, Direction.DOWN);
public static FlagType<Byte> SHULKER_PEEKING = new FlagType<Byte>(ShulkerWatcher.class, 2, (byte) 0);
public static FlagType<Boolean> SKELETON_SWING_ARMS = new FlagType<Boolean>(SkeletonWatcher.class, 0, false);
public static FlagType<Integer> SLIME_SIZE = new FlagType<Integer>(SlimeWatcher.class, 0, 0);
public static FlagType<Byte> SNOWMAN_DERP = new FlagType<Byte>(SnowmanWatcher.class, 0, (byte) 0);
public static FlagType<Byte> SPIDER_CLIMB = new FlagType<Byte>(SpiderWatcher.class, 0, (byte) 0);
public static FlagType<ItemStack> SPLASH_POTION_ITEM = new FlagType<ItemStack>(SplashPotionWatcher.class, 1,
new ItemStack(Material.SPLASH_POTION)); // Yeah, the '1' isn't a bug. No idea why but MC thinks
// there's a '0' already.
public static FlagType<ItemStack> SPLASH_POTION_ITEM_BAD = new FlagType<ItemStack>(SplashPotionWatcher.class, 0,
new ItemStack(Material.SPLASH_POTION)); // Yeah, the '1' isn't a bug. No
// idea why but MC thinks there's a
// '0' already.
public static FlagType<Byte> TAMEABLE_META = new FlagType<Byte>(TameableWatcher.class, 0, (byte) 0);
public static FlagType<Optional<UUID>> TAMEABLE_OWNER = new FlagType<Optional<UUID>>(TameableWatcher.class, 1,
Optional.<UUID> absent());
public static FlagType<Integer> TIPPED_ARROW_COLOR = new FlagType<Integer>(ArrowWatcher.class, 1, Color.WHITE.asRGB());
public static FlagType<Integer> TNT_FUSE_TICKS = new FlagType<Integer>(TNTWatcher.class, 0, Integer.MAX_VALUE);
public static FlagType<Byte> VEX_ANGRY = new FlagType<Byte>(VexWatcher.class, 0, (byte) 0);
public static FlagType<Integer> VILLAGER_PROFESSION = new FlagType<Integer>(VillagerWatcher.class, 0, 0);
public static FlagType<Byte> VINDICATOR_JOHNNY = new FlagType<Byte>(VindicatorWatcher.class, 0, (byte) 0);
public static FlagType<Boolean> WITCH_AGGRESSIVE = new FlagType<Boolean>(WitchWatcher.class, 0, false);
public static FlagType<Integer> WITHER_INVUL = new FlagType<Integer>(WitherWatcher.class, 3, 0);
public static FlagType<Integer> WITHER_TARGET_1 = new FlagType<Integer>(WitherWatcher.class, 0, 0);
public static FlagType<Integer> WITHER_TARGET_2 = new FlagType<Integer>(WitherWatcher.class, 1, 0);
public static FlagType<Integer> WITHER_TARGET_3 = new FlagType<Integer>(WitherWatcher.class, 2, 0);
public static FlagType<Boolean> WITHER_SKULL_BLUE = new FlagType<Boolean>(WitherSkullWatcher.class, 0, false);
public static FlagType<Boolean> WOLF_BEGGING = new FlagType<Boolean>(WolfWatcher.class, 1, false);
public static FlagType<Integer> WOLF_COLLAR = new FlagType<Integer>(WolfWatcher.class, 2, 14);
public static FlagType<Float> WOLF_DAMAGE = new FlagType<Float>(WolfWatcher.class, 0, 0F);
public static FlagType<Boolean> ZOMBIE_AGGRESSIVE = new FlagType<Boolean>(ZombieWatcher.class, 2, false);
public static FlagType<Boolean> ZOMBIE_BABY = new FlagType<Boolean>(ZombieWatcher.class, 0, false);
public static FlagType<Integer> ZOMBIE_PLACEHOLDER = new FlagType<Integer>(ZombieWatcher.class, 1, 0);
public static FlagType<Integer> ZOMBIE_VILLAGER_PROFESSION = new FlagType<Integer>(ZombieVillagerWatcher.class, 1, 0);
public static FlagType<Boolean> ZOMBIE_VILLAGER_SHAKING = new FlagType<Boolean>(ZombieVillagerWatcher.class, 0, false);
static {
for (FlagType flagType : values()) {
if (flagType.getFlagWatcher() == FlagWatcher.class)
continue;
flagType._index += getNoIndexes(flagType.getFlagWatcher().getSuperclass());
}
// Simple verification for the dev that he's setting up the FlagType's properly.
// All flag types should be from 0 to <Max Number> with no empty numbers.
// All flag types should never occur twice.
HashMap<Class, Integer> maxValues = new HashMap<Class, Integer>();
for (FlagType type : values()) {
if (maxValues.containsKey(type.getFlagWatcher()) && maxValues.get(type.getFlagWatcher()) > type.getIndex())
continue;
maxValues.put(type.getFlagWatcher(), type.getIndex());
}
for (Entry<Class, Integer> entry : maxValues.entrySet()) {
loop:
for (int i = 0; i < entry.getValue(); i++) {
FlagType found = null;
for (FlagType type : values()) {
if (type.getIndex() != i)
continue;
if (!type.getFlagWatcher().isAssignableFrom(entry.getKey()))
continue;
if (found != null) {
System.err.println(entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index "
+ i + " (" + type.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher().getSimpleName()
+ ")");
continue loop;
}
found = type;
}
if (found != null)
continue;
System.err.println(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
}
}
}
public static FlagType getFlag(Class<? extends FlagWatcher> watcherClass, int flagNo) {
for (FlagType type : values()) {
if (type.getIndex() != flagNo)
continue;
if (!type.getFlagWatcher().isAssignableFrom(watcherClass))
continue;
return type;
}
return null;
}
public static ArrayList<FlagType> getFlags(Class<? extends FlagWatcher> watcherClass) {
ArrayList<FlagType> list = new ArrayList<FlagType>();
for (FlagType type : values()) {
if (!type.getFlagWatcher().isAssignableFrom(watcherClass))
continue;
list.add(type);
}
return list;
}
private static int getNoIndexes(Class c) {
int found = 0;
for (FlagType type : values()) {
if (type.getFlagWatcher() != c)
continue;
found++;
}
if (c != FlagWatcher.class) {
found += getNoIndexes(c.getSuperclass());
}
return found;
}
public static FlagType[] values() {
return _values;
}
private Y _defaultValue;
private int _index;
private Class<? extends FlagWatcher> _watcher;
private FlagType(Class<? extends FlagWatcher> watcher, int index, Y defaultValue) {
_index = index;
_watcher = watcher;
_defaultValue = defaultValue;
_values = Arrays.copyOf(_values, _values.length + 1);
_values[_values.length - 1] = this;
}
public Y getDefault() {
return _defaultValue;
}
public Class<? extends FlagWatcher> getFlagWatcher() {
return _watcher;
}
public int getIndex() {
return _index;
}
}

View File

@ -41,7 +41,7 @@ public class FlagWatcher {
public FlagWatcher(Disguise disguise) {
this.disguise = (TargetedDisguise) disguise;
this.setData(FlagType.ENTITY_AIR_TICKS, 0);
this.setData(MetaIndex.ENTITY_AIR_TICKS, 0);
equipment = new LibsEquipment(this);
}
@ -85,7 +85,7 @@ public class FlagWatcher {
// Its sending the air metadata. This is the least commonly sent metadata which all entitys still share.
// I send my custom values if I see this!
if (id == FlagType.ENTITY_AIR_TICKS.getIndex()) {
if (id == MetaIndex.ENTITY_AIR_TICKS.getIndex()) {
sendAllCustom = true;
}
@ -201,7 +201,7 @@ public class FlagWatcher {
}
public String getCustomName() {
return (String) getData(FlagType.ENTITY_CUSTOM_NAME);
return (String) getData(MetaIndex.ENTITY_CUSTOM_NAME);
}
protected TargetedDisguise getDisguise() {
@ -209,7 +209,7 @@ public class FlagWatcher {
}
private boolean getEntityFlag(int byteValue) {
return (getData(FlagType.ENTITY_META) & 1 << byteValue) != 0;
return (getData(MetaIndex.ENTITY_META) & 1 << byteValue) != 0;
}
public EntityEquipment getEquipment() {
@ -228,7 +228,7 @@ public class FlagWatcher {
return equipment.getItem(slot);
}
protected <Y> Y getData(FlagType<Y> flagType) {
protected <Y> Y getData(MetaIndex<Y> flagType) {
if (entityValues.containsKey(flagType.getIndex())) {
return (Y) entityValues.get(flagType.getIndex());
}
@ -248,7 +248,7 @@ public class FlagWatcher {
return getCustomName() != null;
}
protected boolean hasValue(FlagType no) {
protected boolean hasValue(MetaIndex no) {
return entityValues.containsKey(no.getIndex());
}
@ -257,7 +257,7 @@ public class FlagWatcher {
}
public boolean isCustomNameVisible() {
return getData(FlagType.ENTITY_CUSTOM_NAME_VISIBLE);
return getData(MetaIndex.ENTITY_CUSTOM_NAME_VISIBLE);
}
public boolean isEntityAnimationsAdded() {
@ -277,7 +277,7 @@ public class FlagWatcher {
}
public boolean isNoGravity() {
return getData(FlagType.ENTITY_NO_GRAVITY);
return getData(MetaIndex.ENTITY_NO_GRAVITY);
}
public boolean isRightClicking() {
@ -315,21 +315,21 @@ public class FlagWatcher {
}
}
protected void sendData(FlagType... dataValues) {
protected void sendData(MetaIndex... dataValues) {
if (!DisguiseAPI.isDisguiseInUse(getDisguise()) || getDisguise().getWatcher() != this) {
return;
}
List<WrappedWatchableObject> list = new ArrayList<>();
for (FlagType data : dataValues) {
for (MetaIndex data : dataValues) {
if (!entityValues.containsKey(data.getIndex()) || entityValues.get(data.getIndex()) == null) {
continue;
}
Object value = entityValues.get(data.getIndex());
if (isEntityAnimationsAdded() && DisguiseConfig.isMetadataPacketsEnabled() && data == FlagType.ENTITY_META) {
if (isEntityAnimationsAdded() && DisguiseConfig.isMetadataPacketsEnabled() && data == MetaIndex.ENTITY_META) {
value = addEntityAnimations((byte) value, WrappedDataWatcher.getEntityWatcher(disguise.getEntity()).getByte(0));
}
@ -376,14 +376,14 @@ public class FlagWatcher {
getEquipment().setArmorContents(items);
}
protected void setBackupValue(FlagType no, Object value) {
protected void setBackupValue(MetaIndex no, Object value) {
backupEntityValues.put(no.getIndex(), value);
}
public void setBurning(boolean setBurning) {
setEntityFlag(0, setBurning);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
public void setCustomName(String name) {
@ -391,41 +391,41 @@ public class FlagWatcher {
name = name.substring(0, 64);
}
setData(FlagType.ENTITY_CUSTOM_NAME, name);
sendData(FlagType.ENTITY_CUSTOM_NAME);
setData(MetaIndex.ENTITY_CUSTOM_NAME, name);
sendData(MetaIndex.ENTITY_CUSTOM_NAME);
}
public void setCustomNameVisible(boolean display) {
setData(FlagType.ENTITY_CUSTOM_NAME_VISIBLE, display);
sendData(FlagType.ENTITY_CUSTOM_NAME_VISIBLE);
setData(MetaIndex.ENTITY_CUSTOM_NAME_VISIBLE, display);
sendData(MetaIndex.ENTITY_CUSTOM_NAME_VISIBLE);
}
private void setEntityFlag(int byteValue, boolean flag) {
modifiedEntityAnimations[byteValue] = true;
byte b0 = (byte) getData(FlagType.ENTITY_META);
byte b0 = (byte) getData(MetaIndex.ENTITY_META);
if (flag) {
setData(FlagType.ENTITY_META, (byte) (b0 | 1 << byteValue));
setData(MetaIndex.ENTITY_META, (byte) (b0 | 1 << byteValue));
}
else {
setData(FlagType.ENTITY_META, (byte) (b0 & ~(1 << byteValue)));
setData(MetaIndex.ENTITY_META, (byte) (b0 & ~(1 << byteValue)));
}
}
public void setFlyingWithElytra(boolean flying) {
setEntityFlag(7, flying);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
public void setGlowing(boolean glowing) {
setEntityFlag(6, glowing);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
public void setInvisible(boolean setInvis) {
setEntityFlag(5, setInvis);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
/**
@ -506,26 +506,26 @@ public class FlagWatcher {
}
public void setNoGravity(boolean noGravity) {
setData(FlagType.ENTITY_NO_GRAVITY, noGravity);
sendData(FlagType.ENTITY_NO_GRAVITY);
setData(MetaIndex.ENTITY_NO_GRAVITY, noGravity);
sendData(MetaIndex.ENTITY_NO_GRAVITY);
}
public void setRightClicking(boolean setRightClicking) {
setEntityFlag(4, setRightClicking);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
public void setSneaking(boolean setSneaking) {
setEntityFlag(1, setSneaking);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
public void setSprinting(boolean setSprinting) {
setEntityFlag(3, setSprinting);
sendData(FlagType.ENTITY_META);
sendData(MetaIndex.ENTITY_META);
}
protected <Y> void setData(FlagType<Y> id, Y value) {
protected <Y> void setData(MetaIndex<Y> id, Y value) {
if (value == null && id.getDefault() instanceof ItemStack)
throw new IllegalArgumentException("Cannot use null ItemStacks");

View File

@ -0,0 +1,437 @@
package me.libraryaddict.disguise.disguisetypes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
import com.comphenix.protocol.wrappers.Vector3F;
import com.comphenix.protocol.wrappers.WrappedBlockData;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractHorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.AreaEffectCloudWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArmorStandWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArrowWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BatWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BlazeWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BoatWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ChestedHorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.CreeperWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EnderCrystalWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EnderDragonWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EndermanWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EvokerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FireworkWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FishingHookWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GhastWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GuardianWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.InsentientWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.IronGolemWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ItemFrameWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LlamaWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.OcelotWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PigWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PolarBearWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.RabbitWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SheepWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ShulkerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SkeletonWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SlimeWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SnowmanWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SpiderWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SplashPotionWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.TNTWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.TameableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VexWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VillagerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VindicatorWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitchWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitherSkullWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitherWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WolfWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieVillagerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
public class MetaIndex<Y> {
private static MetaIndex[] _values = new MetaIndex[0];
public static MetaIndex<Boolean> AGEABLE_BABY = new MetaIndex<Boolean>(AgeableWatcher.class, 0, false);
public static MetaIndex<Integer> AREA_EFFECT_CLOUD_COLOR = new MetaIndex<Integer>(AreaEffectCloudWatcher.class, 1,
Color.BLACK.asRGB());
public static MetaIndex<Boolean> AREA_EFFECT_IGNORE_RADIUS = new MetaIndex<Boolean>(AreaEffectCloudWatcher.class, 2, false);
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE = new MetaIndex<Integer>(AreaEffectCloudWatcher.class, 3, 0);
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE_PARAM_1 = new MetaIndex<Integer>(AreaEffectCloudWatcher.class, 4, 0);
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE_PARAM_2 = new MetaIndex<Integer>(AreaEffectCloudWatcher.class, 5, 0);
public static MetaIndex<Float> AREA_EFFECT_RADIUS = new MetaIndex<Float>(AreaEffectCloudWatcher.class, 0, 0F);
public static MetaIndex<Vector3F> ARMORSTAND_BODY = new MetaIndex<Vector3F>(ArmorStandWatcher.class, 2, new Vector3F(0, 0, 0));
public static MetaIndex<Vector3F> ARMORSTAND_HEAD = new MetaIndex<Vector3F>(ArmorStandWatcher.class, 1, new Vector3F(0, 0, 0));
public static MetaIndex<Vector3F> ARMORSTAND_LEFT_ARM = new MetaIndex<Vector3F>(ArmorStandWatcher.class, 3,
new Vector3F(0, 0, 0));
public static MetaIndex<Vector3F> ARMORSTAND_LEFT_LEG = new MetaIndex<Vector3F>(ArmorStandWatcher.class, 5,
new Vector3F(0, 0, 0));
public static MetaIndex<Byte> ARMORSTAND_META = new MetaIndex<Byte>(ArmorStandWatcher.class, 0, (byte) 0);
public static MetaIndex<Vector3F> ARMORSTAND_RIGHT_ARM = new MetaIndex<Vector3F>(ArmorStandWatcher.class, 4,
new Vector3F(0, 0, 0));
public static MetaIndex<Vector3F> ARMORSTAND_RIGHT_LEG = new MetaIndex<Vector3F>(ArmorStandWatcher.class, 6,
new Vector3F(0, 0, 0));
public static MetaIndex<Byte> ARROW_CRITICAL = new MetaIndex<Byte>(ArrowWatcher.class, 0, (byte) 0);
public static MetaIndex<Byte> BAT_HANGING = new MetaIndex<Byte>(BatWatcher.class, 0, (byte) 1);
public static MetaIndex<Byte> BLAZE_BLAZING = new MetaIndex<Byte>(BlazeWatcher.class, 0, (byte) 0);
public static MetaIndex<Float> BOAT_DAMAGE = new MetaIndex<Float>(BoatWatcher.class, 2, 40F);
public static MetaIndex<Integer> BOAT_DIRECTION = new MetaIndex<Integer>(BoatWatcher.class, 1, 0);
public static MetaIndex<Integer> BOAT_LAST_HIT = new MetaIndex<Integer>(BoatWatcher.class, 0, 0);
public static MetaIndex<Boolean> BOAT_LEFT_PADDLING = new MetaIndex<Boolean>(BoatWatcher.class, 5, false);
public static MetaIndex<Boolean> BOAT_RIGHT_PADDLING = new MetaIndex<Boolean>(BoatWatcher.class, 4, false);
public static MetaIndex<Integer> BOAT_TYPE = new MetaIndex<Integer>(BoatWatcher.class, 3, 0);
public static MetaIndex<Boolean> CREEPER_IGNITED = new MetaIndex<Boolean>(CreeperWatcher.class, 2, false);
public static MetaIndex<Boolean> CREEPER_POWERED = new MetaIndex<Boolean>(CreeperWatcher.class, 1, false);
public static MetaIndex<Integer> CREEPER_STATE = new MetaIndex<Integer>(CreeperWatcher.class, 0, -1);
public static MetaIndex<ItemStack> DROPPED_ITEM = new MetaIndex<ItemStack>(DroppedItemWatcher.class, 0,
new ItemStack(Material.STONE));
public static MetaIndex<Optional<BlockPosition>> ENDER_CRYSTAL_BEAM = new MetaIndex<Optional<BlockPosition>>(
EnderCrystalWatcher.class, 0, Optional.<BlockPosition> absent());
public static MetaIndex<Boolean> ENDER_CRYSTAL_PLATE = new MetaIndex<Boolean>(EnderCrystalWatcher.class, 1, false);
public static MetaIndex<Integer> ENDERD_RAGON_PHASE = new MetaIndex<Integer>(EnderDragonWatcher.class, 0, 0);
public static MetaIndex<Boolean> ENDERMAN_AGRESSIVE = new MetaIndex<Boolean>(EndermanWatcher.class, 1, false);
public static MetaIndex<Optional<WrappedBlockData>> ENDERMAN_ITEM = new MetaIndex<Optional<WrappedBlockData>>(
EndermanWatcher.class, 0, Optional.<WrappedBlockData> absent());
public static MetaIndex<Integer> ENTITY_AIR_TICKS = new MetaIndex<Integer>(FlagWatcher.class, 1, 0);
public static MetaIndex<String> ENTITY_CUSTOM_NAME = new MetaIndex<String>(FlagWatcher.class, 2, "");
public static MetaIndex<Boolean> ENTITY_CUSTOM_NAME_VISIBLE = new MetaIndex<Boolean>(FlagWatcher.class, 3, false);
public static MetaIndex<Byte> ENTITY_META = new MetaIndex<Byte>(FlagWatcher.class, 0, (byte) 0);
public static MetaIndex<Boolean> ENTITY_NO_GRAVITY = new MetaIndex<Boolean>(FlagWatcher.class, 5, false);
public static MetaIndex<Boolean> ENTITY_SILENT = new MetaIndex<Boolean>(FlagWatcher.class, 4, false);
public static MetaIndex<Byte> EVOKER_SPELL_TICKS = new MetaIndex<Byte>(EvokerWatcher.class, 0, (byte) 0);
public static MetaIndex<BlockPosition> FALLING_BLOCK_POSITION = new MetaIndex<BlockPosition>(FallingBlockWatcher.class, 0,
BlockPosition.ORIGIN);
public static MetaIndex<ItemStack> FIREWORK_ITEM = new MetaIndex<ItemStack>(FireworkWatcher.class, 0,
new ItemStack(Material.AIR));
public static MetaIndex<Integer> FIREWORK_ATTACHED_ENTITY = new MetaIndex<Integer>(FireworkWatcher.class, 1, 0);
public static MetaIndex<Integer> FISHING_HOOK_HOOKED = new MetaIndex<Integer>(FishingHookWatcher.class, 0, 0);
public static MetaIndex<Boolean> GHAST_AGRESSIVE = new MetaIndex<Boolean>(GhastWatcher.class, 0, false);
public static MetaIndex<Boolean> GUARDIAN_RETRACT_SPIKES = new MetaIndex<Boolean>(GuardianWatcher.class, 0, false);
public static MetaIndex<Integer> GUARDIAN_TARGET = new MetaIndex<Integer>(GuardianWatcher.class, 1, 0);
public static MetaIndex<Integer> HORSE_ARMOR = new MetaIndex<Integer>(HorseWatcher.class, 1, 0);
public static MetaIndex<Boolean> HORSE_CHESTED_CARRYING_CHEST = new MetaIndex<Boolean>(ChestedHorseWatcher.class, 0, false);
public static MetaIndex<Integer> HORSE_COLOR = new MetaIndex<Integer>(HorseWatcher.class, 0, 0);
public static MetaIndex<Byte> HORSE_META = new MetaIndex<Byte>(AbstractHorseWatcher.class, 0, (byte) 0);
public static MetaIndex<Optional<UUID>> HORSE_OWNER = new MetaIndex<Optional<UUID>>(AbstractHorseWatcher.class, 1,
Optional.<UUID> absent());
public static MetaIndex<Byte> INSENTIENT_META = new MetaIndex<Byte>(InsentientWatcher.class, 0, (byte) 0);
public static MetaIndex<Byte> IRON_GOLEM_PLAYER_CREATED = new MetaIndex<Byte>(IronGolemWatcher.class, 0, (byte) 0);
public static MetaIndex<ItemStack> ITEMFRAME_ITEM = new MetaIndex<ItemStack>(ItemFrameWatcher.class, 0,
new ItemStack(Material.AIR));
public static MetaIndex<Integer> ITEMFRAME_ROTATION = new MetaIndex<Integer>(ItemFrameWatcher.class, 1, 0);
public static MetaIndex<Integer> LIVING_ARROWS = new MetaIndex<Integer>(LivingWatcher.class, 4, 0);
public static MetaIndex<Byte> LIVING_HAND = new MetaIndex<Byte>(LivingWatcher.class, 0, (byte) 0);
public static MetaIndex<Float> LIVING_HEALTH = new MetaIndex<Float>(LivingWatcher.class, 1, 1F);
public static MetaIndex<Boolean> LIVING_POTION_AMBIENT = new MetaIndex<Boolean>(LivingWatcher.class, 3, false);
public static MetaIndex<Integer> LIVING_POTIONS = new MetaIndex<Integer>(LivingWatcher.class, 2, 0);
public static MetaIndex<Integer> LLAMA_CARPET = new MetaIndex<Integer>(LlamaWatcher.class, 1, 0);
public static MetaIndex<Integer> LLAMA_COLOR = new MetaIndex<Integer>(LlamaWatcher.class, 2, -1);
public static MetaIndex<Integer> LLAMA_STRENGTH = new MetaIndex<Integer>(LlamaWatcher.class, 0, 0);
public static MetaIndex<Integer> MINECART_BLOCK = new MetaIndex<Integer>(MinecartWatcher.class, 3, 0);
public static MetaIndex<Boolean> MINECART_BLOCK_VISIBLE = new MetaIndex<Boolean>(MinecartWatcher.class, 5, false);
public static MetaIndex<Integer> MINECART_BLOCK_Y = new MetaIndex<Integer>(MinecartWatcher.class, 4, 0);
public static MetaIndex<Integer> MINECART_SHAKING_DIRECTION = new MetaIndex<Integer>(MinecartWatcher.class, 1, 1);
public static MetaIndex<Float> MINECART_SHAKING_MULITPLIER = new MetaIndex<Float>(MinecartWatcher.class, 2, 0F);
public static MetaIndex<Integer> MINECART_SHAKING_POWER = new MetaIndex<Integer>(MinecartWatcher.class, 0, 0);
public static MetaIndex<Integer> OCELOT_TYPE = new MetaIndex<Integer>(OcelotWatcher.class, 0, 0);
public static MetaIndex<Boolean> PIG_SADDLED = new MetaIndex<Boolean>(PigWatcher.class, 0, false);
public static MetaIndex<Integer> PIG_UNKNOWN = new MetaIndex<Integer>(PigWatcher.class, 1, 0);
public static MetaIndex<Float> PLAYER_ABSORPTION = new MetaIndex<Float>(PlayerWatcher.class, 0, 0F);
public static MetaIndex<Byte> PLAYER_HAND = new MetaIndex<Byte>(PlayerWatcher.class, 3, (byte) 0);
public static MetaIndex<Integer> PLAYER_SCORE = new MetaIndex<Integer>(PlayerWatcher.class, 1, 0);
public static MetaIndex<Byte> PLAYER_SKIN = new MetaIndex<Byte>(PlayerWatcher.class, 2, (byte) 127);
public static MetaIndex<Boolean> POLAR_BEAR_STANDING = new MetaIndex<Boolean>(PolarBearWatcher.class, 0, false);
public static MetaIndex<Integer> RABBIT_TYPE = new MetaIndex<Integer>(RabbitWatcher.class, 0, 0);
public static MetaIndex<Byte> SHEEP_WOOL = new MetaIndex<Byte>(SheepWatcher.class, 0, (byte) 0);
public static MetaIndex<Optional<BlockPosition>> SHULKER_ATTACHED = new MetaIndex<Optional<BlockPosition>>(ShulkerWatcher.class,
1, Optional.<BlockPosition> absent());
public static MetaIndex<Byte> SHULKER_COLOR = new MetaIndex<Byte>(ShulkerWatcher.class, 3, (byte) 10);
public static MetaIndex<Direction> SHULKER_FACING = new MetaIndex<Direction>(ShulkerWatcher.class, 0, Direction.DOWN);
public static MetaIndex<Byte> SHULKER_PEEKING = new MetaIndex<Byte>(ShulkerWatcher.class, 2, (byte) 0);
public static MetaIndex<Boolean> SKELETON_SWING_ARMS = new MetaIndex<Boolean>(SkeletonWatcher.class, 0, false);
public static MetaIndex<Integer> SLIME_SIZE = new MetaIndex<Integer>(SlimeWatcher.class, 0, 0);
public static MetaIndex<Byte> SNOWMAN_DERP = new MetaIndex<Byte>(SnowmanWatcher.class, 0, (byte) 0);
public static MetaIndex<Byte> SPIDER_CLIMB = new MetaIndex<Byte>(SpiderWatcher.class, 0, (byte) 0);
public static MetaIndex<ItemStack> SPLASH_POTION_ITEM = new MetaIndex<ItemStack>(SplashPotionWatcher.class, 1,
new ItemStack(Material.SPLASH_POTION)); // Yeah, the '1' isn't a bug. No idea why but MC thinks
// there's a '0' already.
public static MetaIndex<ItemStack> SPLASH_POTION_ITEM_BAD = new MetaIndex<ItemStack>(SplashPotionWatcher.class, 0,
new ItemStack(Material.SPLASH_POTION)); // Yeah, the '1' isn't a bug. No
// idea why but MC thinks there's a
// '0' already.
public static MetaIndex<Byte> TAMEABLE_META = new MetaIndex<Byte>(TameableWatcher.class, 0, (byte) 0);
public static MetaIndex<Optional<UUID>> TAMEABLE_OWNER = new MetaIndex<Optional<UUID>>(TameableWatcher.class, 1,
Optional.<UUID> absent());
public static MetaIndex<Integer> TIPPED_ARROW_COLOR = new MetaIndex<Integer>(ArrowWatcher.class, 1, Color.WHITE.asRGB());
public static MetaIndex<Integer> TNT_FUSE_TICKS = new MetaIndex<Integer>(TNTWatcher.class, 0, Integer.MAX_VALUE);
public static MetaIndex<Byte> VEX_ANGRY = new MetaIndex<Byte>(VexWatcher.class, 0, (byte) 0);
public static MetaIndex<Integer> VILLAGER_PROFESSION = new MetaIndex<Integer>(VillagerWatcher.class, 0, 0);
public static MetaIndex<Byte> VINDICATOR_JOHNNY = new MetaIndex<Byte>(VindicatorWatcher.class, 0, (byte) 0);
public static MetaIndex<Boolean> WITCH_AGGRESSIVE = new MetaIndex<Boolean>(WitchWatcher.class, 0, false);
public static MetaIndex<Integer> WITHER_INVUL = new MetaIndex<Integer>(WitherWatcher.class, 3, 0);
public static MetaIndex<Integer> WITHER_TARGET_1 = new MetaIndex<Integer>(WitherWatcher.class, 0, 0);
public static MetaIndex<Integer> WITHER_TARGET_2 = new MetaIndex<Integer>(WitherWatcher.class, 1, 0);
public static MetaIndex<Integer> WITHER_TARGET_3 = new MetaIndex<Integer>(WitherWatcher.class, 2, 0);
public static MetaIndex<Boolean> WITHER_SKULL_BLUE = new MetaIndex<Boolean>(WitherSkullWatcher.class, 0, false);
public static MetaIndex<Boolean> WOLF_BEGGING = new MetaIndex<Boolean>(WolfWatcher.class, 1, false);
public static MetaIndex<Integer> WOLF_COLLAR = new MetaIndex<Integer>(WolfWatcher.class, 2, 14);
public static MetaIndex<Float> WOLF_DAMAGE = new MetaIndex<Float>(WolfWatcher.class, 0, 0F);
public static MetaIndex<Boolean> ZOMBIE_AGGRESSIVE = new MetaIndex<Boolean>(ZombieWatcher.class, 2, false);
public static MetaIndex<Boolean> ZOMBIE_BABY = new MetaIndex<Boolean>(ZombieWatcher.class, 0, false);
public static MetaIndex<Integer> ZOMBIE_PLACEHOLDER = new MetaIndex<Integer>(ZombieWatcher.class, 1, 0);
public static MetaIndex<Integer> ZOMBIE_VILLAGER_PROFESSION = new MetaIndex<Integer>(ZombieVillagerWatcher.class, 1, 0);
public static MetaIndex<Boolean> ZOMBIE_VILLAGER_SHAKING = new MetaIndex<Boolean>(ZombieVillagerWatcher.class, 0, false);
static {
for (MetaIndex flagType : values()) {
if (flagType.getFlagWatcher() == FlagWatcher.class)
continue;
flagType._index += getNoIndexes(flagType.getFlagWatcher().getSuperclass());
}
// Simple verification for the dev that he's setting up the FlagType's properly.
// All flag types should be from 0 to <Max Number> with no empty numbers.
// All flag types should never occur twice.
HashMap<Class, Integer> maxValues = new HashMap<Class, Integer>();
for (MetaIndex type : values()) {
if (maxValues.containsKey(type.getFlagWatcher()) && maxValues.get(type.getFlagWatcher()) > type.getIndex())
continue;
maxValues.put(type.getFlagWatcher(), type.getIndex());
}
for (Entry<Class, Integer> entry : maxValues.entrySet()) {
loop:
for (int i = 0; i < entry.getValue(); i++) {
MetaIndex found = null;
for (MetaIndex type : values()) {
if (type.getIndex() != i)
continue;
if (!type.getFlagWatcher().isAssignableFrom(entry.getKey()))
continue;
if (found != null) {
System.err.println(entry.getKey().getSimpleName() + " has multiple FlagType's registered for the index "
+ i + " (" + type.getFlagWatcher().getSimpleName() + ", " + found.getFlagWatcher().getSimpleName()
+ ")");
continue loop;
}
found = type;
}
if (found != null)
continue;
System.err.println(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
}
}
}
public static MetaIndex getFlag(Class<? extends FlagWatcher> watcherClass, int flagNo) {
for (MetaIndex type : values()) {
if (type.getIndex() != flagNo)
continue;
if (!type.getFlagWatcher().isAssignableFrom(watcherClass))
continue;
return type;
}
return null;
}
public static ArrayList<MetaIndex> getFlags(Class<? extends FlagWatcher> watcherClass) {
ArrayList<MetaIndex> list = new ArrayList<MetaIndex>();
for (MetaIndex type : values()) {
if (!type.getFlagWatcher().isAssignableFrom(watcherClass))
continue;
list.add(type);
}
return list;
}
private static int getNoIndexes(Class c) {
int found = 0;
for (MetaIndex type : values()) {
if (type.getFlagWatcher() != c)
continue;
found++;
}
if (c != FlagWatcher.class) {
found += getNoIndexes(c.getSuperclass());
}
return found;
}
public static MetaIndex[] values() {
return _values;
}
private Y _defaultValue;
private int _index;
private Class<? extends FlagWatcher> _watcher;
private MetaIndex(Class<? extends FlagWatcher> watcher, int index, Y defaultValue) {
_index = index;
_watcher = watcher;
_defaultValue = defaultValue;
_values = Arrays.copyOf(_values, _values.length + 1);
_values[_values.length - 1] = this;
}
public Y getDefault() {
return _defaultValue;
}
public Class<? extends FlagWatcher> getFlagWatcher() {
return _watcher;
}
public int getIndex() {
return _index;
}
}

View File

@ -5,7 +5,7 @@ import java.util.UUID;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class AbstractHorseWatcher extends AgeableWatcher {
public AbstractHorseWatcher(Disguise disguise) {
@ -13,7 +13,7 @@ public class AbstractHorseWatcher extends AgeableWatcher {
}
public Optional<UUID> getOwner() {
return getData(FlagType.HORSE_OWNER);
return getData(MetaIndex.HORSE_OWNER);
}
public boolean hasChest() {
@ -49,7 +49,7 @@ public class AbstractHorseWatcher extends AgeableWatcher {
}
private byte getHorseFlag() {
return getData(FlagType.HORSE_META);
return getData(MetaIndex.HORSE_META);
}
public void setCanBreed(boolean breed) {
@ -61,16 +61,16 @@ public class AbstractHorseWatcher extends AgeableWatcher {
}
private void setHorseFlag(int i, boolean flag) {
byte j = getData(FlagType.HORSE_META);
byte j = getData(MetaIndex.HORSE_META);
if (flag) {
setData(FlagType.HORSE_META, (byte) (j | i));
setData(MetaIndex.HORSE_META, (byte) (j | i));
}
else {
setData(FlagType.HORSE_META, (byte) (j & ~i));
setData(MetaIndex.HORSE_META, (byte) (j & ~i));
}
sendData(FlagType.HORSE_META);
sendData(MetaIndex.HORSE_META);
}
public void setGrazing(boolean grazing) {
@ -82,8 +82,8 @@ public class AbstractHorseWatcher extends AgeableWatcher {
}
public void setOwner(UUID uuid) {
setData(FlagType.HORSE_OWNER, Optional.of(uuid));
sendData(FlagType.HORSE_OWNER);
setData(MetaIndex.HORSE_OWNER, Optional.of(uuid));
sendData(MetaIndex.HORSE_OWNER);
}
public void setRearing(boolean rear) {

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class AgeableWatcher extends InsentientWatcher
{
@ -17,7 +17,7 @@ public class AgeableWatcher extends InsentientWatcher
public boolean isBaby()
{
return getData(FlagType.AGEABLE_BABY);
return getData(MetaIndex.AGEABLE_BABY);
}
public void setAdult()
@ -32,7 +32,7 @@ public class AgeableWatcher extends InsentientWatcher
public void setBaby(boolean isBaby)
{
setData(FlagType.AGEABLE_BABY, isBaby);
sendData(FlagType.AGEABLE_BABY);
setData(MetaIndex.AGEABLE_BABY, isBaby);
sendData(MetaIndex.AGEABLE_BABY);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
/**
@ -16,35 +16,35 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
}
public float getRadius() {
return getData(FlagType.AREA_EFFECT_RADIUS);
return getData(MetaIndex.AREA_EFFECT_RADIUS);
}
public int getColor() {
return getData(FlagType.AREA_EFFECT_CLOUD_COLOR);
return getData(MetaIndex.AREA_EFFECT_CLOUD_COLOR);
}
public boolean isIgnoreRadius() {
return getData(FlagType.AREA_EFFECT_IGNORE_RADIUS);
return getData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS);
}
public int getParticleId() {
return getData(FlagType.AREA_EFFECT_PARTICLE);
return getData(MetaIndex.AREA_EFFECT_PARTICLE);
}
public void setRadius(float radius) {
setData(FlagType.AREA_EFFECT_RADIUS, radius);
setData(MetaIndex.AREA_EFFECT_RADIUS, radius);
}
public void setColor(int color) {
setData(FlagType.AREA_EFFECT_CLOUD_COLOR, color);
setData(MetaIndex.AREA_EFFECT_CLOUD_COLOR, color);
}
public void setIgnoreRadius(boolean ignore) {
setData(FlagType.AREA_EFFECT_IGNORE_RADIUS, ignore);
setData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS, ignore);
}
public void setParticleId(int particleId) {
setData(FlagType.AREA_EFFECT_PARTICLE, particleId);
setData(MetaIndex.AREA_EFFECT_PARTICLE, particleId);
}
}

View File

@ -5,7 +5,7 @@ import org.bukkit.util.EulerAngle;
import com.comphenix.protocol.wrappers.Vector3F;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class ArmorStandWatcher extends LivingWatcher
{
@ -16,30 +16,30 @@ public class ArmorStandWatcher extends LivingWatcher
private boolean getArmorStandFlag(int value)
{
return (getData(FlagType.ARMORSTAND_META) & value) != 0;
return (getData(MetaIndex.ARMORSTAND_META) & value) != 0;
}
public EulerAngle getBody()
{
return getPose(FlagType.ARMORSTAND_BODY);
return getPose(MetaIndex.ARMORSTAND_BODY);
}
public EulerAngle getHead()
{
return getPose(FlagType.ARMORSTAND_HEAD);
return getPose(MetaIndex.ARMORSTAND_HEAD);
}
public EulerAngle getLeftArm()
{
return getPose(FlagType.ARMORSTAND_LEFT_ARM);
return getPose(MetaIndex.ARMORSTAND_LEFT_ARM);
}
public EulerAngle getLeftLeg()
{
return getPose(FlagType.ARMORSTAND_LEFT_LEG);
return getPose(MetaIndex.ARMORSTAND_LEFT_LEG);
}
private EulerAngle getPose(FlagType<Vector3F> type)
private EulerAngle getPose(MetaIndex<Vector3F> type)
{
if (!hasValue(type))
return new EulerAngle(0, 0, 0);
@ -51,12 +51,12 @@ public class ArmorStandWatcher extends LivingWatcher
public EulerAngle getRightArm()
{
return getPose(FlagType.ARMORSTAND_RIGHT_ARM);
return getPose(MetaIndex.ARMORSTAND_RIGHT_ARM);
}
public EulerAngle getRightLeg()
{
return getPose(FlagType.ARMORSTAND_RIGHT_LEG);
return getPose(MetaIndex.ARMORSTAND_RIGHT_LEG);
}
public boolean isMarker()
@ -86,7 +86,7 @@ public class ArmorStandWatcher extends LivingWatcher
private void setArmorStandFlag(int value, boolean isTrue)
{
byte b1 = (byte) getData(FlagType.ARMORSTAND_META);
byte b1 = (byte) getData(MetaIndex.ARMORSTAND_META);
if (isTrue)
{
@ -97,49 +97,49 @@ public class ArmorStandWatcher extends LivingWatcher
b1 = (byte) (b1 & value);
}
setData(FlagType.ARMORSTAND_META, b1);
sendData(FlagType.ARMORSTAND_META);
setData(MetaIndex.ARMORSTAND_META, b1);
sendData(MetaIndex.ARMORSTAND_META);
}
public void setBody(EulerAngle vector)
{
setPose(FlagType.ARMORSTAND_BODY, vector);
setPose(MetaIndex.ARMORSTAND_BODY, vector);
}
public void setHead(EulerAngle vector)
{
setPose(FlagType.ARMORSTAND_HEAD, vector);
setPose(MetaIndex.ARMORSTAND_HEAD, vector);
}
public void setLeftArm(EulerAngle vector)
{
setPose(FlagType.ARMORSTAND_LEFT_ARM, vector);
setPose(MetaIndex.ARMORSTAND_LEFT_ARM, vector);
}
public void setLeftLeg(EulerAngle vector)
{
setPose(FlagType.ARMORSTAND_LEFT_LEG, vector);
setPose(MetaIndex.ARMORSTAND_LEFT_LEG, vector);
}
public void setMarker(boolean isMarker)
{
setArmorStandFlag(10, isMarker);
sendData(FlagType.ARMORSTAND_META);
sendData(MetaIndex.ARMORSTAND_META);
}
public void setNoBasePlate(boolean noBasePlate)
{
setArmorStandFlag(8, noBasePlate);
sendData(FlagType.ARMORSTAND_META);
sendData(MetaIndex.ARMORSTAND_META);
}
public void setNoGravity(boolean noGravity)
{
setArmorStandFlag(2, noGravity);
sendData(FlagType.ARMORSTAND_META);
sendData(MetaIndex.ARMORSTAND_META);
}
private void setPose(FlagType<Vector3F> type, EulerAngle vector)
private void setPose(MetaIndex<Vector3F> type, EulerAngle vector)
{
setData(type, new Vector3F((float) vector.getX(), (float) vector.getY(), (float) vector.getZ()));
sendData(type);
@ -147,24 +147,24 @@ public class ArmorStandWatcher extends LivingWatcher
public void setRightArm(EulerAngle vector)
{
setPose(FlagType.ARMORSTAND_RIGHT_ARM, vector);
setPose(MetaIndex.ARMORSTAND_RIGHT_ARM, vector);
}
public void setRightLeg(EulerAngle vector)
{
setPose(FlagType.ARMORSTAND_RIGHT_LEG, vector);
setPose(MetaIndex.ARMORSTAND_RIGHT_LEG, vector);
}
public void setShowArms(boolean showArms)
{
setArmorStandFlag(4, showArms);
sendData(FlagType.ARMORSTAND_META);
sendData(MetaIndex.ARMORSTAND_META);
}
public void setSmall(boolean isSmall)
{
setArmorStandFlag(1, isSmall);
sendData(FlagType.ARMORSTAND_META);
sendData(MetaIndex.ARMORSTAND_META);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class ArrowWatcher extends FlagWatcher
@ -13,12 +13,12 @@ public class ArrowWatcher extends FlagWatcher
public boolean isCritical()
{
return (byte) getData(FlagType.ARROW_CRITICAL) == 1;
return (byte) getData(MetaIndex.ARROW_CRITICAL) == 1;
}
public void setCritical(boolean critical)
{
setData(FlagType.ARROW_CRITICAL, (byte) (critical ? 1 : 0));
sendData(FlagType.ARROW_CRITICAL);
setData(MetaIndex.ARROW_CRITICAL, (byte) (critical ? 1 : 0));
sendData(MetaIndex.ARROW_CRITICAL);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class BatWatcher extends InsentientWatcher
{
@ -15,12 +15,12 @@ public class BatWatcher extends InsentientWatcher
public boolean isHanging()
{
return ((byte) getData(FlagType.BAT_HANGING)) == 1;
return ((byte) getData(MetaIndex.BAT_HANGING)) == 1;
}
public void setHanging(boolean hanging)
{
setData(FlagType.BAT_HANGING, hanging ? (byte) 1 : (byte) 0);
sendData(FlagType.BAT_HANGING);
setData(MetaIndex.BAT_HANGING, hanging ? (byte) 1 : (byte) 0);
sendData(MetaIndex.BAT_HANGING);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class BlazeWatcher extends InsentientWatcher
{
@ -12,13 +12,13 @@ public class BlazeWatcher extends InsentientWatcher
public boolean isBlazing()
{
return getData(FlagType.BLAZE_BLAZING) == 1;
return getData(MetaIndex.BLAZE_BLAZING) == 1;
}
public void setBlazing(boolean isBlazing)
{
setData(FlagType.BLAZE_BLAZING, (byte) (isBlazing ? 1 : 0));
sendData(FlagType.BLAZE_BLAZING);
setData(MetaIndex.BLAZE_BLAZING, (byte) (isBlazing ? 1 : 0));
sendData(MetaIndex.BLAZE_BLAZING);
}
}

View File

@ -5,7 +5,7 @@ import java.util.Random;
import org.bukkit.TreeSpecies;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class BoatWatcher extends FlagWatcher
@ -19,46 +19,46 @@ public class BoatWatcher extends FlagWatcher
public float getDamage()
{
return getData(FlagType.BOAT_DAMAGE);
return getData(MetaIndex.BOAT_DAMAGE);
}
public void setDamage(float dmg)
{
setData(FlagType.BOAT_DAMAGE, dmg);
sendData(FlagType.BOAT_DAMAGE);
setData(MetaIndex.BOAT_DAMAGE, dmg);
sendData(MetaIndex.BOAT_DAMAGE);
}
public void setRightPaddling(boolean rightPaddling)
{
setData(FlagType.BOAT_RIGHT_PADDLING, rightPaddling);
sendData(FlagType.BOAT_RIGHT_PADDLING);
setData(MetaIndex.BOAT_RIGHT_PADDLING, rightPaddling);
sendData(MetaIndex.BOAT_RIGHT_PADDLING);
}
public void setLeftPaddling(boolean leftPaddling)
{
setData(FlagType.BOAT_LEFT_PADDLING, leftPaddling);
sendData(FlagType.BOAT_LEFT_PADDLING);
setData(MetaIndex.BOAT_LEFT_PADDLING, leftPaddling);
sendData(MetaIndex.BOAT_LEFT_PADDLING);
}
public boolean isRightPaddling()
{
return getData(FlagType.BOAT_RIGHT_PADDLING);
return getData(MetaIndex.BOAT_RIGHT_PADDLING);
}
public boolean isLeftPaddling()
{
return getData(FlagType.BOAT_LEFT_PADDLING);
return getData(MetaIndex.BOAT_LEFT_PADDLING);
}
public void setBoatType(TreeSpecies boatType)
{
setData(FlagType.BOAT_TYPE, (int) boatType.getData());
sendData(FlagType.BOAT_TYPE);
setData(MetaIndex.BOAT_TYPE, (int) boatType.getData());
sendData(MetaIndex.BOAT_TYPE);
}
public TreeSpecies getBoatType()
{
return TreeSpecies.getByData(getData(FlagType.BOAT_TYPE).byteValue());
return TreeSpecies.getByData(getData(MetaIndex.BOAT_TYPE).byteValue());
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class ChestedHorseWatcher extends AbstractHorseWatcher {
@ -10,11 +10,11 @@ public class ChestedHorseWatcher extends AbstractHorseWatcher {
}
public void setCarryingChest(boolean carryingChest) {
setData(FlagType.HORSE_CHESTED_CARRYING_CHEST, carryingChest);
sendData(FlagType.HORSE_CHESTED_CARRYING_CHEST);
setData(MetaIndex.HORSE_CHESTED_CARRYING_CHEST, carryingChest);
sendData(MetaIndex.HORSE_CHESTED_CARRYING_CHEST);
}
public boolean isCarryingChest() {
return getData(FlagType.HORSE_CHESTED_CARRYING_CHEST);
return getData(MetaIndex.HORSE_CHESTED_CARRYING_CHEST);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class CreeperWatcher extends InsentientWatcher
{
@ -13,24 +13,24 @@ public class CreeperWatcher extends InsentientWatcher
public boolean isIgnited()
{
return (boolean) getData(FlagType.CREEPER_IGNITED);
return (boolean) getData(MetaIndex.CREEPER_IGNITED);
}
public boolean isPowered()
{
return (boolean) getData(FlagType.CREEPER_POWERED);
return (boolean) getData(MetaIndex.CREEPER_POWERED);
}
public void setIgnited(boolean ignited)
{
setData(FlagType.CREEPER_IGNITED, ignited);
sendData(FlagType.CREEPER_IGNITED);
setData(MetaIndex.CREEPER_IGNITED, ignited);
sendData(MetaIndex.CREEPER_IGNITED);
}
public void setPowered(boolean powered)
{
setData(FlagType.CREEPER_POWERED, powered);
sendData(FlagType.CREEPER_POWERED);
setData(MetaIndex.CREEPER_POWERED, powered);
sendData(MetaIndex.CREEPER_POWERED);
}
}

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class DroppedItemWatcher extends FlagWatcher {
@ -12,11 +12,11 @@ public class DroppedItemWatcher extends FlagWatcher {
}
public ItemStack getItemStack() {
return getData(FlagType.DROPPED_ITEM);
return getData(MetaIndex.DROPPED_ITEM);
}
public void setItemStack(ItemStack item) {
setData(FlagType.DROPPED_ITEM, item);
sendData(FlagType.DROPPED_ITEM);
setData(MetaIndex.DROPPED_ITEM, item);
sendData(MetaIndex.DROPPED_ITEM);
}
}

View File

@ -4,7 +4,7 @@ import com.comphenix.protocol.wrappers.BlockPosition;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
/**
@ -19,24 +19,24 @@ public class EnderCrystalWatcher extends FlagWatcher
public void setBeamTarget(BlockPosition position)
{
setData(FlagType.ENDER_CRYSTAL_BEAM, Optional.of(position));
sendData(FlagType.ENDER_CRYSTAL_BEAM);
setData(MetaIndex.ENDER_CRYSTAL_BEAM, Optional.of(position));
sendData(MetaIndex.ENDER_CRYSTAL_BEAM);
}
public Optional<BlockPosition> getBeamTarget()
{
return getData(FlagType.ENDER_CRYSTAL_BEAM);
return getData(MetaIndex.ENDER_CRYSTAL_BEAM);
}
public void setShowBottom(boolean bool)
{
setData(FlagType.ENDER_CRYSTAL_PLATE, bool);
sendData(FlagType.ENDER_CRYSTAL_PLATE);
setData(MetaIndex.ENDER_CRYSTAL_PLATE, bool);
sendData(MetaIndex.ENDER_CRYSTAL_PLATE);
}
public boolean isShowBottom()
{
return getData(FlagType.ENDER_CRYSTAL_PLATE);
return getData(MetaIndex.ENDER_CRYSTAL_PLATE);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* @author Navid
@ -16,12 +16,12 @@ public class EnderDragonWatcher extends InsentientWatcher
public int getPhase()
{
return getData(FlagType.ENDERD_RAGON_PHASE);
return getData(MetaIndex.ENDERD_RAGON_PHASE);
}
public void setPhase(int phase)
{
setData(FlagType.ENDERD_RAGON_PHASE, phase);
sendData(FlagType.ENDERD_RAGON_PHASE);
setData(MetaIndex.ENDERD_RAGON_PHASE, phase);
sendData(MetaIndex.ENDERD_RAGON_PHASE);
}
}

View File

@ -7,7 +7,7 @@ import com.comphenix.protocol.wrappers.WrappedBlockData;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class EndermanWatcher extends InsentientWatcher
{
@ -20,7 +20,7 @@ public class EndermanWatcher extends InsentientWatcher
@Override
public ItemStack getItemInMainHand()
{
Optional<WrappedBlockData> value = getData(FlagType.ENDERMAN_ITEM);
Optional<WrappedBlockData> value = getData(MetaIndex.ENDERMAN_ITEM);
if (value.isPresent())
{
@ -62,7 +62,7 @@ public class EndermanWatcher extends InsentientWatcher
else
optional = Optional.<WrappedBlockData> of(WrappedBlockData.createData(type, data));
setData(FlagType.ENDERMAN_ITEM, optional);
setData(MetaIndex.ENDERMAN_ITEM, optional);
}
@Deprecated
@ -73,13 +73,13 @@ public class EndermanWatcher extends InsentientWatcher
public boolean isAggressive()
{
return getData(FlagType.ENDERMAN_AGRESSIVE);
return getData(MetaIndex.ENDERMAN_AGRESSIVE);
}
public void setAggressive(boolean isAggressive)
{
setData(FlagType.ENDERMAN_AGRESSIVE, isAggressive);
sendData(FlagType.ENDERMAN_AGRESSIVE);
setData(MetaIndex.ENDERMAN_AGRESSIVE, isAggressive);
sendData(MetaIndex.ENDERMAN_AGRESSIVE);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class EvokerWatcher extends InsentientWatcher {
@ -10,11 +10,11 @@ public class EvokerWatcher extends InsentientWatcher {
}
public void setSpellTicks(int spellTicks) {
setData(FlagType.EVOKER_SPELL_TICKS, (byte) spellTicks);
sendData(FlagType.EVOKER_SPELL_TICKS);
setData(MetaIndex.EVOKER_SPELL_TICKS, (byte) spellTicks);
sendData(MetaIndex.EVOKER_SPELL_TICKS);
}
public int getSpellTicks() {
return getData(FlagType.EVOKER_SPELL_TICKS);
return getData(MetaIndex.EVOKER_SPELL_TICKS);
}
}

View File

@ -4,7 +4,7 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class FireworkWatcher extends FlagWatcher {
@ -13,11 +13,11 @@ public class FireworkWatcher extends FlagWatcher {
}
public ItemStack getFirework() {
if (getData(FlagType.FIREWORK_ITEM) == null) {
if (getData(MetaIndex.FIREWORK_ITEM) == null) {
return new ItemStack(Material.AIR);
}
return (ItemStack) getData(FlagType.FIREWORK_ITEM);
return (ItemStack) getData(MetaIndex.FIREWORK_ITEM);
}
public void setFirework(ItemStack newItem) {
@ -28,16 +28,16 @@ public class FireworkWatcher extends FlagWatcher {
newItem = newItem.clone();
newItem.setAmount(1);
setData(FlagType.FIREWORK_ITEM, newItem);
sendData(FlagType.FIREWORK_ITEM);
setData(MetaIndex.FIREWORK_ITEM, newItem);
sendData(MetaIndex.FIREWORK_ITEM);
}
public void setAttachedEntity(int entityId) {
setData(FlagType.FIREWORK_ATTACHED_ENTITY, entityId);
sendData(FlagType.FIREWORK_ATTACHED_ENTITY);
setData(MetaIndex.FIREWORK_ATTACHED_ENTITY, entityId);
sendData(MetaIndex.FIREWORK_ATTACHED_ENTITY);
}
public int getAttachedEntity() {
return getData(FlagType.FIREWORK_ATTACHED_ENTITY);
return getData(MetaIndex.FIREWORK_ATTACHED_ENTITY);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class FishingHookWatcher extends FlagWatcher
@ -13,13 +13,13 @@ public class FishingHookWatcher extends FlagWatcher
public void setHooked(int hookedId)
{
setData(FlagType.FISHING_HOOK_HOOKED, hookedId + 1);
sendData(FlagType.FISHING_HOOK_HOOKED);
setData(MetaIndex.FISHING_HOOK_HOOKED, hookedId + 1);
sendData(MetaIndex.FISHING_HOOK_HOOKED);
}
public int getHooked()
{
int hooked = getData(FlagType.FISHING_HOOK_HOOKED);
int hooked = getData(MetaIndex.FISHING_HOOK_HOOKED);
if (hooked > 0)
hooked--;

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class GhastWatcher extends InsentientWatcher
{
@ -13,13 +13,13 @@ public class GhastWatcher extends InsentientWatcher
public boolean isAggressive()
{
return getData(FlagType.GHAST_AGRESSIVE);
return getData(MetaIndex.GHAST_AGRESSIVE);
}
public void setAggressive(boolean isAggressive)
{
setData(FlagType.GHAST_AGRESSIVE, isAggressive);
sendData(FlagType.GHAST_AGRESSIVE);
setData(MetaIndex.GHAST_AGRESSIVE, isAggressive);
sendData(MetaIndex.GHAST_AGRESSIVE);
}
}

View File

@ -5,7 +5,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class GuardianWatcher extends InsentientWatcher {
public GuardianWatcher(Disguise disguise) {
@ -18,7 +18,7 @@ public class GuardianWatcher extends InsentientWatcher {
* @return
*/
public boolean isTarget() {
return ((int) getData(FlagType.GUARDIAN_TARGET)) != 0;
return ((int) getData(MetaIndex.GUARDIAN_TARGET)) != 0;
}
/**
@ -27,8 +27,8 @@ public class GuardianWatcher extends InsentientWatcher {
* @param entityId
*/
public void setTarget(int entityId) {
setData(FlagType.GUARDIAN_TARGET, entityId);
sendData(FlagType.GUARDIAN_TARGET);
setData(MetaIndex.GUARDIAN_TARGET, entityId);
sendData(MetaIndex.GUARDIAN_TARGET);
}
public void setTarget(Entity entity) {
@ -46,17 +46,17 @@ public class GuardianWatcher extends InsentientWatcher {
if (player == null)
return;
setData(FlagType.GUARDIAN_TARGET, player.getEntityId());
sendData(FlagType.GUARDIAN_TARGET);
setData(MetaIndex.GUARDIAN_TARGET, player.getEntityId());
sendData(MetaIndex.GUARDIAN_TARGET);
}
public boolean isRetractingSpikes() {
return getData(FlagType.GUARDIAN_RETRACT_SPIKES);
return getData(MetaIndex.GUARDIAN_RETRACT_SPIKES);
}
public void setRetractingSpikes(boolean isRetracting) {
setData(FlagType.GUARDIAN_RETRACT_SPIKES, isRetracting);
sendData(FlagType.GUARDIAN_RETRACT_SPIKES);
setData(MetaIndex.GUARDIAN_RETRACT_SPIKES, isRetracting);
sendData(MetaIndex.GUARDIAN_RETRACT_SPIKES);
}
}

View File

@ -6,7 +6,7 @@ import org.bukkit.entity.Horse.Style;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
public class HorseWatcher extends AbstractHorseWatcher {
@ -18,7 +18,7 @@ public class HorseWatcher extends AbstractHorseWatcher {
}
public Color getColor() {
return Color.values()[((Integer) getData(FlagType.HORSE_COLOR) & 0xFF)];
return Color.values()[((Integer) getData(MetaIndex.HORSE_COLOR) & 0xFF)];
}
public ItemStack getHorseArmor() {
@ -39,26 +39,26 @@ public class HorseWatcher extends AbstractHorseWatcher {
}
public Style getStyle() {
return Style.values()[(getData(FlagType.HORSE_COLOR) >>> 8)];
return Style.values()[(getData(MetaIndex.HORSE_COLOR) >>> 8)];
}
public void setColor(Color color) {
setData(FlagType.HORSE_COLOR, color.ordinal() & 0xFF | getStyle().ordinal() << 8);
sendData(FlagType.HORSE_COLOR);
setData(MetaIndex.HORSE_COLOR, color.ordinal() & 0xFF | getStyle().ordinal() << 8);
sendData(MetaIndex.HORSE_COLOR);
}
protected int getHorseArmorAsInt() {
return getData(FlagType.HORSE_ARMOR);
return getData(MetaIndex.HORSE_ARMOR);
}
protected void setHorseArmor(int armor) {
setData(FlagType.HORSE_ARMOR, armor);
sendData(FlagType.HORSE_ARMOR);
setData(MetaIndex.HORSE_ARMOR, armor);
sendData(MetaIndex.HORSE_ARMOR);
}
public void setStyle(Style style) {
setData(FlagType.HORSE_COLOR, getColor().ordinal() & 0xFF | style.ordinal() << 8);
sendData(FlagType.HORSE_COLOR);
setData(MetaIndex.HORSE_COLOR, getColor().ordinal() & 0xFF | style.ordinal() << 8);
sendData(MetaIndex.HORSE_COLOR);
}
public void setHorseArmor(ItemStack item) {

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.inventory.MainHand;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class InsentientWatcher extends LivingWatcher
{
@ -15,7 +15,7 @@ public class InsentientWatcher extends LivingWatcher
public void setMainHand(MainHand mainHand)
{
setInsentientFlag(2, mainHand == MainHand.RIGHT);
sendData(FlagType.INSENTIENT_META);
sendData(MetaIndex.INSENTIENT_META);
}
public MainHand getMainHand()
@ -31,25 +31,25 @@ public class InsentientWatcher extends LivingWatcher
public void setAI(boolean ai)
{
setInsentientFlag(1, ai);
sendData(FlagType.INSENTIENT_META);
sendData(MetaIndex.INSENTIENT_META);
}
private void setInsentientFlag(int i, boolean flag)
{
byte b0 = (byte) getData(FlagType.INSENTIENT_META);
byte b0 = (byte) getData(MetaIndex.INSENTIENT_META);
if (flag)
{
setData(FlagType.INSENTIENT_META, (byte) (b0 | 1 << i));
setData(MetaIndex.INSENTIENT_META, (byte) (b0 | 1 << i));
}
else
{
setData(FlagType.INSENTIENT_META, (byte) (b0 & (~1 << i)));
setData(MetaIndex.INSENTIENT_META, (byte) (b0 & (~1 << i)));
}
}
private boolean getInsentientFlag(int i)
{
return ((byte) getData(FlagType.INSENTIENT_META) & 1 << i) != 0;
return ((byte) getData(MetaIndex.INSENTIENT_META) & 1 << i) != 0;
}
}

View File

@ -4,7 +4,7 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class ItemFrameWatcher extends FlagWatcher {
@ -13,15 +13,15 @@ public class ItemFrameWatcher extends FlagWatcher {
}
public ItemStack getItem() {
if (getData(FlagType.ITEMFRAME_ITEM) == null) {
if (getData(MetaIndex.ITEMFRAME_ITEM) == null) {
return new ItemStack(Material.AIR);
}
return (ItemStack) getData(FlagType.ITEMFRAME_ITEM);
return (ItemStack) getData(MetaIndex.ITEMFRAME_ITEM);
}
public int getRotation() {
return getData(FlagType.ITEMFRAME_ROTATION);
return getData(MetaIndex.ITEMFRAME_ROTATION);
}
public void setItem(ItemStack newItem) {
@ -32,13 +32,13 @@ public class ItemFrameWatcher extends FlagWatcher {
newItem = newItem.clone();
newItem.setAmount(1);
setData(FlagType.ITEMFRAME_ITEM, newItem);
sendData(FlagType.ITEMFRAME_ITEM);
setData(MetaIndex.ITEMFRAME_ITEM, newItem);
sendData(MetaIndex.ITEMFRAME_ITEM);
}
public void setRotation(int rotation) {
setData(FlagType.ITEMFRAME_ROTATION, rotation % 4);
sendData(FlagType.ITEMFRAME_ROTATION);
setData(MetaIndex.ITEMFRAME_ROTATION, rotation % 4);
sendData(MetaIndex.ITEMFRAME_ROTATION);
}
}

View File

@ -20,7 +20,7 @@ import com.comphenix.protocol.wrappers.WrappedAttribute.Builder;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.ReflectionManager;
@ -72,7 +72,7 @@ public class LivingWatcher extends FlagWatcher {
}
public float getHealth() {
return (float) getData(FlagType.LIVING_HEALTH);
return (float) getData(MetaIndex.LIVING_HEALTH);
}
public double getMaxHealth() {
@ -80,7 +80,7 @@ public class LivingWatcher extends FlagWatcher {
}
public boolean isPotionParticlesAmbient() {
return (boolean) getData(FlagType.LIVING_POTION_AMBIENT);
return (boolean) getData(MetaIndex.LIVING_POTION_AMBIENT);
}
private int getPotions() {
@ -130,27 +130,27 @@ public class LivingWatcher extends FlagWatcher {
}
public void setPotionParticlesAmbient(boolean particles) {
setData(FlagType.LIVING_POTION_AMBIENT, particles);
sendData(FlagType.LIVING_POTION_AMBIENT);
setData(MetaIndex.LIVING_POTION_AMBIENT, particles);
sendData(MetaIndex.LIVING_POTION_AMBIENT);
}
private void sendPotionEffects() {
setData(FlagType.LIVING_POTIONS, getPotions());
sendData(FlagType.LIVING_POTIONS);
setData(MetaIndex.LIVING_POTIONS, getPotions());
sendData(MetaIndex.LIVING_POTIONS);
}
public void setHealth(float health) {
setData(FlagType.LIVING_HEALTH, health);
sendData(FlagType.LIVING_HEALTH);
setData(MetaIndex.LIVING_HEALTH, health);
sendData(MetaIndex.LIVING_HEALTH);
}
public int getArrowsSticking() {
return (int) getData(FlagType.LIVING_ARROWS);
return (int) getData(MetaIndex.LIVING_ARROWS);
}
public void setArrowsSticking(int arrowsNo) {
setData(FlagType.LIVING_ARROWS, arrowsNo);
sendData(FlagType.LIVING_ARROWS);
setData(MetaIndex.LIVING_ARROWS, arrowsNo);
sendData(MetaIndex.LIVING_ARROWS);
}
public void setMaxHealth(double newHealth) {

View File

@ -4,7 +4,7 @@ import org.bukkit.entity.Llama;
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class LlamaWatcher extends ChestedHorseWatcher {
@ -13,30 +13,30 @@ public class LlamaWatcher extends ChestedHorseWatcher {
}
public void setColor(Llama.Color color) {
setData(FlagType.LLAMA_COLOR, color.ordinal());
sendData(FlagType.LLAMA_COLOR);
setData(MetaIndex.LLAMA_COLOR, color.ordinal());
sendData(MetaIndex.LLAMA_COLOR);
}
public Llama.Color getColor() {
return Llama.Color.values()[getData(FlagType.LLAMA_COLOR)];
return Llama.Color.values()[getData(MetaIndex.LLAMA_COLOR)];
}
public void setCarpet(AnimalColor color) {
setData(FlagType.LLAMA_CARPET, color.getId());
sendData(FlagType.LLAMA_CARPET);
setData(MetaIndex.LLAMA_CARPET, color.getId());
sendData(MetaIndex.LLAMA_CARPET);
}
public AnimalColor getCarpet() {
return AnimalColor.getColor(getData(FlagType.LLAMA_CARPET));
return AnimalColor.getColor(getData(MetaIndex.LLAMA_CARPET));
}
public void setStrength(int strength) {
setData(FlagType.LLAMA_STRENGTH, strength);
sendData(FlagType.LLAMA_STRENGTH);
setData(MetaIndex.LLAMA_STRENGTH, strength);
sendData(MetaIndex.LLAMA_STRENGTH);
}
public int getStrength() {
return getData(FlagType.LLAMA_STRENGTH);
return getData(MetaIndex.LLAMA_STRENGTH);
}
}

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class MinecartWatcher extends FlagWatcher
@ -16,20 +16,20 @@ public class MinecartWatcher extends FlagWatcher
public ItemStack getBlockInCart()
{
int id = (int) getData(FlagType.MINECART_BLOCK) & 0xffff;
int data = (int) getData(FlagType.MINECART_BLOCK) >> 16;
int id = (int) getData(MetaIndex.MINECART_BLOCK) & 0xffff;
int data = (int) getData(MetaIndex.MINECART_BLOCK) >> 16;
return new ItemStack(id, 1, (short) data);
}
public int getBlockYOffset()
{
return (int) getData(FlagType.MINECART_BLOCK_Y);
return (int) getData(MetaIndex.MINECART_BLOCK_Y);
}
public boolean isViewBlockInCart()
{
return (boolean) getData(FlagType.MINECART_BLOCK_VISIBLE);
return (boolean) getData(MetaIndex.MINECART_BLOCK_VISIBLE);
}
public void setBlockInCart(ItemStack item)
@ -37,21 +37,21 @@ public class MinecartWatcher extends FlagWatcher
int id = item.getTypeId();
int data = item.getDurability();
setData(FlagType.MINECART_BLOCK, id & 0xffff | data << 16);
setData(FlagType.MINECART_BLOCK_VISIBLE, true); // Show block
setData(MetaIndex.MINECART_BLOCK, id & 0xffff | data << 16);
setData(MetaIndex.MINECART_BLOCK_VISIBLE, true); // Show block
sendData(FlagType.MINECART_BLOCK);
sendData(MetaIndex.MINECART_BLOCK);
}
public void setBlockOffset(int i)
{
setData(FlagType.MINECART_BLOCK_Y, i);
sendData(FlagType.MINECART_BLOCK_Y);
setData(MetaIndex.MINECART_BLOCK_Y, i);
sendData(MetaIndex.MINECART_BLOCK_Y);
}
public void setViewBlockInCart(boolean viewBlock)
{
setData(FlagType.MINECART_BLOCK_VISIBLE, viewBlock);
sendData(FlagType.MINECART_BLOCK_VISIBLE);
setData(MetaIndex.MINECART_BLOCK_VISIBLE, viewBlock);
sendData(MetaIndex.MINECART_BLOCK_VISIBLE);
}
}

View File

@ -4,7 +4,7 @@ import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Ocelot.Type;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class OcelotWatcher extends TameableWatcher
{
@ -16,12 +16,12 @@ public class OcelotWatcher extends TameableWatcher
public Type getType()
{
return Ocelot.Type.getType(getData(FlagType.OCELOT_TYPE));
return Ocelot.Type.getType(getData(MetaIndex.OCELOT_TYPE));
}
public void setType(Type newType)
{
setData(FlagType.OCELOT_TYPE, newType.getId());
sendData(FlagType.OCELOT_TYPE);
setData(MetaIndex.OCELOT_TYPE, newType.getId());
sendData(MetaIndex.OCELOT_TYPE);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class PigWatcher extends AgeableWatcher {
@ -10,12 +10,12 @@ public class PigWatcher extends AgeableWatcher {
}
public boolean isSaddled() {
return (boolean) getData(FlagType.PIG_SADDLED);
return (boolean) getData(MetaIndex.PIG_SADDLED);
}
public void setSaddled(boolean isSaddled) {
setData(FlagType.PIG_SADDLED, isSaddled);
sendData(FlagType.PIG_SADDLED);
setData(MetaIndex.PIG_SADDLED, isSaddled);
sendData(MetaIndex.PIG_SADDLED);
}
/* public int getUnknown() {

View File

@ -13,7 +13,7 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
@ -25,7 +25,7 @@ public class PlayerWatcher extends LivingWatcher {
public PlayerWatcher(Disguise disguise) {
super(disguise);
setData(FlagType.PLAYER_SKIN, FlagType.PLAYER_SKIN.getDefault());
setData(MetaIndex.PLAYER_SKIN, MetaIndex.PLAYER_SKIN.getDefault());
}
public boolean isDisplayedInTab() {
@ -49,12 +49,12 @@ public class PlayerWatcher extends LivingWatcher {
}
public void setMainHand(MainHand mainHand) {
setData(FlagType.PLAYER_HAND, (byte) mainHand.ordinal());
sendData(FlagType.PLAYER_HAND);
setData(MetaIndex.PLAYER_HAND, (byte) mainHand.ordinal());
sendData(MetaIndex.PLAYER_HAND);
}
public MainHand getMainHand() {
return MainHand.values()[getData(FlagType.PLAYER_HAND)];
return MainHand.values()[getData(MetaIndex.PLAYER_HAND)];
}
public BlockFace getSleepingDirection() {
@ -79,7 +79,7 @@ public class PlayerWatcher extends LivingWatcher {
// Bit 6 (0x40): Hat enabled
private boolean isSkinFlag(int i) {
return ((byte) getData(FlagType.PLAYER_SKIN) & 1 << i) != 0;
return ((byte) getData(MetaIndex.PLAYER_SKIN) & 1 << i) != 0;
}
public boolean isCapeEnabled() {
@ -113,43 +113,43 @@ public class PlayerWatcher extends LivingWatcher {
public void setCapeEnabled(boolean enabled) {
setSkinFlags(1, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public void setJacketEnabled(boolean enabled) {
setSkinFlags(2, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public void setLeftSleeveEnabled(boolean enabled) {
setSkinFlags(3, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public void setRightSleeveEnabled(boolean enabled) {
setSkinFlags(4, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public void setLeftPantsEnabled(boolean enabled) {
setSkinFlags(5, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public void setRightPantsEnabled(boolean enabled) {
setSkinFlags(6, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public void setHatEnabled(boolean enabled) {
setSkinFlags(7, enabled);
sendData(FlagType.PLAYER_SKIN);
sendData(MetaIndex.PLAYER_SKIN);
}
public boolean isSleeping() {
@ -228,13 +228,13 @@ public class PlayerWatcher extends LivingWatcher {
}
private void setSkinFlags(int i, boolean flag) {
byte b0 = (byte) getData(FlagType.PLAYER_SKIN);
byte b0 = (byte) getData(MetaIndex.PLAYER_SKIN);
if (flag) {
setData(FlagType.PLAYER_SKIN, (byte) (b0 | 1 << i));
setData(MetaIndex.PLAYER_SKIN, (byte) (b0 | 1 << i));
}
else {
setData(FlagType.PLAYER_SKIN, (byte) (b0 & (~1 << i)));
setData(MetaIndex.PLAYER_SKIN, (byte) (b0 & (~1 << i)));
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class PolarBearWatcher extends AgeableWatcher
{
@ -12,12 +12,12 @@ public class PolarBearWatcher extends AgeableWatcher
public void setStanding(boolean standing)
{
setData(FlagType.POLAR_BEAR_STANDING, standing);
sendData(FlagType.POLAR_BEAR_STANDING);
setData(MetaIndex.POLAR_BEAR_STANDING, standing);
sendData(MetaIndex.POLAR_BEAR_STANDING);
}
public boolean isStanding()
{
return getData(FlagType.POLAR_BEAR_STANDING);
return getData(MetaIndex.POLAR_BEAR_STANDING);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.RabbitType;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
@ -16,13 +16,13 @@ public class RabbitWatcher extends AgeableWatcher
public RabbitType getType()
{
return RabbitType.getType((int) getData(FlagType.RABBIT_TYPE));
return RabbitType.getType((int) getData(MetaIndex.RABBIT_TYPE));
}
public void setType(RabbitType type)
{
setData(FlagType.RABBIT_TYPE, type.getTypeId());
sendData(FlagType.RABBIT_TYPE);
setData(MetaIndex.RABBIT_TYPE, type.getTypeId());
sendData(MetaIndex.RABBIT_TYPE);
}
}

View File

@ -4,7 +4,7 @@ import org.bukkit.DyeColor;
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class SheepWatcher extends AgeableWatcher
{
@ -13,17 +13,17 @@ public class SheepWatcher extends AgeableWatcher
{
super(disguise);
setData(FlagType.SHEEP_WOOL, (byte) 0);
setData(MetaIndex.SHEEP_WOOL, (byte) 0);
}
public AnimalColor getColor()
{
return AnimalColor.getColor(((int) getData(FlagType.SHEEP_WOOL) & 15));
return AnimalColor.getColor(((int) getData(MetaIndex.SHEEP_WOOL) & 15));
}
public boolean isSheared()
{
return ((byte) getData(FlagType.SHEEP_WOOL) & 16) != 0;
return ((byte) getData(MetaIndex.SHEEP_WOOL) & 16) != 0;
}
public void setColor(AnimalColor color)
@ -33,25 +33,25 @@ public class SheepWatcher extends AgeableWatcher
public void setColor(DyeColor color)
{
byte b0 = (byte) getData(FlagType.SHEEP_WOOL);
byte b0 = (byte) getData(MetaIndex.SHEEP_WOOL);
setData(FlagType.SHEEP_WOOL, (byte) (b0 & 240 | color.getWoolData() & 15));
sendData(FlagType.SHEEP_WOOL);
setData(MetaIndex.SHEEP_WOOL, (byte) (b0 & 240 | color.getWoolData() & 15));
sendData(MetaIndex.SHEEP_WOOL);
}
public void setSheared(boolean flag)
{
byte b0 = (byte) getData(FlagType.SHEEP_WOOL);
byte b0 = (byte) getData(MetaIndex.SHEEP_WOOL);
if (flag)
{
setData(FlagType.SHEEP_WOOL, (byte) (b0 | 16));
setData(MetaIndex.SHEEP_WOOL, (byte) (b0 | 16));
}
else
{
setData(FlagType.SHEEP_WOOL, (byte) (b0 & -17));
setData(MetaIndex.SHEEP_WOOL, (byte) (b0 & -17));
}
sendData(FlagType.SHEEP_WOOL);
sendData(MetaIndex.SHEEP_WOOL);
}
}

View File

@ -8,7 +8,7 @@ import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* @author Navid
@ -20,25 +20,25 @@ public class ShulkerWatcher extends InsentientWatcher {
}
public BlockFace getFacingDirection() {
return BlockFace.valueOf(getData(FlagType.SHULKER_FACING).name());
return BlockFace.valueOf(getData(MetaIndex.SHULKER_FACING).name());
}
public void setFacingDirection(BlockFace face) {
setData(FlagType.SHULKER_FACING, Direction.valueOf(face.name()));
sendData(FlagType.SHULKER_FACING);
setData(MetaIndex.SHULKER_FACING, Direction.valueOf(face.name()));
sendData(MetaIndex.SHULKER_FACING);
}
public BlockPosition getAttachmentPosition() {
return getData(FlagType.SHULKER_ATTACHED).get();
return getData(MetaIndex.SHULKER_ATTACHED).get();
}
public void setAttachmentPosition(BlockPosition pos) {
setData(FlagType.SHULKER_ATTACHED, Optional.of(pos));
sendData(FlagType.SHULKER_ATTACHED);
setData(MetaIndex.SHULKER_ATTACHED, Optional.of(pos));
sendData(MetaIndex.SHULKER_ATTACHED);
}
public int getShieldHeight() {
return getData(FlagType.SHULKER_PEEKING);
return getData(MetaIndex.SHULKER_PEEKING);
}
public void setShieldHeight(int newHeight) {
@ -48,12 +48,12 @@ public class ShulkerWatcher extends InsentientWatcher {
if (newHeight > 127)
newHeight = 127;
setData(FlagType.SHULKER_PEEKING, (byte) newHeight);
sendData(FlagType.SHULKER_PEEKING);
setData(MetaIndex.SHULKER_PEEKING, (byte) newHeight);
sendData(MetaIndex.SHULKER_PEEKING);
}
public void setColor(AnimalColor color) {
setData(FlagType.SHULKER_COLOR, (byte) color.getId());
sendData(FlagType.SHULKER_COLOR);
setData(MetaIndex.SHULKER_COLOR, (byte) color.getId());
sendData(MetaIndex.SHULKER_COLOR);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* @author Navid
@ -12,11 +12,11 @@ public class SkeletonWatcher extends InsentientWatcher {
}
public void setSwingArms(boolean swingingArms) {
setData(FlagType.SKELETON_SWING_ARMS, swingingArms);
sendData(FlagType.SKELETON_SWING_ARMS);
setData(MetaIndex.SKELETON_SWING_ARMS, swingingArms);
sendData(MetaIndex.SKELETON_SWING_ARMS);
}
public boolean isSwingArms() {
return getData(FlagType.SKELETON_SWING_ARMS);
return getData(MetaIndex.SKELETON_SWING_ARMS);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
public class SlimeWatcher extends InsentientWatcher
@ -15,7 +15,7 @@ public class SlimeWatcher extends InsentientWatcher
public int getSize()
{
return (int) getData(FlagType.SLIME_SIZE);
return (int) getData(MetaIndex.SLIME_SIZE);
}
public void setSize(int size)
@ -25,8 +25,8 @@ public class SlimeWatcher extends InsentientWatcher
size = 1;
}
setData(FlagType.SLIME_SIZE, size);
sendData(FlagType.SLIME_SIZE);
setData(MetaIndex.SLIME_SIZE, size);
sendData(MetaIndex.SLIME_SIZE);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class SnowmanWatcher extends InsentientWatcher {
public SnowmanWatcher(Disguise disguise) {
@ -9,11 +9,11 @@ public class SnowmanWatcher extends InsentientWatcher {
}
public void setDerp(boolean derp) {
setData(FlagType.SNOWMAN_DERP, (byte) (derp ? 0 : 16));
sendData(FlagType.SNOWMAN_DERP);
setData(MetaIndex.SNOWMAN_DERP, (byte) (derp ? 0 : 16));
sendData(MetaIndex.SNOWMAN_DERP);
}
public boolean isDerp() {
return getData(FlagType.SNOWMAN_DERP) == 0;
return getData(MetaIndex.SNOWMAN_DERP) == 0;
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class SpiderWatcher extends InsentientWatcher
{
@ -12,12 +12,12 @@ public class SpiderWatcher extends InsentientWatcher
public void setClimbing(boolean climbing)
{
setData(FlagType.SPIDER_CLIMB, (byte) (climbing ? 1 : 0));
sendData(FlagType.SPIDER_CLIMB);
setData(MetaIndex.SPIDER_CLIMB, (byte) (climbing ? 1 : 0));
sendData(MetaIndex.SPIDER_CLIMB);
}
public boolean isClimbing()
{
return getData(FlagType.SPIDER_CLIMB) == (byte) 1;
return getData(MetaIndex.SPIDER_CLIMB) == (byte) 1;
}
}

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
@ -27,12 +27,12 @@ public class SplashPotionWatcher extends FlagWatcher {
}
public void setSplashPotion(ItemStack item) {
setData(FlagType.SPLASH_POTION_ITEM, item);
sendData(FlagType.SPLASH_POTION_ITEM);
setData(MetaIndex.SPLASH_POTION_ITEM, item);
sendData(MetaIndex.SPLASH_POTION_ITEM);
}
public ItemStack getSplashPotion() {
return getData(FlagType.SPLASH_POTION_ITEM);
return getData(MetaIndex.SPLASH_POTION_ITEM);
}
public void setPotionId(int newPotionId) {

View File

@ -5,7 +5,7 @@ import java.util.UUID;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class TameableWatcher extends AgeableWatcher
{
@ -16,7 +16,7 @@ public class TameableWatcher extends AgeableWatcher
public Optional<UUID> getOwner()
{
return getData(FlagType.TAMEABLE_OWNER);
return getData(MetaIndex.TAMEABLE_OWNER);
}
public boolean isSitting()
@ -31,29 +31,29 @@ public class TameableWatcher extends AgeableWatcher
protected boolean isTameableFlag(int no)
{
return ((byte) getData(FlagType.TAMEABLE_META) & no) != 0;
return ((byte) getData(MetaIndex.TAMEABLE_META) & no) != 0;
}
protected void setTameableFlag(int no, boolean flag)
{
byte value = (byte) getData(FlagType.TAMEABLE_META);
byte value = (byte) getData(MetaIndex.TAMEABLE_META);
if (flag)
{
setData(FlagType.TAMEABLE_META, (byte) (value | no));
setData(MetaIndex.TAMEABLE_META, (byte) (value | no));
}
else
{
setData(FlagType.TAMEABLE_META, (byte) (value & -(no + 1)));
setData(MetaIndex.TAMEABLE_META, (byte) (value & -(no + 1)));
}
sendData(FlagType.TAMEABLE_META);
sendData(MetaIndex.TAMEABLE_META);
}
public void setOwner(UUID owner)
{
setData(FlagType.TAMEABLE_OWNER, Optional.of(owner));
sendData(FlagType.TAMEABLE_OWNER);
setData(MetaIndex.TAMEABLE_OWNER, Optional.of(owner));
sendData(MetaIndex.TAMEABLE_OWNER);
}
public void setSitting(boolean sitting)

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.Color;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
/**
@ -25,13 +25,13 @@ public class TippedArrowWatcher extends ArrowWatcher
public Color getColor()
{
int color = (int) getData(FlagType.TIPPED_ARROW_COLOR);
int color = (int) getData(MetaIndex.TIPPED_ARROW_COLOR);
return Color.fromRGB(color);
}
public void setColor(Color color)
{
setData(FlagType.TIPPED_ARROW_COLOR, color.asRGB());
sendData(FlagType.TIPPED_ARROW_COLOR);
setData(MetaIndex.TIPPED_ARROW_COLOR, color.asRGB());
sendData(MetaIndex.TIPPED_ARROW_COLOR);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class VexWatcher extends InsentientWatcher {
@ -10,12 +10,12 @@ public class VexWatcher extends InsentientWatcher {
}
public void setAngry(boolean angry) {
setData(FlagType.VEX_ANGRY, (byte) (angry ? 1 : 0));
sendData(FlagType.VEX_ANGRY);
setData(MetaIndex.VEX_ANGRY, (byte) (angry ? 1 : 0));
sendData(MetaIndex.VEX_ANGRY);
}
public boolean isAngry() {
return getData(FlagType.VEX_ANGRY) == 1;
return getData(MetaIndex.VEX_ANGRY) == 1;
}
}

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.entity.Villager.Profession;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
public class VillagerWatcher extends AgeableWatcher {
@ -14,13 +14,13 @@ public class VillagerWatcher extends AgeableWatcher {
}
public Profession getProfession() {
return Profession.values()[getData(FlagType.VILLAGER_PROFESSION)];
return Profession.values()[getData(MetaIndex.VILLAGER_PROFESSION)];
}
@Deprecated
public void setProfession(int professionId) {
setData(FlagType.VILLAGER_PROFESSION, professionId);
sendData(FlagType.VILLAGER_PROFESSION);
setData(MetaIndex.VILLAGER_PROFESSION, professionId);
sendData(MetaIndex.VILLAGER_PROFESSION);
}
public void setProfession(Profession newProfession) {

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class VindicatorWatcher extends InsentientWatcher {
@ -10,8 +10,8 @@ public class VindicatorWatcher extends InsentientWatcher {
}
public void setJohnny(boolean isJohnny) {
setData(FlagType.VINDICATOR_JOHNNY, (byte) (isJohnny ? 1 : 0));
sendData(FlagType.VINDICATOR_JOHNNY);
setData(MetaIndex.VINDICATOR_JOHNNY, (byte) (isJohnny ? 1 : 0));
sendData(MetaIndex.VINDICATOR_JOHNNY);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
/**
* @author Navid
@ -16,13 +16,13 @@ public class WitchWatcher extends InsentientWatcher
public boolean isAggressive()
{
return (boolean) getData(FlagType.WITCH_AGGRESSIVE);
return (boolean) getData(MetaIndex.WITCH_AGGRESSIVE);
}
public void setAggressive(boolean aggressive)
{
setData(FlagType.WITCH_AGGRESSIVE, aggressive);
sendData(FlagType.WITCH_AGGRESSIVE);
setData(MetaIndex.WITCH_AGGRESSIVE, aggressive);
sendData(MetaIndex.WITCH_AGGRESSIVE);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
public class WitherSkullWatcher extends FlagWatcher
@ -14,13 +14,13 @@ public class WitherSkullWatcher extends FlagWatcher
public boolean isBlue()
{
return (boolean) getData(FlagType.WITHER_SKULL_BLUE);
return (boolean) getData(MetaIndex.WITHER_SKULL_BLUE);
}
public void setBlue(boolean blue)
{
setData(FlagType.WITHER_SKULL_BLUE, blue);
sendData(FlagType.WITHER_SKULL_BLUE);
setData(MetaIndex.WITHER_SKULL_BLUE, blue);
sendData(MetaIndex.WITHER_SKULL_BLUE);
}
}

View File

@ -5,7 +5,7 @@ import java.security.InvalidParameterException;
import org.bukkit.ChatColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class WitherWatcher extends InsentientWatcher
{
@ -22,14 +22,14 @@ public class WitherWatcher extends InsentientWatcher
*/
public int getInvulnerability()
{
return (int) getData(FlagType.WITHER_INVUL);
return (int) getData(MetaIndex.WITHER_INVUL);
}
public int[] getTargets()
{
return new int[]
{
getData(FlagType.WITHER_TARGET_1), getData(FlagType.WITHER_TARGET_2), getData(FlagType.WITHER_TARGET_3)
getData(MetaIndex.WITHER_TARGET_1), getData(MetaIndex.WITHER_TARGET_2), getData(MetaIndex.WITHER_TARGET_3)
};
}
@ -38,8 +38,8 @@ public class WitherWatcher extends InsentientWatcher
*/
public void setInvulnerability(int invulnerability)
{
setData(FlagType.WITHER_INVUL, invulnerability);
sendData(FlagType.WITHER_INVUL);
setData(MetaIndex.WITHER_INVUL, invulnerability);
sendData(MetaIndex.WITHER_INVUL);
}
public void setTargets(int... targets)
@ -49,10 +49,10 @@ public class WitherWatcher extends InsentientWatcher
throw new InvalidParameterException(
ChatColor.RED + "Expected 3 numbers for wither setTargets. Received " + targets.length);
}
setData(FlagType.WITHER_TARGET_1, targets[0]);
setData(FlagType.WITHER_TARGET_2, targets[1]);
setData(FlagType.WITHER_TARGET_3, targets[2]);
sendData(FlagType.WITHER_TARGET_1, FlagType.WITHER_TARGET_2, FlagType.WITHER_TARGET_3);
setData(MetaIndex.WITHER_TARGET_1, targets[0]);
setData(MetaIndex.WITHER_TARGET_2, targets[1]);
setData(MetaIndex.WITHER_TARGET_3, targets[2]);
sendData(MetaIndex.WITHER_TARGET_1, MetaIndex.WITHER_TARGET_2, MetaIndex.WITHER_TARGET_3);
}
}

View File

@ -4,7 +4,7 @@ import org.bukkit.DyeColor;
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class WolfWatcher extends TameableWatcher
{
@ -16,7 +16,7 @@ public class WolfWatcher extends TameableWatcher
public AnimalColor getCollarColor()
{
return AnimalColor.getColor(getData(FlagType.WOLF_COLLAR));
return AnimalColor.getColor(getData(MetaIndex.WOLF_COLLAR));
}
/**
@ -26,7 +26,7 @@ public class WolfWatcher extends TameableWatcher
*/
public float getDamageTaken()
{
return (float) getData(FlagType.WOLF_DAMAGE);
return (float) getData(MetaIndex.WOLF_DAMAGE);
}
/**
@ -36,19 +36,19 @@ public class WolfWatcher extends TameableWatcher
*/
public void setDamageTaken(float damage)
{
setData(FlagType.WOLF_DAMAGE, damage);
sendData(FlagType.WOLF_DAMAGE);
setData(MetaIndex.WOLF_DAMAGE, damage);
sendData(MetaIndex.WOLF_DAMAGE);
}
public boolean isBegging()
{
return (boolean) getData(FlagType.WOLF_BEGGING);
return (boolean) getData(MetaIndex.WOLF_BEGGING);
}
public void setBegging(boolean begging)
{
setData(FlagType.WOLF_BEGGING, begging);
sendData(FlagType.WOLF_BEGGING);
setData(MetaIndex.WOLF_BEGGING, begging);
sendData(MetaIndex.WOLF_BEGGING);
}
public boolean isAngry()
@ -78,8 +78,8 @@ public class WolfWatcher extends TameableWatcher
return;
}
setData(FlagType.WOLF_COLLAR, (int) newColor.getDyeData());
sendData(FlagType.WOLF_COLLAR);
setData(MetaIndex.WOLF_COLLAR, (int) newColor.getDyeData());
sendData(MetaIndex.WOLF_COLLAR);
}
}

View File

@ -3,7 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.entity.Villager.Profession;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class ZombieVillagerWatcher extends ZombieWatcher {
@ -12,7 +12,7 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
}
public boolean isShaking() {
return getData(FlagType.ZOMBIE_VILLAGER_SHAKING);
return getData(MetaIndex.ZOMBIE_VILLAGER_SHAKING);
}
/**
@ -21,12 +21,12 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
* @return
*/
public boolean isVillager() {
return ((int) getData(FlagType.ZOMBIE_VILLAGER_PROFESSION)) != 0;
return ((int) getData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION)) != 0;
}
public void setShaking(boolean shaking) {
setData(FlagType.ZOMBIE_VILLAGER_SHAKING, shaking);
sendData(FlagType.ZOMBIE_VILLAGER_SHAKING);
setData(MetaIndex.ZOMBIE_VILLAGER_SHAKING, shaking);
sendData(MetaIndex.ZOMBIE_VILLAGER_SHAKING);
}
/**
@ -35,7 +35,7 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
* @return
*/
public Profession getProfession() {
return Profession.values()[getData(FlagType.ZOMBIE_VILLAGER_PROFESSION)];
return Profession.values()[getData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION)];
}
/**
@ -45,8 +45,8 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
*/
@Deprecated
public void setProfession(int id) {
setData(FlagType.ZOMBIE_VILLAGER_PROFESSION, id);
sendData(FlagType.ZOMBIE_VILLAGER_PROFESSION);
setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, id);
sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION);
}
/**
@ -55,8 +55,8 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
* @param profession
*/
public void setProfession(Profession profession) {
setData(FlagType.ZOMBIE_VILLAGER_PROFESSION, profession.ordinal());
sendData(FlagType.ZOMBIE_VILLAGER_PROFESSION);
setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, profession.ordinal());
sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION);
}
}

View File

@ -1,7 +1,7 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
public class ZombieWatcher extends InsentientWatcher {
@ -14,11 +14,11 @@ public class ZombieWatcher extends InsentientWatcher {
}
public boolean isBaby() {
return getData(FlagType.ZOMBIE_BABY);
return getData(MetaIndex.ZOMBIE_BABY);
}
public boolean isAggressive() {
return (boolean) getData(FlagType.ZOMBIE_AGGRESSIVE);
return (boolean) getData(MetaIndex.ZOMBIE_AGGRESSIVE);
}
public void setAdult() {
@ -30,13 +30,13 @@ public class ZombieWatcher extends InsentientWatcher {
}
public void setBaby(boolean baby) {
setData(FlagType.ZOMBIE_BABY, baby);
sendData(FlagType.ZOMBIE_BABY);
setData(MetaIndex.ZOMBIE_BABY, baby);
sendData(MetaIndex.ZOMBIE_BABY);
}
public void setAggressive(boolean handsup) {
setData(FlagType.ZOMBIE_AGGRESSIVE, handsup);
sendData(FlagType.ZOMBIE_AGGRESSIVE);
setData(MetaIndex.ZOMBIE_AGGRESSIVE, handsup);
sendData(MetaIndex.ZOMBIE_AGGRESSIVE);
}
}

View File

@ -42,7 +42,7 @@ import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.FlagType;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
@ -361,7 +361,7 @@ public class PacketsManager {
spawnPlayer.getDataWatcherModifier().write(0, newWatcher);
// Make him invisible
newWatcher.setObject(new WrappedDataWatcherObject(FlagType.ENTITY_META.getIndex(), Registry.get(Byte.class)),
newWatcher.setObject(new WrappedDataWatcherObject(MetaIndex.ENTITY_META.getIndex(), Registry.get(Byte.class)),
(byte) 32);
packets.addPacket(spawnPlayer);