Fix flag watcher not working, fix error with gethandle

This commit is contained in:
libraryaddict 2013-11-19 08:48:26 +13:00
parent 4e101c3ec6
commit e02e1c9e6b
4 changed files with 7 additions and 7 deletions

View File

@ -186,7 +186,7 @@ public class LibsDisguises extends JavaPlugin {
WrappedDataWatcher dataWatcher = WrappedDataWatcher.getEntityWatcher(bukkitEntity); WrappedDataWatcher dataWatcher = WrappedDataWatcher.getEntityWatcher(bukkitEntity);
List<WrappedWatchableObject> watchers = dataWatcher.getWatchableObjects(); List<WrappedWatchableObject> watchers = dataWatcher.getWatchableObjects();
for (WrappedWatchableObject watch : watchers) for (WrappedWatchableObject watch : watchers)
value.setMetaValue(watch.getTypeID(), watch.getValue()); value.setMetaValue(watch.getIndex(), watch.getValue());
DisguiseSound sound = DisguiseSound.getType(disguiseType.name()); DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
if (sound != null) { if (sound != null) {
Float soundStrength = ReflectionManager.getSoundModifier(entity); Float soundStrength = ReflectionManager.getSoundModifier(entity);

View File

@ -639,7 +639,7 @@ public class PacketsManager {
.iterator(); .iterator();
while (itel.hasNext()) { while (itel.hasNext()) {
WrappedWatchableObject watch = itel.next(); WrappedWatchableObject watch = itel.next();
if (watch.getTypeID() == 0) { if (watch.getIndex() == 0) {
byte b = (Byte) watch.getValue(); byte b = (Byte) watch.getValue();
byte a = (byte) (b | 1 << 5); byte a = (byte) (b | 1 << 5);
if ((b & 1 << 3) != 0) if ((b & 1 << 3) != 0)

View File

@ -13,7 +13,6 @@ import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -212,7 +211,6 @@ public abstract class Disguise {
} }
try { try {
Field ping = ReflectionManager.getNmsClass("EntityPlayer").getField("ping"); Field ping = ReflectionManager.getNmsClass("EntityPlayer").getField("ping");
Field handle = Entity.class.getField("getHandle");
for (Player player : getPerverts()) { for (Player player : getPerverts()) {
PacketContainer packet = new PacketContainer(Packets.Server.ENTITY_VELOCITY); PacketContainer packet = new PacketContainer(Packets.Server.ENTITY_VELOCITY);
StructureModifier<Object> mods = packet.getModifier(); StructureModifier<Object> mods = packet.getModifier();
@ -231,7 +229,9 @@ public abstract class Disguise {
} else } else
mods.write(0, entity.getEntityId()); mods.write(0, entity.getEntityId());
mods.write(1, (int) (vector.getX() * 8000)); mods.write(1, (int) (vector.getX() * 8000));
mods.write(2, (int) (8000 * (vectorY * (double) ping.getInt(handle.get(player)) * 0.069))); mods.write(
2,
(int) (8000 * (vectorY * (double) ping.getInt(ReflectionManager.getNmsEntity(player)) * 0.069)));
mods.write(3, (int) (vector.getZ() * 8000)); mods.write(3, (int) (vector.getZ() * 8000));
if (lookPacket != null) if (lookPacket != null)
ProtocolLibrary.getProtocolManager().sendServerPacket(player, lookPacket, false); ProtocolLibrary.getProtocolManager().sendServerPacket(player, lookPacket, false);

View File

@ -68,7 +68,7 @@ public class FlagWatcher {
boolean sendAllCustom = false; boolean sendAllCustom = false;
while (itel.hasNext()) { while (itel.hasNext()) {
WrappedWatchableObject watch = itel.next(); WrappedWatchableObject watch = itel.next();
int dataType = watch.getTypeID(); int dataType = watch.getIndex();
sentValues.add(dataType); sentValues.add(dataType);
// Its sending the air metadata. This is the least commonly sent metadata which all entitys still share. // 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! // I send my custom values if I see this!
@ -113,7 +113,7 @@ public class FlagWatcher {
if (disguise.viewSelfDisguise() && disguise.getEntity() != null && disguise.getEntity() instanceof Player) { if (disguise.viewSelfDisguise() && disguise.getEntity() != null && disguise.getEntity() instanceof Player) {
for (WrappedWatchableObject watch : newList) { for (WrappedWatchableObject watch : newList) {
// Its a health packet // Its a health packet
if (watch.getTypeID() == 6) { if (watch.getIndex() == 6) {
Object value = watch.getValue(); Object value = watch.getValue();
if (value != null && value instanceof Float) { if (value != null && value instanceof Float) {
float newHealth = (Float) value; float newHealth = (Float) value;