mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
I forget why we delay them. I think I had a really really good reason.
This commit is contained in:
parent
1dbe7ad056
commit
b5c8d69398
@ -712,36 +712,17 @@ public class PacketsManager {
|
||||
// Here I grab the packets to convert them to, So I can display them as if the disguise sent them.
|
||||
PacketContainer[] packets = transformPacket(event.getPacket(), observer, observer);
|
||||
if (packets != null) {
|
||||
final PacketContainer[] delayedPackets = new PacketContainer[packets.length > 0 ? packets.length - 1
|
||||
: 0];
|
||||
for (int i = 0; i < packets.length; i++) {
|
||||
PacketContainer packet = packets[i];
|
||||
if (packet.equals(event.getPacket())) {
|
||||
packet = packet.deepClone();
|
||||
}
|
||||
packet.getModifier().write(0, fakeId);
|
||||
if (i == 0) {
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
delayedPackets[i - 1] = packet;
|
||||
}
|
||||
}
|
||||
if (delayedPackets.length > 0) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
for (PacketContainer packet : delayedPackets) {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false);
|
||||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
|
||||
|
Loading…
Reference in New Issue
Block a user