Merge remote-tracking branch 'origin/FightSystem/fix-tech-and-hull-hider' into FightSystem/fix-tech-and-hull-hider

This commit is contained in:
D4rkr34lm
2026-05-21 15:08:41 +02:00
70 changed files with 798 additions and 1011 deletions
@@ -2,6 +2,7 @@ package com.comphenix.tinyprotocol;
import com.google.common.collect.MapMaker;
import de.steamwar.Reflection;
import de.steamwar.core.CRIUWakeupEvent;
import de.steamwar.core.Core;
import io.netty.channel.*;
import net.minecraft.network.Connection;
@@ -164,6 +165,10 @@ public class TinyProtocol {
}
}
@EventHandler
public void onCRIUWakeup(CRIUWakeupEvent event) {
registerChannelHandler();
}
};
plugin.getServer().getPluginManager().registerEvents(listener, plugin);
@@ -222,15 +227,10 @@ public class TinyProtocol {
}
}
public <T> void addTypedFilter(Class<T> packetType, BiFunction<Player, ? super T, Object> filter) {
public <T> void addFilter(Class<T> packetType, BiFunction<Player, ? super T, Object> filter) {
packetFilters.computeIfAbsent(packetType, c -> new CopyOnWriteArrayList<>()).add((BiFunction) filter);
}
@Deprecated
public void addFilter(Class<?> packetType, BiFunction<Player, Object, Object> filter) {
packetFilters.computeIfAbsent(packetType, c -> new CopyOnWriteArrayList<>()).add(filter);
}
public void removeFilter(Class<?> packetType, BiFunction<Player, ?, Object> filter) {
packetFilters.getOrDefault(packetType, Collections.emptyList()).remove(filter);
}
@@ -342,6 +342,8 @@ public class TinyProtocol {
// Lookup channel again
if (channel == null) {
System.out.println(((CraftPlayer) player).getHandle());
System.out.println(((CraftPlayer) player).getHandle().connection);
Channel playerChannel = ((CraftPlayer) player).getHandle().connection.connection.channel;
channelLookup.put(player.getName(), channel = playerChannel);
}
@@ -79,11 +79,14 @@ class CheckpointUtilsJ9 {
return;
}
e.printStackTrace();
Bukkit.shutdown();
if (!message.contains("Can't dump ghost file") && !message.contains("Can't create link remap")) // File/Jar has been updated
throw new SecurityException(e);
} finally {
if (true) return;
// Delete checkpoint
try (Stream<Path> stream = Files.walk(path)) {
stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
@@ -43,9 +43,8 @@ public class WorldIdentifier {
}
public WorldIdentifier() {
TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, o) -> {
if (resourceKey == null) return o;
ClientboundLoginPacket packet = (ClientboundLoginPacket) o;
TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, packet) -> {
if (resourceKey == null) return packet;
return new ClientboundLoginPacket(packet.playerId(),
packet.hardcore(),
@@ -46,7 +46,7 @@ public class AntiNocom implements Listener {
private final Map<Player, Integer> flags = new ConcurrentHashMap<>();
public AntiNocom() {
TinyProtocol.instance.addTypedFilter(ServerboundPlayerActionPacket.class, this::onDig);
TinyProtocol.instance.addFilter(ServerboundPlayerActionPacket.class, this::onDig);
registerUseItem();
}
@@ -56,7 +56,7 @@ public class AntiNocom implements Listener {
}
private void registerUseItem() {
TinyProtocol.instance.addTypedFilter(ServerboundUseItemOnPacket.class, (player, packet) -> {
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, (player, packet) -> {
BlockPos pos = packet.getHitResult().getBlockPos();
return isValid(player, "UseItem", pos.getX(), pos.getZ()) ? packet : null;
});
@@ -343,9 +343,9 @@ public class REntity {
}
private Object getMoveLookPacket(double diffX, double diffY, double diffZ, boolean rotEq) {
short x = (short) (this.x * 4096);
short y = (short) (this.y * 4096);
short z = (short) (this.z * 4096);
short x = (short) (diffX * 4096);
short y = (short) (diffY * 4096);
short z = (short) (diffZ * 4096);
byte yaw = (byte) (this.yaw * 256 / 360);
byte pitch = (byte) (this.pitch * 256 / 360);
@@ -78,7 +78,7 @@ public class REntityServer implements Listener {
this.callback = callback;
if (uninitialized) {
TinyProtocol.instance.addTypedFilter(ServerboundInteractPacket.class, filter);
TinyProtocol.instance.addFilter(ServerboundInteractPacket.class, filter);
}
}
@@ -1,24 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2026 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.techhider;
public interface QuadFunction<A, B, C, D, Return> {
Return apply(A a, B b, C c, D d);
}
@@ -357,7 +357,7 @@ public abstract class TechHider {
processors.put(ClientboundRemoveMobEffectPacket.class, this.buildEntityPacketProcessor(ClientboundRemoveMobEffectPacket::entityId));
// 7.1.98 Set Entity Metadata: entity state can reveal blocks/items/displays.
processors.put(ClientboundSetEntityDataPacket.class, this.buildEntityPacketProcessor(ClientboundSetEntityDataPacket::id));
// 7.1.26 Damage Event: entity ids and damage source location can leak hidde activity.
// 7.1.26 Damage Event: entity ids and damage source location can leak hide activity.
processors.put(ClientboundDamageEventPacket.class, this.buildEntityPacketProcessor(ClientboundDamageEventPacket::entityId));
// 7.1.54 Move Minecart Along Track: entity path and position signal.
processors.put(ClientboundMoveMinecartPacket.class, this.buildEntityPacketProcessor(ClientboundMoveMinecartPacket::entityId));