From 104f0cf02da06a1b1238dce052dbf9d21722dfe6 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sun, 13 Jul 2025 18:39:53 +0200 Subject: [PATCH] Fix final stuff --- .../de/steamwar/fightsystem/FightSystem.java | 1 + .../fightsystem/fight/FightSchematic.java | 26 ++++++++++++------- .../steamwar/fightsystem/fight/FightTeam.java | 8 ++---- .../fightsystem/record/PacketProcessor.java | 4 +-- .../steamwar/fightsystem/record/Recorder.java | 20 +++++++------- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 9ebc4f0c..d181ce02 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -126,6 +126,7 @@ public class FightSystem extends JavaPlugin { new WinconditionPointsAirShip(); new WinconditionTimeout(); new WinconditionTimeTechKO(); + new WinconditionTimedDamageTechKO(); new EventTeamOffWincondition(); new WinconditionComparisonTimeout(Winconditions.HEART_RATIO_TIMEOUT, "HeartTimeout", "WIN_MORE_HEALTH", FightTeam::getHeartRatio); new WinconditionComparisonTimeout(Winconditions.PERCENT_TIMEOUT, "PercentTimeout", "WIN_LESS_DAMAGE", team -> -Wincondition.getPercentWincondition().getPercent(team)); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java index aaffe4c4..63395d03 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java @@ -36,7 +36,6 @@ import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicType; import lombok.Getter; -import lombok.Setter; import org.bukkit.Bukkit; import org.bukkit.DyeColor; import org.bukkit.Location; @@ -54,22 +53,27 @@ public class FightSchematic extends StateDependent { private final FightTeam team; private final Region region; + private final boolean rotate; @Getter - @Setter - private boolean rotate; + private boolean usedRotate; @Getter private Clipboard clipboard = null; private int schematic = 0; - public FightSchematic(FightTeam team, boolean rotate) { + public FightSchematic(FightTeam team, boolean usedRotate) { super(ArenaMode.All, FightState.PostSchemSetup); this.team = team; this.region = team.getSchemRegion(); - this.rotate = rotate; + this.rotate = usedRotate; + this.usedRotate = usedRotate; register(); } + public void setChangeRotate(boolean rotate) { + this.usedRotate = this.rotate ^ rotate; + } + public boolean hasSchematic() { return clipboard != null; } @@ -124,13 +128,15 @@ public class FightSchematic extends StateDependent { } if(ArenaMode.AntiReplay.contains(Config.mode)) { + boolean changeRotation = false; if (Config.ActiveWinconditions.contains(Winconditions.RANDOM_ROTATE)) { - rotate = new Random().nextBoolean(); + changeRotation = new Random().nextBoolean(); + usedRotate = rotate ^ changeRotation; } if(team.isBlue()) - GlobalRecorder.getInstance().blueSchem(schematic, rotate); + GlobalRecorder.getInstance().blueSchem(schematic, changeRotation); else - GlobalRecorder.getInstance().redSchem(schematic, rotate); + GlobalRecorder.getInstance().redSchem(schematic, changeRotation); } Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste); @@ -156,8 +162,8 @@ public class FightSchematic extends StateDependent { Config.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX()/2.0 - dims.getBlockX() : -dims.getBlockX()/2.0, Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0, Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ()/2.0 - dims.getBlockZ() : -dims.getBlockZ()/2.0 - ).add(new Vector(rotate ? 1 : 0, 0, rotate ? 1 : 0)), - new AffineTransform().rotateY(rotate ? 180 : 0) + ).add(new Vector(usedRotate ? 1 : 0, 0, usedRotate ? 1 : 0)), + new AffineTransform().rotateY(usedRotate ? 180 : 0) ); FightSystem.getHullHider().initialize(team); team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard))); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index 319f2dbb..6c9c0345 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -458,12 +458,8 @@ public class FightTeam { return schematic.getId(); } - public boolean getSchematicRotate() { - return schematic.isRotate(); - } - - public void setSchematicRotate(boolean rotate) { - schematic.setRotate(rotate); + public void setSchematicChangeRotate(boolean rotate) { + schematic.setChangeRotate(rotate); } public Clipboard getClipboard() { diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index 22b675b4..f4906f42 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -531,10 +531,10 @@ public class PacketProcessor implements Listener { } private void rotateSchem(FightTeam team) throws IOException { - boolean rotate = source.readBoolean(); + boolean changeRotate = source.readBoolean(); execSync(() -> { - team.setSchematicRotate(rotate); + team.setSchematicChangeRotate(changeRotate); }); } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/Recorder.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/Recorder.java index cf800565..8b159660 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/Recorder.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/Recorder.java @@ -61,9 +61,9 @@ public interface Recorder { default void enableTeam(FightTeam team){ if(FightState.Schem.contains(FightState.getFightState())){ if(team.isBlue()) - blueSchem(team.getSchematic(), team.getSchematicRotate()); + blueSchem(team.getSchematic(), false); else - redSchem(team.getSchematic(), team.getSchematicRotate()); + redSchem(team.getSchematic(), false); } if(FightState.AntiSpectate.contains(FightState.getFightState())){ @@ -123,8 +123,8 @@ public interface Recorder { * TeamIDPacket (0xb2) + int blueTeamId, redTeamId * BlueEmbeddedSchemPacket (0xb3) + int blueSchemId + gzipt NBT blob * RedEmbeddedSchemPacket (0xb4) + int redSchemId + gzipt NBT blob - * BlueSchemRotatePacket (0xb5) + boolean rotate - * RedSchemRotatePacket (0xb6) + boolean rotate + * BlueSchemRotatePacket (0xb5) + boolean changeRotate + * RedSchemRotatePacket (0xb6) + boolean changeRotate * * DEPRECATED ScoreboardTitlePacket (0xc0) + String scoreboardTitle * DEPRECATED ScoreboardDataPacket (0xc1) + String key + int value @@ -261,18 +261,18 @@ public interface Recorder { write(0xb2, blueTeamId, redTeamId); } - default void blueSchem(int schemId, boolean rotate) { - rotate(0xb5, rotate); + default void blueSchem(int schemId, boolean changeRotate) { + rotate(0xb5, changeRotate); schem(0xb3, 0xb0, schemId); } - default void redSchem(int schemId, boolean rotate) { - rotate(0xb6, rotate); + default void redSchem(int schemId, boolean changeRotate) { + rotate(0xb6, changeRotate); schem(0xb4, 0xb1, schemId); } - default void rotate(int packetId, boolean rotate) { - write(packetId, rotate); + default void rotate(int packetId, boolean changeRotate) { + write(packetId, changeRotate); } default void schem(int embedId, int noEmbedId, int schemId){