Be more safe
This commit is contained in:
parent
81c4e530e9
commit
da7f8ea3b6
|
@ -49,9 +49,6 @@ public class JoinListener implements Listener {
|
||||||
conn = findField(gh.getReturnType(), "PlayerConnection", "ServerGamePacketListenerImpl");
|
conn = findField(gh.getReturnType(), "PlayerConnection", "ServerGamePacketListenerImpl");
|
||||||
nm = findField(conn.getType(), "NetworkManager", "Connection");
|
nm = findField(conn.getType(), "NetworkManager", "Connection");
|
||||||
ch = findField(nm.getType(), "Channel");
|
ch = findField(nm.getType(), "Channel");
|
||||||
if (!Modifier.isPublic(nm.getModifiers())) {
|
|
||||||
nm.setAccessible(true);
|
|
||||||
}
|
|
||||||
} catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e) {
|
} catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e) {
|
||||||
Via.getPlatform().getLogger().log(
|
Via.getPlatform().getLogger().log(
|
||||||
Level.WARNING,
|
Level.WARNING,
|
||||||
|
@ -70,6 +67,9 @@ public class JoinListener implements Listener {
|
||||||
for (Field field : cl.getDeclaredFields()) {
|
for (Field field : cl.getDeclaredFields()) {
|
||||||
for (String type : types) {
|
for (String type : types) {
|
||||||
if (field.getType().getSimpleName().equals(type)) {
|
if (field.getType().getSimpleName().equals(type)) {
|
||||||
|
if (!Modifier.isPublic(field.getModifiers())) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
}
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue