Dieser Commit ist enthalten in:
Ursprung
f4e2051ec0
Commit
8982c0af29
@ -63,6 +63,7 @@ public final class Reflection {
|
|||||||
* @param value - the new value of the field.
|
* @param value - the new value of the field.
|
||||||
*/
|
*/
|
||||||
void set(Object target, Object value);
|
void set(Object target, Object value);
|
||||||
|
void setInt(Object target, int value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the given object has this field.
|
* Determine if the given object has this field.
|
||||||
@ -156,15 +157,21 @@ public final class Reflection {
|
|||||||
@Override
|
@Override
|
||||||
public void set(Object target, Object value) {
|
public void set(Object target, Object value) {
|
||||||
try {
|
try {
|
||||||
if(field.getDeclaringClass() == int.class)
|
|
||||||
field.setInt(target, (int)value);
|
|
||||||
else
|
|
||||||
field.set(target, value);
|
field.set(target, value);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new IllegalArgumentException("Cannot access reflection.", 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasField(Object target) {
|
public boolean hasField(Object target) {
|
||||||
// target instanceof DeclaringClass
|
// target instanceof DeclaringClass
|
||||||
|
@ -355,7 +355,7 @@ public class REntity {
|
|||||||
|
|
||||||
protected Object getDataWatcherPacket(Object... dataWatcherKeyValues) {
|
protected Object getDataWatcherPacket(Object... dataWatcherKeyValues) {
|
||||||
Object packet = Reflection.newInstance(metadataPacket);
|
Object packet = Reflection.newInstance(metadataPacket);
|
||||||
metadataEntity.set(packet, entityId);
|
metadataEntity.setInt(packet, entityId);
|
||||||
|
|
||||||
ArrayList<Object> nativeWatchers = new ArrayList<>(1);
|
ArrayList<Object> nativeWatchers = new ArrayList<>(1);
|
||||||
for(int i = 0; i < dataWatcherKeyValues.length; i+=2) {
|
for(int i = 0; i < dataWatcherKeyValues.length; i+=2) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren