From 68a2067b88ee97be15a2018f17e45cc0a79e75e0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 24 Mar 2021 13:49:21 +0100 Subject: [PATCH] Fix Techhider 1.8 - 1.10 Signed-off-by: Lixfel --- .../fightsystem/utils/TechHider_12.java | 14 ------- .../fightsystem/utils/TechHider_8.java | 42 +++++++++++++++++++ .../steamwar/fightsystem/utils/TechHider.java | 6 +-- 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 FightSystem_8/src/de/steamwar/fightsystem/utils/TechHider_8.java diff --git a/FightSystem_12/src/de/steamwar/fightsystem/utils/TechHider_12.java b/FightSystem_12/src/de/steamwar/fightsystem/utils/TechHider_12.java index b8aba8f..4286cd5 100644 --- a/FightSystem_12/src/de/steamwar/fightsystem/utils/TechHider_12.java +++ b/FightSystem_12/src/de/steamwar/fightsystem/utils/TechHider_12.java @@ -31,10 +31,8 @@ import de.steamwar.fightsystem.IFightSystem; import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.entity.Player; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.logging.Level; @@ -44,18 +42,6 @@ import static de.steamwar.fightsystem.utils.ITechHider.bypass; class TechHider_12 { private TechHider_12(){} - static Set getHiddenBlockIds() { - Set hiddenBlockIds = new HashSet<>(); - for(String tag : Config.HiddenBlocks){ - hiddenBlockIds.add(Material.matchMaterial(tag).getId() << 4); - } - return hiddenBlockIds; - } - - static int getObfuscateWith() { - return Material.matchMaterial(Config.ObfuscateWith).getId() << 4; - } - static PacketAdapter chunkHider(Set hiddenBlockIds, int obfuscateWith){ return new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) { @Override diff --git a/FightSystem_8/src/de/steamwar/fightsystem/utils/TechHider_8.java b/FightSystem_8/src/de/steamwar/fightsystem/utils/TechHider_8.java new file mode 100644 index 0000000..ccf7943 --- /dev/null +++ b/FightSystem_8/src/de/steamwar/fightsystem/utils/TechHider_8.java @@ -0,0 +1,42 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +package de.steamwar.fightsystem.utils; + +import de.steamwar.fightsystem.Config; +import org.bukkit.Material; + +import java.util.HashSet; +import java.util.Set; + +class TechHider_8 { + private TechHider_8(){} + + static Set getHiddenBlockIds() { + Set hiddenBlockIds = new HashSet<>(); + for(String tag : Config.HiddenBlocks){ + hiddenBlockIds.add(Material.matchMaterial(tag).getId() << 4); + } + return hiddenBlockIds; + } + + static int getObfuscateWith() { + return Material.matchMaterial(Config.ObfuscateWith).getId() << 4; + } +} diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java index e7933fc..68f897a 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/TechHider.java @@ -62,13 +62,11 @@ public class TechHider extends StateDependent { super(enabled, FightState.Schem); Set hiddenBlockIds = VersionedCallable.call( - new VersionedCallable<>(Collections::emptySet, 8), - new VersionedCallable<>(TechHider_12::getHiddenBlockIds, 12), + new VersionedCallable<>(TechHider_8::getHiddenBlockIds, 8), new VersionedCallable<>(TechHider_14::getHiddenBlockIds, 14), new VersionedCallable<>(TechHider_15::getHiddenBlockIds, 15)); int obfuscateWith = VersionedCallable.call( - new VersionedCallable<>(() -> 0, 8), - new VersionedCallable<>(TechHider_12::getObfuscateWith, 12), + new VersionedCallable<>(TechHider_8::getObfuscateWith, 8), new VersionedCallable<>(TechHider_14::getObfuscateWith, 14), new VersionedCallable<>(TechHider_15::getObfuscateWith, 15));