BlockBreakHider
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
e979398a87
Commit
9e42d34ddd
@ -88,6 +88,9 @@ public class TechHider {
|
||||
blockHider();
|
||||
multiBlockHider();
|
||||
updateBlockEntity();
|
||||
if(Core.getVersion() > 12){
|
||||
blockBreakHider();
|
||||
}
|
||||
VersionedRunnable.call(new VersionedRunnable(TechHider_12::start, 12),
|
||||
new VersionedRunnable(TechHider_14::start, 14),
|
||||
new VersionedRunnable(TechHider_15::start, 15));
|
||||
@ -132,6 +135,37 @@ public class TechHider {
|
||||
});
|
||||
}
|
||||
|
||||
private static void blockBreakHider(){
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.BLOCK_BREAK) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent e) {
|
||||
PacketContainer packet = e.getPacket();
|
||||
BlockPosition pos = packet.getBlockPositionModifier().read(0);
|
||||
|
||||
Player p = e.getPlayer();
|
||||
if(bypass(p, ITechHider.posToChunk(pos.getX()), ITechHider.posToChunk(pos.getZ())))
|
||||
return;
|
||||
|
||||
|
||||
PacketContainer cached = ITechHider.packetCache.get(packet);
|
||||
if(cached != null){
|
||||
e.setPacket(cached);
|
||||
return;
|
||||
}
|
||||
|
||||
cached = packet.deepClone();
|
||||
ITechHider.packetCache.put(packet, cached);
|
||||
e.setPacket(cached);
|
||||
StructureModifier<WrappedBlockData> blockStructure = cached.getBlockData();
|
||||
WrappedBlockData block = blockStructure.read(0);
|
||||
if(Config.HiddenBlockTags.contains(block.getType().name())){
|
||||
block.setType(ITechHider.obfuscateMaterial);
|
||||
blockStructure.write(0, block);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void blockHider(){
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
||||
@Override
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren