From a27857ce1d98b9576331f5aec5a67b04ba12061f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 31 Jul 2017 07:42:43 +1200 Subject: [PATCH] Hopefully fix a bungeecord error --- src/me/libraryaddict/disguise/DisguiseAPI.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java index bc20ab02..c86ef023 100644 --- a/src/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -1,5 +1,6 @@ package me.libraryaddict.disguise; +import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; @@ -35,6 +36,19 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.ReflectionManager; public class DisguiseAPI { + private static int selfDisguiseId; + + static { + try { + Field field = ReflectionManager.getNmsField("Entity", "entityCount"); + selfDisguiseId = field.getInt(null); + field.set(null, selfDisguiseId + 1); + } + catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + public static Disguise getCustomDisguise(String disguiseName) { Map.Entry entry = DisguiseConfig.getCustomDisguise(disguiseName); @@ -360,7 +374,7 @@ public class DisguiseAPI { } public static int getSelfDisguiseId() { - return -10; + return selfDisguiseId; } /**