SteamWar/FightSystem
Archiviert
13
1

Merge branch 'techhider1.14+compatibility' of SteamWar/FightSystem into master

Dieser Commit ist enthalten in:
Lixfel 2020-01-01 18:28:42 +01:00 committet von Gitea
Commit 995ef3472c
3 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -6,6 +6,7 @@ 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 com.comphenix.protocol.wrappers.nbt.NbtFactory;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
@ -55,8 +56,8 @@ 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(1); List<NbtBase<?>> nmsTags = list.read(1);
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));

Datei anzeigen

@ -100,6 +100,7 @@ public class Config {
//tech hider parameter //tech hider parameter
public static final List<Integer> HiddenBlocks; public static final List<Integer> HiddenBlocks;
public static final List<String> HiddenBlockTags;
public static final List<String> HiddenBlockEntities; public static final List<String> HiddenBlockEntities;
public static final int ObfuscateWith; public static final int ObfuscateWith;
public static final String ObfuscateWithTag; public static final String ObfuscateWithTag;
@ -177,6 +178,7 @@ public class Config {
LeaderDefault = config.getString("Kits.LeaderDefault"); LeaderDefault = config.getString("Kits.LeaderDefault");
HiddenBlocks = Collections.unmodifiableList(config.getIntegerList("Techhider.HiddenBlocks")); HiddenBlocks = Collections.unmodifiableList(config.getIntegerList("Techhider.HiddenBlocks"));
HiddenBlockTags = config.getStringList("Techhider.HiddenBlockTags");
HiddenBlockEntities = Collections.unmodifiableList(config.getStringList("Techhider.HiddenBlockEntities")); HiddenBlockEntities = Collections.unmodifiableList(config.getStringList("Techhider.HiddenBlockEntities"));
ObfuscateWith = config.getInt("Techhider.ObfuscateWith"); ObfuscateWith = config.getInt("Techhider.ObfuscateWith");
ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag"); ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag");

Datei anzeigen

@ -108,8 +108,7 @@ public class TechHider {
boolean changed = false; boolean changed = false;
for(MultiBlockChangeInfo mbci : changes){ for(MultiBlockChangeInfo mbci : changes){
WrappedBlockData block = mbci.getData(); WrappedBlockData block = mbci.getData();
//noinspection deprecation if(Config.HiddenBlockTags.contains(block.getType().name())){
if(Config.HiddenBlocks.contains(block.getType().getId())){
changed = true; changed = true;
block.setType(ITechHider.obfuscateMaterial); block.setType(ITechHider.obfuscateMaterial);
mbci.setData(block); mbci.setData(block);
@ -145,8 +144,7 @@ public class TechHider {
e.setPacket(cached); e.setPacket(cached);
StructureModifier<WrappedBlockData> blockStructure = cached.getBlockData(); StructureModifier<WrappedBlockData> blockStructure = cached.getBlockData();
WrappedBlockData block = blockStructure.read(0); WrappedBlockData block = blockStructure.read(0);
//noinspection deprecation if(Config.HiddenBlockTags.contains(block.getType().name())){
if(Config.HiddenBlocks.contains(block.getType().getId())){
block.setType(ITechHider.obfuscateMaterial); block.setType(ITechHider.obfuscateMaterial);
blockStructure.write(0, block); blockStructure.write(0, block);
} }