Set the values of the new flag watcher

This commit is contained in:
Andrew 2013-07-12 06:37:35 +12:00
parent fe07ea3e9f
commit bb04421378

View File

@ -32,7 +32,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
public class Disguise { public class Disguise {
protected DisguiseType disguiseType; private DisguiseType disguiseType;
private boolean replaceSounds; private boolean replaceSounds;
private FlagWatcher watcher; private FlagWatcher watcher;
@ -246,14 +246,17 @@ public class Disguise {
else else
watcher = new FlagWatcher(entityId); watcher = new FlagWatcher(entityId);
} }
WatcherValues entity = WatcherValues.valueOf(getType().name()); HashMap<Integer, Object> entity = Values.getMetaValues(DisguiseType.getType(type));
WatcherValues disguise = WatcherValues.valueOf(getType().name()); HashMap<Integer, Object> disguise = Values.getMetaValues(getType());
for (int i : entity.getValues()) { for (int i : entity.keySet()) {
if (disguise.getValue(i) != null && disguise.getValue(i).getClass() != entity.getValue(i).getClass()) if (!disguise.containsKey(i) || entity.get(i) != disguise.get(i) || entity.get(i).getClass() != disguise.get(i)) {
// watcher.setValue(i, disguise.getValue(i)); if (disguise.containsKey(i))
watcher.setValue(i, disguise.get(i));
else
watcher.setValue(i, null); watcher.setValue(i, null);
} }
} }
}
public DisguiseType getType() { public DisguiseType getType() {
return disguiseType; return disguiseType;