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.PacketEvent;
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.NbtFactory;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.IFightSystem;
import io.netty.buffer.ByteBuf;
@ -55,11 +55,14 @@ public class TechHider_14 {
cached = packet.deepClone();
ITechHider.packetCache.put(packet, cached);
e.setPacket(cached);
StructureModifier<List> list = cached.getSpecificModifier(List.class);
List nmsTags = list.read(0);
StructureModifier<List<NbtBase<?>>> list = cached.getListNbtModifier();
List<NbtBase<?>> nmsTags = list.read(0);
boolean changed = false;
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"))){
nmsTags.remove(i);
changed = true;