Try fix the sudden surge of DisguiseAPI errors

This commit is contained in:
libraryaddict 2021-11-22 20:28:33 +13:00
parent 89ebb84c99
commit 036eac42b8

View File

@ -31,13 +31,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class DisguiseAPI { public class DisguiseAPI {
private final static int selfDisguiseId; private static int selfDisguiseId;
@Getter private static int entityAttachmentId;
private final static int entityAttachmentId;
static { public static int getEntityAttachmentId() {
selfDisguiseId = ReflectionManager.getNewEntityId(true); if (entityAttachmentId == 0) {
entityAttachmentId = ReflectionManager.getNewEntityId(true); entityAttachmentId = ReflectionManager.getNewEntityId();
}
return entityAttachmentId;
} }
public static void addCustomDisguise(String disguiseName, String disguiseInfo) throws DisguiseParseException { public static void addCustomDisguise(String disguiseName, String disguiseInfo) throws DisguiseParseException {
@ -381,6 +383,10 @@ public class DisguiseAPI {
} }
public static int getSelfDisguiseId() { public static int getSelfDisguiseId() {
if (selfDisguiseId == 0) {
selfDisguiseId = ReflectionManager.getNewEntityId();
}
return selfDisguiseId; return selfDisguiseId;
} }