Fix setCustomName

This commit is contained in:
libraryaddict
2020-05-08 17:26:07 +12:00
parent 62b4408e21
commit 7efb85db7c
3 changed files with 22 additions and 8 deletions

View File

@@ -217,18 +217,22 @@ public class DisguiseParser {
}
private static void addWatcherDefault(Method setMethod, Method getMethod, Object object) {
Map.Entry<Method, Object> entry = new HashMap.SimpleEntry<>(getMethod, object);
if (defaultWatcherValues.containsKey(setMethod)) {
Object dObj = defaultWatcherValues.get(setMethod);
Object dObj = defaultWatcherValues.get(setMethod).getValue();
if (!Objects.deepEquals(defaultWatcherValues.get(setMethod).getValue(), object)) {
throw new IllegalStateException(String.format("%s has conflicting values!", setMethod.getName()));
if (!Objects.deepEquals(dObj, object)) {
throw new IllegalStateException(String.format(
"%s has conflicting values! This means it expected the same value again but received a " +
"different value on a different disguise! %s is not the same as %s!", setMethod.getName(), object,
dObj));
}
return;
}
Map.Entry<Method, Object> entry = new HashMap.SimpleEntry<>(getMethod, object);
defaultWatcherValues.put(setMethod, entry);
}