Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
83e26406ad
Commit
fb0e4dbd23
@ -80,34 +80,4 @@ public class ProtocolAPI {
|
||||
public static void broadcastPacket(Object packet) {
|
||||
Bukkit.getOnlinePlayers().stream().map(tinyProtocol::getChannel).filter(tinyProtocol::hasInjected).forEach(channel -> tinyProtocol.sendPacket(channel, packet));
|
||||
}
|
||||
|
||||
private static BiConsumer<Object, Object> shallowFill(Class<?> clazz) {
|
||||
if (clazz == null)
|
||||
return (source, clone) -> {
|
||||
};
|
||||
|
||||
BiConsumer<Object, Object> superFiller = shallowFill(clazz.getSuperclass());
|
||||
|
||||
Field[] fds = clazz.getDeclaredFields();
|
||||
List<Field> fields = new ArrayList<>();
|
||||
for (Field field : fds) {
|
||||
if (Modifier.isStatic(field.getModifiers()))
|
||||
continue;
|
||||
|
||||
field.setAccessible(true);
|
||||
fields.add(field);
|
||||
}
|
||||
|
||||
return (source, clone) -> {
|
||||
superFiller.accept(source, clone);
|
||||
try {
|
||||
for (Field field : fields) {
|
||||
field.set(clone, field.get(source));
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalStateException("Could not set field", e);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren