diff --git a/FightSystem/FightSystem_Core/build.gradle.kts b/FightSystem/FightSystem_Core/build.gradle.kts index 2f044447..93dd59c4 100644 --- a/FightSystem/FightSystem_Core/build.gradle.kts +++ b/FightSystem/FightSystem_Core/build.gradle.kts @@ -29,4 +29,5 @@ dependencies { compileOnly(libs.worldedit15) compileOnly(libs.fastutil) compileOnly(libs.authlib) + compileOnly(libs.netty) } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 57400063..23e2bb0c 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -156,6 +156,7 @@ public class FightSystem extends JavaPlugin { new LockschemCommand(); new StateCommand(); new SkipCommand(); + new TechhiderbugCommand(); new TPSWarpCommand(); new UnrankCommand(); new WinCommand(); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java new file mode 100644 index 00000000..4a3bf47f --- /dev/null +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java @@ -0,0 +1,71 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2025 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.commands; + +import com.comphenix.tinyprotocol.TinyProtocol; +import de.steamwar.fightsystem.ArenaMode; +import de.steamwar.fightsystem.Config; +import de.steamwar.fightsystem.FightSystem; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentCommand; +import de.steamwar.sql.SWException; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import java.io.StringWriter; +import java.util.Arrays; + +public class TechhiderbugCommand implements CommandExecutor { + + public TechhiderbugCommand() { + new StateDependentCommand(ArenaMode.All, FightState.All, "techhiderbug", this); + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) { + StringWriter writer = new StringWriter(); + + writer.append("ArenaMode: ").append(Config.mode.name()).append('\n'); + writer.append("FightState: ").append(FightState.getFightState().name()).append('\n'); + writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n'); + + writer.append("Arena region: ").append(Config.ArenaRegion.toString()).append('\n'); + writer.append("Team regions: "); + Fight.teams().forEach(t -> writer.append(t.getName()).append(':').append(t.getExtendRegion().toString()).append(' ')); + writer.append('\n'); + + writer.append("HullHider regions: "); + FightSystem.getHullHider().getHullMap().forEach((t, h) -> writer.append(t.getName()).append(':').append(h.getRegion().toString()).append(' ')); + writer.append('\n'); + + writer.append("Hidden regions: "); + FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' ')); + writer.append('\n'); + + writer.append('\n').append("Netty pipelines:\n"); + Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getPlayerInterceptors().get(p).getChannel().pipeline().names())).append('\n')); + + SWException.log("Techhider-Bug reported by " + sender.getName() + ": " + Arrays.toString(args), writer.toString()); + return false; + } +} diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/states/FightState.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/states/FightState.java index 1d5acf35..cadcec66 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/states/FightState.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/states/FightState.java @@ -49,6 +49,7 @@ public enum FightState { public static final Set AntiIngame = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PRE_RUNNING, RUNNING))); public static final Set AntiSpectate = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(SPECTATE))); + @Getter private static final Map stateDependentFeatures = new HashMap<>(); @Getter private static FightState fightState = PRE_LEADER_SETUP; diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java index a67c6d5d..caf39e79 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Hull.java @@ -45,6 +45,7 @@ public class Hull { return material.isOccluding() || Config.HiddenBlocks.contains(material); } + @Getter private final Region region; private final boolean groundVisible; private final IntVector[] directions; diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java index 455b960d..c050656d 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java @@ -33,6 +33,7 @@ import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentTask; import de.steamwar.techhider.TechHider; +import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -56,6 +57,7 @@ import java.util.function.Function; public class HullHider implements Listener { + @Getter private final Map hullMap = new HashMap<>(); private final Hull[] hulls; private final Map, BiFunction> packetHiders = new HashMap<>(); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Region.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Region.java index 6a559799..60d37be8 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Region.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/Region.java @@ -159,4 +159,9 @@ public class Region { public interface TriConsumer{ void accept(T x, V y, U z); } + + @Override + public String toString() { + return minX + "," + minY + "," + minZ + "->" + maxX + "," + maxY + "," + maxZ; + } } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java index c45d7ab6..bf890168 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java @@ -32,6 +32,7 @@ import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.sql.SteamwarUser; import de.steamwar.techhider.TechHider; +import lombok.Getter; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -51,6 +52,7 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati public static final boolean ENABLED = !Config.OnlyPublicSchematics && !Config.test() && Config.TechhiderActive; + @Getter private final ConcurrentHashMap hiddenRegion = new ConcurrentHashMap<>(); private final ConcurrentHashMap patterns = new ConcurrentHashMap<>(); private final TechHider techHider; diff --git a/FightSystem/FightSystem_Core/src/plugin.yml b/FightSystem/FightSystem_Core/src/plugin.yml index 64ece716..6925bf69 100644 --- a/FightSystem/FightSystem_Core/src/plugin.yml +++ b/FightSystem/FightSystem_Core/src/plugin.yml @@ -27,4 +27,5 @@ commands: resettb: tpslimit: tpswarp: + techhiderbug: unrank: \ No newline at end of file diff --git a/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java index 7cca9c95..af318d83 100644 --- a/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java +++ b/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java @@ -23,6 +23,7 @@ import de.steamwar.Reflection; import de.steamwar.Reflection.Field; import de.steamwar.core.Core; import io.netty.channel.*; +import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -67,6 +68,7 @@ public class TinyProtocol implements Listener { private boolean closed; private final Map, List>> packetFilters = new HashMap<>(); + @Getter private final Map playerInterceptors = new HashMap<>(); private TinyProtocol(final Plugin plugin) { @@ -136,8 +138,9 @@ public class TinyProtocol implements Listener { private static final Field getChannel = Reflection.getField(networkManager, Channel.class, 0); private static final Field getUUID = Reflection.getField(networkManager, UUID.class, 0); - private final class PacketInterceptor extends ChannelDuplexHandler { + public final class PacketInterceptor extends ChannelDuplexHandler { private final Player player; + @Getter private final Channel channel; private PacketInterceptor(Player player) {