SteamWar/SpigotCore
Archiviert
13
0

Experimental ReflectionFix
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2023-03-03 17:19:37 +01:00
Ursprung f4e2051ec0
Commit 8982c0af29
2 geänderte Dateien mit 12 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -63,6 +63,7 @@ public final class Reflection {
* @param value - the new value of the field.
*/
void set(Object target, Object value);
void setInt(Object target, int value);
/**
* Determine if the given object has this field.
@ -156,10 +157,16 @@ public final class Reflection {
@Override
public void set(Object target, Object value) {
try {
if(field.getDeclaringClass() == int.class)
field.setInt(target, (int)value);
else
field.set(target, value);
field.set(target, value);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Cannot access reflection.", e);
}
}
@Override
public void setInt(Object target, int value) {
try {
field.setInt(target, value);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Cannot access reflection.", e);
}

Datei anzeigen

@ -355,7 +355,7 @@ public class REntity {
protected Object getDataWatcherPacket(Object... dataWatcherKeyValues) {
Object packet = Reflection.newInstance(metadataPacket);
metadataEntity.set(packet, entityId);
metadataEntity.setInt(packet, entityId);
ArrayList<Object> nativeWatchers = new ArrayList<>(1);
for(int i = 0; i < dataWatcherKeyValues.length; i+=2) {