Merge pull request 'BlockBreakHider' (#240) from masterBlockBreakHider into master
Reviewed-on: #240 Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Commit
ea35f358e0
@ -88,6 +88,9 @@ public class TechHider {
|
|||||||
blockHider();
|
blockHider();
|
||||||
multiBlockHider();
|
multiBlockHider();
|
||||||
updateBlockEntity();
|
updateBlockEntity();
|
||||||
|
if(Core.getVersion() > 12){
|
||||||
|
blockBreakHider();
|
||||||
|
}
|
||||||
VersionedRunnable.call(new VersionedRunnable(TechHider_12::start, 12),
|
VersionedRunnable.call(new VersionedRunnable(TechHider_12::start, 12),
|
||||||
new VersionedRunnable(TechHider_14::start, 14),
|
new VersionedRunnable(TechHider_14::start, 14),
|
||||||
new VersionedRunnable(TechHider_15::start, 15));
|
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(){
|
private static void blockHider(){
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
||||||
@Override
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren