WIP: Techhiding (bugged, with invitation fix) #14
@ -69,12 +69,8 @@ public class TechHider {
|
|||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
PacketContainer packet = e.getPacket().deepClone();
|
PacketContainer packet = e.getPacket();
|
||||||
e.setPacket(packet);
|
|
||||||
StructureModifier<Integer> ints = packet.getIntegers();
|
StructureModifier<Integer> ints = packet.getIntegers();
|
||||||
StructureModifier<byte[]> byteArray = packet.getByteArrays();
|
|
||||||
StructureModifier<List> list = packet.getSpecificModifier(List.class);
|
|
||||||
List nmsTags = list.read(0);
|
|
||||||
|
|
||||||
int chunkX = ints.read(0);
|
int chunkX = ints.read(0);
|
||||||
int chunkZ = ints.read(1);
|
int chunkZ = ints.read(1);
|
||||||
@ -82,6 +78,11 @@ public class TechHider {
|
|||||||
if(bypass(p, chunkX, chunkZ))
|
if(bypass(p, chunkX, chunkZ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
packet = packet.deepClone();
|
||||||
|
e.setPacket(packet);
|
||||||
|
StructureModifier<byte[]> byteArray = packet.getByteArrays();
|
||||||
|
StructureModifier<List> list = packet.getSpecificModifier(List.class);
|
||||||
|
List nmsTags = list.read(0);
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for(int i = nmsTags.size() - 1; i >= 0; i--){
|
for(int i = nmsTags.size() - 1; i >= 0; i--){
|
||||||
NbtCompound nbt = NbtFactory.fromNMSCompound(nmsTags.get(i));
|
NbtCompound nbt = NbtFactory.fromNMSCompound(nmsTags.get(i));
|
||||||
@ -168,15 +169,16 @@ public class TechHider {
|
|||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.BLOCK_CHANGE) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
PacketContainer packet = e.getPacket().deepClone();
|
PacketContainer packet = e.getPacket();
|
||||||
e.setPacket(packet);
|
|
||||||
StructureModifier<WrappedBlockData> blockStructure = packet.getBlockData();
|
|
||||||
BlockPosition pos = packet.getBlockPositionModifier().read(0);
|
BlockPosition pos = packet.getBlockPositionModifier().read(0);
|
||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if(bypass(p, posToChunk(pos.getX()), posToChunk(pos.getZ())))
|
if(bypass(p, posToChunk(pos.getX()), posToChunk(pos.getZ())))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
packet = packet.deepClone();
|
||||||
|
e.setPacket(packet);
|
||||||
|
StructureModifier<WrappedBlockData> blockStructure = packet.getBlockData();
|
||||||
WrappedBlockData block = blockStructure.read(0);
|
WrappedBlockData block = blockStructure.read(0);
|
||||||
if(Config.HiddenBlocks.contains(block.getType().getId())){
|
if(Config.HiddenBlocks.contains(block.getType().getId())){
|
||||||
block.setType(obfuscateMaterial);
|
block.setType(obfuscateMaterial);
|
||||||
@ -187,16 +189,17 @@ public class TechHider {
|
|||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent e) {
|
public void onPacketSending(PacketEvent e) {
|
||||||
PacketContainer packet = e.getPacket().deepClone();
|
PacketContainer packet = e.getPacket();
|
||||||
e.setPacket(packet);
|
|
||||||
StructureModifier<MultiBlockChangeInfo[]> blockStructure = packet.getMultiBlockChangeInfoArrays();
|
|
||||||
MultiBlockChangeInfo[] changes = blockStructure.read(0);
|
|
||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
ChunkCoordIntPair pos = packet.getChunkCoordIntPairs().read(0);
|
ChunkCoordIntPair pos = packet.getChunkCoordIntPairs().read(0);
|
||||||
if(bypass(p, pos.getChunkX(), pos.getChunkZ()))
|
if(bypass(p, pos.getChunkX(), pos.getChunkZ()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
packet = packet.shallowClone();
|
||||||
|
e.setPacket(packet);
|
||||||
|
StructureModifier<MultiBlockChangeInfo[]> blockStructure = packet.getMultiBlockChangeInfoArrays();
|
||||||
|
MultiBlockChangeInfo[] changes = blockStructure.read(0).clone();
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for(MultiBlockChangeInfo mbci : changes){
|
for(MultiBlockChangeInfo mbci : changes){
|
||||||
WrappedBlockData block = mbci.getData();
|
WrappedBlockData block = mbci.getData();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren