mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-11 01:38:07 +02:00
Add check for null watchable object
This commit is contained in:
parent
5a2f64bca4
commit
2c7a6e2b43
@ -1058,6 +1058,7 @@ public class PacketsManager {
|
||||
WrappedWatchableObject watch = ReflectionManager
|
||||
.createWatchable(0, WrappedDataWatcher.getEntityWatcher(entity).getByte(0));
|
||||
|
||||
if (watch != null)
|
||||
list.add(watch);
|
||||
|
||||
list = disguise.getWatcher().convert(list);
|
||||
|
@ -887,7 +887,9 @@ public class ReflectionManager {
|
||||
}
|
||||
|
||||
public static WrappedWatchableObject createWatchable(int index, Object obj) {
|
||||
return new WrappedWatchableObject(createDataWatcherItem(index, obj));
|
||||
Object watcherItem = createDataWatcherItem(index, obj);
|
||||
|
||||
return new WrappedWatchableObject(watcherItem);
|
||||
}
|
||||
|
||||
public static int getCombinedId(int id, int data) {
|
||||
|
@ -118,8 +118,7 @@ public class PacketListenerViewDisguises extends PacketAdapter {
|
||||
watch.setValue(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.getPacketType() == Server.NAMED_ENTITY_SPAWN) {
|
||||
} else if (event.getPacketType() == Server.NAMED_ENTITY_SPAWN) {
|
||||
event.setCancelled(true);
|
||||
|
||||
PacketContainer packet = new PacketContainer(Server.ENTITY_METADATA);
|
||||
@ -136,7 +135,9 @@ public class PacketListenerViewDisguises extends PacketAdapter {
|
||||
|
||||
WrappedWatchableObject watch = ReflectionManager.createWatchable(0, b);
|
||||
|
||||
if (watch != null)
|
||||
watchableList.add(watch);
|
||||
|
||||
packet.getWatchableCollectionModifier().write(0, watchableList);
|
||||
|
||||
try {
|
||||
@ -145,21 +146,20 @@ public class PacketListenerViewDisguises extends PacketAdapter {
|
||||
catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (event.getPacketType() == Server.ANIMATION) {
|
||||
} else if (event.getPacketType() == Server.ANIMATION) {
|
||||
if (event.getPacket().getIntegers().read(1) != 2) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else if (event.getPacketType() == Server.ATTACH_ENTITY || event.getPacketType() == Server.REL_ENTITY_MOVE
|
||||
|| event.getPacketType() == Server.REL_ENTITY_MOVE_LOOK || event.getPacketType() == Server.ENTITY_LOOK
|
||||
|| event.getPacketType() == Server.ENTITY_TELEPORT || event.getPacketType() == Server.ENTITY_HEAD_ROTATION
|
||||
|| event.getPacketType() == Server.ENTITY_EQUIPMENT) {
|
||||
} else if (event.getPacketType() == Server.ATTACH_ENTITY || event
|
||||
.getPacketType() == Server.REL_ENTITY_MOVE || event
|
||||
.getPacketType() == Server.REL_ENTITY_MOVE_LOOK || event
|
||||
.getPacketType() == Server.ENTITY_LOOK || event.getPacketType() == Server.ENTITY_TELEPORT || event
|
||||
.getPacketType() == Server.ENTITY_HEAD_ROTATION || event
|
||||
.getPacketType() == Server.ENTITY_EQUIPMENT) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (event.getPacketType() == Server.ENTITY_STATUS) {
|
||||
if (disguise.isSelfDisguiseSoundsReplaced() && !disguise.getType().isPlayer()
|
||||
&& event.getPacket().getBytes().read(0) == 2) {
|
||||
} else if (event.getPacketType() == Server.ENTITY_STATUS) {
|
||||
if (disguise.isSelfDisguiseSoundsReplaced() && !disguise.getType().isPlayer() && event.getPacket()
|
||||
.getBytes().read(0) == 2) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user