mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
setAccessible(true) on legacy cache methods
This commit is contained in:
parent
cf1f2f8f03
commit
833713bee2
1 changed files with 2 additions and 0 deletions
|
@ -289,6 +289,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf {
|
||||||
private void legacyMaximumSize(CacheBuilder builder, int maxCount) {
|
private void legacyMaximumSize(CacheBuilder builder, int maxCount) {
|
||||||
try {
|
try {
|
||||||
Method maxSizeLegacy = builder.getClass().getDeclaredMethod("maximumSize", Integer.TYPE);
|
Method maxSizeLegacy = builder.getClass().getDeclaredMethod("maximumSize", Integer.TYPE);
|
||||||
|
maxSizeLegacy.setAccessible(true);
|
||||||
maxSizeLegacy.invoke(builder, maxCount);
|
maxSizeLegacy.invoke(builder, maxCount);
|
||||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -307,6 +308,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf {
|
||||||
Cache<String, User> legacyUsers;
|
Cache<String, User> legacyUsers;
|
||||||
try {
|
try {
|
||||||
assert build != null;
|
assert build != null;
|
||||||
|
build.setAccessible(true);
|
||||||
legacyUsers = (Cache<String, User>) build.invoke(builder, this);
|
legacyUsers = (Cache<String, User>) build.invoke(builder, this);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
legacyUsers = null;
|
legacyUsers = null;
|
||||||
|
|
Loading…
Reference in a new issue