From d45f0892a7347094ac45f247753d7a489c9bec72 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 31 Dec 2019 17:04:00 +0100 Subject: [PATCH] TechHider 1.14+ actualisation Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/utils/TechHider_14.java | 5 +++-- FightSystem_API/src/de/steamwar/fightsystem/Config.java | 2 ++ .../src/de/steamwar/fightsystem/utils/TechHider.java | 6 ++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/FightSystem_14/src/de/steamwar/fightsystem/utils/TechHider_14.java b/FightSystem_14/src/de/steamwar/fightsystem/utils/TechHider_14.java index 66cd3ff..10a6113 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/utils/TechHider_14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/utils/TechHider_14.java @@ -6,6 +6,7 @@ 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; @@ -55,8 +56,8 @@ public class TechHider_14 { cached = packet.deepClone(); ITechHider.packetCache.put(packet, cached); e.setPacket(cached); - StructureModifier list = cached.getSpecificModifier(List.class); - List nmsTags = list.read(1); + StructureModifier>> list = cached.getListNbtModifier(); + List> nmsTags = list.read(1); boolean changed = false; for(int i = nmsTags.size() - 1; i >= 0; i--){ NbtCompound nbt = NbtFactory.fromNMSCompound(nmsTags.get(i)); diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java index 18ab1cd..c317ccc 100644 --- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java @@ -100,6 +100,7 @@ public class Config { //tech hider parameter public static final List HiddenBlocks; + public static final List HiddenBlockTags; public static final List HiddenBlockEntities; public static final int ObfuscateWith; public static final String ObfuscateWithTag; @@ -177,6 +178,7 @@ public class Config { LeaderDefault = config.getString("Kits.LeaderDefault"); HiddenBlocks = Collections.unmodifiableList(config.getIntegerList("Techhider.HiddenBlocks")); + HiddenBlockTags = config.getStringList("Techhider.HiddenBlockTags"); HiddenBlockEntities = Collections.unmodifiableList(config.getStringList("Techhider.HiddenBlockEntities")); ObfuscateWith = config.getInt("Techhider.ObfuscateWith"); ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag"); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java index b2ed032..404a18c 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java @@ -108,8 +108,7 @@ public class TechHider { boolean changed = false; for(MultiBlockChangeInfo mbci : changes){ WrappedBlockData block = mbci.getData(); - //noinspection deprecation - if(Config.HiddenBlocks.contains(block.getType().getId())){ + if(Config.HiddenBlockTags.contains(block.getType().name())){ changed = true; block.setType(ITechHider.obfuscateMaterial); mbci.setData(block); @@ -145,8 +144,7 @@ public class TechHider { e.setPacket(cached); StructureModifier blockStructure = cached.getBlockData(); WrappedBlockData block = blockStructure.read(0); - //noinspection deprecation - if(Config.HiddenBlocks.contains(block.getType().getId())){ + if(Config.HiddenBlockTags.contains(block.getType().name())){ block.setType(ITechHider.obfuscateMaterial); blockStructure.write(0, block); }