forked from SteamWar/SteamWar
Fix final stuff
This commit is contained in:
@@ -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));
|
||||
|
||||
+16
-10
@@ -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)));
|
||||
|
||||
@@ -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() {
|
||||
|
||||
+2
-2
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user