SteamWar/FightSystem
Archiviert
13
1

Fix Techhider 1.8 - 1.10

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-03-24 13:49:21 +01:00
Ursprung 687ef93adf
Commit 68a2067b88
3 geänderte Dateien mit 44 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -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<Integer> getHiddenBlockIds() {
Set<Integer> 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<Integer> hiddenBlockIds, int obfuscateWith){
return new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.MAP_CHUNK) {
@Override

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
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<Integer> getHiddenBlockIds() {
Set<Integer> 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;
}
}

Datei anzeigen

@ -62,13 +62,11 @@ public class TechHider extends StateDependent {
super(enabled, FightState.Schem);
Set<Integer> 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));