Fix evoker fangs, thanks <@473314146453291009>
This commit is contained in:
parent
b1521ce9ac
commit
3aef445341
@ -1372,15 +1372,8 @@ public class DisguiseUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PacketContainer destroyPacket = getDestroyPacket(disguise.getEntity().getEntityId());
|
|
||||||
|
|
||||||
if (disguise.isDisguiseInUse() && disguise.getEntity() instanceof Player && disguise.getEntity().getName().equalsIgnoreCase(player)) {
|
if (disguise.isDisguiseInUse() && disguise.getEntity() instanceof Player && disguise.getEntity().getName().equalsIgnoreCase(player)) {
|
||||||
removeSelfDisguise(disguise);
|
PacketContainer destroyPacket = getDestroyPacket(DisguiseAPI.getSelfDisguiseId());
|
||||||
|
|
||||||
if (disguise.isSelfDisguiseVisible()) {
|
|
||||||
selfDisguised.add(disguise.getEntity().getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket((Player) disguise.getEntity(), destroyPacket);
|
ProtocolLibrary.getProtocolManager().sendServerPacket((Player) disguise.getEntity(), destroyPacket);
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> {
|
||||||
@ -1405,6 +1398,8 @@ public class DisguiseUtilities {
|
|||||||
final Method updatePlayer = ReflectionManager.getNmsMethod("EntityTrackerEntry", NmsVersion.v1_14.isSupported() ? "b" : "updatePlayer",
|
final Method updatePlayer = ReflectionManager.getNmsMethod("EntityTrackerEntry", NmsVersion.v1_14.isSupported() ? "b" : "updatePlayer",
|
||||||
ReflectionManager.getNmsClass("EntityPlayer"));
|
ReflectionManager.getNmsClass("EntityPlayer"));
|
||||||
|
|
||||||
|
PacketContainer destroyPacket = getDestroyPacket(disguise.getEntity().getEntityId());
|
||||||
|
|
||||||
trackedPlayers = (Set) new HashSet(trackedPlayers).clone(); // Copy before iterating to prevent
|
trackedPlayers = (Set) new HashSet(trackedPlayers).clone(); // Copy before iterating to prevent
|
||||||
// ConcurrentModificationException
|
// ConcurrentModificationException
|
||||||
for (final Object p : trackedPlayers) {
|
for (final Object p : trackedPlayers) {
|
||||||
@ -1498,14 +1493,11 @@ public class DisguiseUtilities {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (selfDisguised.contains(disguise.getEntity().getUniqueId()) && disguise.isDisguiseInUse()) {
|
if (selfDisguised.contains(disguise.getEntity().getUniqueId()) && disguise.isDisguiseInUse()) {
|
||||||
removeSelfDisguise(disguise);
|
|
||||||
|
|
||||||
selfDisguised.add(disguise.getEntity().getUniqueId());
|
|
||||||
|
|
||||||
PacketContainer destroyPacket = getDestroyPacket(DisguiseAPI.getSelfDisguiseId());
|
PacketContainer destroyPacket = getDestroyPacket(DisguiseAPI.getSelfDisguiseId());
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket((Player) disguise.getEntity(), destroyPacket);
|
ProtocolLibrary.getProtocolManager().sendServerPacket((Player) disguise.getEntity(), destroyPacket);
|
||||||
|
|
||||||
|
removeSelfTracker((Player) disguise.getEntity());
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> {
|
||||||
try {
|
try {
|
||||||
DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise);
|
DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise);
|
||||||
@ -1623,6 +1615,21 @@ public class DisguiseUtilities {
|
|||||||
selfDisguised.remove(player.getUniqueId());
|
selfDisguised.remove(player.getUniqueId());
|
||||||
// Get the entity tracker
|
// Get the entity tracker
|
||||||
|
|
||||||
|
removeSelfTracker(player);
|
||||||
|
|
||||||
|
// Resend entity metadata else he will be invisible to himself until its resent
|
||||||
|
try {
|
||||||
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, ProtocolLibrary.getProtocolManager()
|
||||||
|
.createPacketConstructor(Server.ENTITY_METADATA, player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true)
|
||||||
|
.createPacket(player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
player.updateInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void removeSelfTracker(Player player) {
|
||||||
try {
|
try {
|
||||||
Object entityTrackerEntry = ReflectionManager.getEntityTrackerEntry(player);
|
Object entityTrackerEntry = ReflectionManager.getEntityTrackerEntry(player);
|
||||||
|
|
||||||
@ -1641,17 +1648,6 @@ public class DisguiseUtilities {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resend entity metadata else he will be invisible to himself until its resent
|
|
||||||
try {
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, ProtocolLibrary.getProtocolManager()
|
|
||||||
.createPacketConstructor(Server.ENTITY_METADATA, player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true)
|
|
||||||
.createPacket(player.getEntityId(), WrappedDataWatcher.getEntityWatcher(player), true));
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Scoreboard> getAllScoreboards() {
|
public static List<Scoreboard> getAllScoreboards() {
|
||||||
|
Loading…
Reference in New Issue
Block a user