From 7c57b6251c2dc5624326963b8faa175186b1e493 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 19 Jan 2020 07:12:22 +0100 Subject: [PATCH] Hide sign contents with packet filter Signed-off-by: Lixfel --- .../steamwar/fightsystem/utils/TechHider.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java index 2743ead..5c587ad 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java @@ -67,6 +67,7 @@ public class TechHider { blockActionHider(); blockHider(); multiBlockHider(); + updateBlockEntity(); switch(Core.getVersion()){ case 15: TechHider_15.start(); @@ -168,6 +169,29 @@ public class TechHider { }); } + private static void updateBlockEntity(){ + if(Core.getVersion() < 9) + return; + + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.TILE_ENTITY_DATA) { + @Override + public void onPacketSending(PacketEvent event) { + PacketContainer packet = event.getPacket(); + BlockPosition pos = packet.getBlockPositionModifier().read(0); + + Player p = event.getPlayer(); + if(bypass(p, ITechHider.posToChunk(pos.getX()), ITechHider.posToChunk(pos.getZ()))) + return; + + // 9 == Set sign text + if(packet.getBytes().read(0) != 9) + return; + + event.setCancelled(true); + } + }); + } + public static List> prepareChunkReload(Player p){ if(disabled()) return Collections.emptyList();