Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Be more safe
Dieser Commit ist enthalten in:
Ursprung
81c4e530e9
Commit
da7f8ea3b6
@ -49,9 +49,6 @@ public class JoinListener implements Listener {
|
||||
conn = findField(gh.getReturnType(), "PlayerConnection", "ServerGamePacketListenerImpl");
|
||||
nm = findField(conn.getType(), "NetworkManager", "Connection");
|
||||
ch = findField(nm.getType(), "Channel");
|
||||
if (!Modifier.isPublic(nm.getModifiers())) {
|
||||
nm.setAccessible(true);
|
||||
}
|
||||
} catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e) {
|
||||
Via.getPlatform().getLogger().log(
|
||||
Level.WARNING,
|
||||
@ -70,6 +67,9 @@ public class JoinListener implements Listener {
|
||||
for (Field field : cl.getDeclaredFields()) {
|
||||
for (String type : types) {
|
||||
if (field.getType().getSimpleName().equals(type)) {
|
||||
if (!Modifier.isPublic(field.getModifiers())) {
|
||||
field.setAccessible(true);
|
||||
}
|
||||
return field;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren