Fix up self disguises flicking and Evoker Fangs
This commit is contained in:
parent
ce134af4fa
commit
eb1733262f
@ -209,7 +209,7 @@ public abstract class Disguise {
|
||||
if (getType() == DisguiseType.FIREWORK) {
|
||||
refreshDisguise++;
|
||||
|
||||
if (refreshDisguise % 40 == 0) {
|
||||
if (refreshDisguise == 40) {
|
||||
refreshDisguise = 0;
|
||||
|
||||
DisguiseUtilities.refreshTrackers(disguise);
|
||||
@ -218,7 +218,7 @@ public abstract class Disguise {
|
||||
else if (getType() == DisguiseType.EVOKER_FANGS) {
|
||||
refreshDisguise++;
|
||||
|
||||
if (refreshDisguise % 20 == 0) {
|
||||
if (refreshDisguise == 23) {
|
||||
refreshDisguise = 0;
|
||||
|
||||
DisguiseUtilities.refreshTrackers(disguise);
|
||||
|
@ -880,7 +880,10 @@ public class DisguiseUtilities {
|
||||
if (mainThread != Thread.currentThread())
|
||||
throw new IllegalStateException("Cannot modify disguises on an async thread");
|
||||
|
||||
if (disguise.getEntity().isValid()) {
|
||||
if (!disguise.getEntity().isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PacketContainer destroyPacket = getDestroyPacket(disguise.getEntity().getEntityId());
|
||||
|
||||
try {
|
||||
@ -942,12 +945,8 @@ public class DisguiseUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (
|
||||
|
||||
Exception ex) {
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.PacketType.Play.Server;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
@ -46,6 +47,14 @@ public class PacketListenerViewDisguises extends PacketAdapter {
|
||||
}
|
||||
|
||||
if (!DisguiseAPI.isSelfDisguised(observer)) {
|
||||
if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
|
||||
Disguise disguise = DisguiseAPI.getDisguise(observer, observer);
|
||||
|
||||
if (disguise != null && disguise.isSelfDisguiseVisible()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user