From fb0e4dbd230b2a5647f3ebeda865bbd8b04d6001 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 12 Oct 2021 21:24:37 +0200 Subject: [PATCH] Add tinyprotocol Signed-off-by: yoyosource --- .../steamwar/bausystem/utils/ProtocolAPI.java | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java b/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java index e88e7c94..e3ba3aea 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java @@ -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 shallowFill(Class clazz) { - if (clazz == null) - return (source, clone) -> { - }; - - BiConsumer superFiller = shallowFill(clazz.getSuperclass()); - - Field[] fds = clazz.getDeclaredFields(); - List 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); - } - - }; - } }