mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-13 10:25:14 +01:00
Dont delay a teleportion
This commit is contained in:
parent
bae41272dd
commit
a39ca29aef
@ -231,7 +231,7 @@ public class PlayerSkinHandler implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void addMetadata(Player player, PlayerSkin skin) {
|
||||
private void addMetadata(Player player, PlayerSkin skin) throws InvocationTargetException {
|
||||
PlayerDisguise disguise = skin.getDisguise().get();
|
||||
Entity entity = disguise.getEntity();
|
||||
WrappedDataWatcher watcher = DisguiseUtilities
|
||||
@ -241,10 +241,11 @@ public class PlayerSkinHandler implements Listener {
|
||||
.createPacketConstructor(PacketType.Play.Server.ENTITY_METADATA, entity.getEntityId(), watcher, true)
|
||||
.createPacket(entity.getEntityId(), watcher, true);
|
||||
|
||||
skin.getSleptPackets().computeIfAbsent(4, (a) -> new ArrayList<>()).add(metaPacket);
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, metaPacket, false);
|
||||
|
||||
}
|
||||
|
||||
private void addTeleport(Player player, PlayerSkin skin) {
|
||||
private void addTeleport(Player player, PlayerSkin skin) throws InvocationTargetException {
|
||||
PlayerDisguise disguise = skin.getDisguise().get();
|
||||
|
||||
PacketContainer teleport = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
|
||||
@ -284,7 +285,7 @@ public class PlayerSkinHandler implements Listener {
|
||||
mods.write(4, yaw);
|
||||
mods.write(5, pitch);
|
||||
|
||||
skin.getSleptPackets().computeIfAbsent(0, (a) -> new ArrayList<>()).add(teleport);
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, teleport, false);
|
||||
}
|
||||
|
||||
private void doPacketRemoval(Player player, PlayerSkin skin) {
|
||||
@ -294,11 +295,6 @@ public class PlayerSkinHandler implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skin.isSleepPackets()) {
|
||||
addTeleport(player, skin);
|
||||
addMetadata(player, skin);
|
||||
}
|
||||
|
||||
try {
|
||||
for (Map.Entry<Integer, ArrayList<PacketContainer>> entry : skin.getSleptPackets().entrySet()) {
|
||||
if (entry.getKey() == 0) {
|
||||
@ -325,6 +321,11 @@ public class PlayerSkinHandler implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (skin.isSleepPackets()) {
|
||||
addTeleport(player, skin);
|
||||
addMetadata(player, skin);
|
||||
}
|
||||
|
||||
if (skin.isDoTabList()) {
|
||||
PacketContainer packetContainer =
|
||||
DisguiseUtilities.getTabPacket(disguise, EnumWrappers.PlayerInfoAction.REMOVE_PLAYER);
|
||||
|
Loading…
Reference in New Issue
Block a user