SteamWar/FightSystem
Archiviert
13
1

Fixing NBTTagList #2

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-01-01 20:36:25 +01:00
Ursprung 0de2dd0d41
Commit 318a88bd51

Datei anzeigen

@ -6,8 +6,8 @@ import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.wrappers.nbt.NbtBase;
import com.comphenix.protocol.wrappers.nbt.NbtCompound; import com.comphenix.protocol.wrappers.nbt.NbtCompound;
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.IFightSystem; import de.steamwar.fightsystem.IFightSystem;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -55,11 +55,14 @@ public class TechHider_14 {
cached = packet.deepClone(); cached = packet.deepClone();
ITechHider.packetCache.put(packet, cached); ITechHider.packetCache.put(packet, cached);
e.setPacket(cached); e.setPacket(cached);
StructureModifier<List> list = cached.getSpecificModifier(List.class); StructureModifier<List<NbtBase<?>>> list = cached.getListNbtModifier();
List nmsTags = list.read(0); List<NbtBase<?>> 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)); NbtBase<?> nbtBase = nmsTags.get(i);
if(!(nbtBase instanceof NbtCompound))
throw new SecurityException("Hä?" + nbtBase.getClass().getName());
NbtCompound nbt = (NbtCompound) nbtBase;
if(Config.HiddenBlockEntities.contains(nbt.getString("id"))){ if(Config.HiddenBlockEntities.contains(nbt.getString("id"))){
nmsTags.remove(i); nmsTags.remove(i);
changed = true; changed = true;