SteamWar/FightSystem
Archiviert
13
1

Fixing remaining bugs

Dieser Commit ist enthalten in:
Travis CI 2019-07-01 21:02:32 +02:00
Ursprung 53b4514c24
Commit 470a86be80

Datei anzeigen

@ -69,12 +69,8 @@ public class TechHider {
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
@Override
public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket().deepClone();
e.setPacket(packet);
PacketContainer packet = e.getPacket();
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 chunkZ = ints.read(1);
@ -82,6 +78,11 @@ public class TechHider {
if(bypass(p, chunkX, chunkZ))
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;
for(int i = nmsTags.size() - 1; i >= 0; 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) {
@Override
public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket().deepClone();
e.setPacket(packet);
StructureModifier<WrappedBlockData> blockStructure = packet.getBlockData();
PacketContainer packet = e.getPacket();
BlockPosition pos = packet.getBlockPositionModifier().read(0);
Player p = e.getPlayer();
if(bypass(p, posToChunk(pos.getX()), posToChunk(pos.getZ())))
return;
packet = packet.deepClone();
e.setPacket(packet);
StructureModifier<WrappedBlockData> blockStructure = packet.getBlockData();
WrappedBlockData block = blockStructure.read(0);
if(Config.HiddenBlocks.contains(block.getType().getId())){
block.setType(obfuscateMaterial);
@ -187,16 +189,17 @@ public class TechHider {
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
@Override
public void onPacketSending(PacketEvent e) {
PacketContainer packet = e.getPacket().deepClone();
e.setPacket(packet);
StructureModifier<MultiBlockChangeInfo[]> blockStructure = packet.getMultiBlockChangeInfoArrays();
MultiBlockChangeInfo[] changes = blockStructure.read(0);
PacketContainer packet = e.getPacket();
Player p = e.getPlayer();
ChunkCoordIntPair pos = packet.getChunkCoordIntPairs().read(0);
if(bypass(p, pos.getChunkX(), pos.getChunkZ()))
return;
packet = packet.shallowClone();
e.setPacket(packet);
StructureModifier<MultiBlockChangeInfo[]> blockStructure = packet.getMultiBlockChangeInfoArrays();
MultiBlockChangeInfo[] changes = blockStructure.read(0).clone();
boolean changed = false;
for(MultiBlockChangeInfo mbci : changes){
WrappedBlockData block = mbci.getData();