SteamWar/FightSystem
Archiviert
13
1

Hide sign contents with packet filter

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-01-19 07:12:22 +01:00
Ursprung 11da798b4e
Commit 7c57b6251c

Datei anzeigen

@ -67,6 +67,7 @@ public class TechHider {
blockActionHider(); blockActionHider();
blockHider(); blockHider();
multiBlockHider(); multiBlockHider();
updateBlockEntity();
switch(Core.getVersion()){ switch(Core.getVersion()){
case 15: case 15:
TechHider_15.start(); 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<Pair<Integer, Integer>> prepareChunkReload(Player p){ public static List<Pair<Integer, Integer>> prepareChunkReload(Player p){
if(disabled()) if(disabled())
return Collections.emptyList(); return Collections.emptyList();