File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
api/src/main/java/com/javadiscord/jdi/core/api/utils Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ public <T> void updateCache(T result) {
21
21
Field guildIdField = result .getClass ().getDeclaredField ("guildId" );
22
22
Field idField = result .getClass ().getDeclaredField ("id" );
23
23
24
- long guildId = getLongFromField (guildIdField );
25
- long id = getLongFromField (idField );
24
+ long guildId = getLongFromField (guildIdField , result );
25
+ long id = getLongFromField (idField , result );
26
26
27
27
cache .getCacheForGuild (guildId ).add (id , result );
28
28
} catch (IllegalAccessException | NoSuchFieldException e ) {
@@ -34,11 +34,11 @@ public <T> void updateCache(List<T> resultList) {
34
34
resultList .forEach (this ::updateCache );
35
35
}
36
36
37
- private long getLongFromField (Field field ) throws IllegalAccessException {
37
+ private < T > long getLongFromField (Field field , T result ) throws IllegalAccessException {
38
38
field .setAccessible (true );
39
39
if (field .getType () == String .class ) {
40
- return Long .parseLong ((String ) field .get (field . getName () ));
40
+ return Long .parseLong ((String ) field .get (result ));
41
41
}
42
- return (long ) field .get (field . getName () );
42
+ return (long ) field .get (result );
43
43
}
44
44
}
You can’t perform that action at this time.
0 commit comments