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.
|
// 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);
|
PacketContainer[] packets = transformPacket(event.getPacket(), observer, observer);
|
||||||
if (packets != null) {
|
if (packets != null) {
|
||||||
final PacketContainer[] delayedPackets = new PacketContainer[packets.length > 0 ? packets.length - 1
|
|
||||||
: 0];
|
|
||||||
for (int i = 0; i < packets.length; i++) {
|
for (int i = 0; i < packets.length; i++) {
|
||||||
PacketContainer packet = packets[i];
|
PacketContainer packet = packets[i];
|
||||||
if (packet.equals(event.getPacket())) {
|
if (packet.equals(event.getPacket())) {
|
||||||
packet = packet.deepClone();
|
packet = packet.deepClone();
|
||||||
}
|
}
|
||||||
packet.getModifier().write(0, fakeId);
|
packet.getModifier().write(0, fakeId);
|
||||||
if (i == 0) {
|
|
||||||
try {
|
try {
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
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) {
|
if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
|
||||||
|
Loading…
Reference in New Issue
Block a user