forked from SteamWar/SteamWar
Fix final stuff
This commit is contained in:
@@ -126,6 +126,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new WinconditionPointsAirShip();
|
new WinconditionPointsAirShip();
|
||||||
new WinconditionTimeout();
|
new WinconditionTimeout();
|
||||||
new WinconditionTimeTechKO();
|
new WinconditionTimeTechKO();
|
||||||
|
new WinconditionTimedDamageTechKO();
|
||||||
new EventTeamOffWincondition();
|
new EventTeamOffWincondition();
|
||||||
new WinconditionComparisonTimeout(Winconditions.HEART_RATIO_TIMEOUT, "HeartTimeout", "WIN_MORE_HEALTH", FightTeam::getHeartRatio);
|
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));
|
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.SchematicNode;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -54,22 +53,27 @@ public class FightSchematic extends StateDependent {
|
|||||||
private final FightTeam team;
|
private final FightTeam team;
|
||||||
private final Region region;
|
private final Region region;
|
||||||
|
|
||||||
|
private final boolean rotate;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
private boolean usedRotate;
|
||||||
private boolean rotate;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Clipboard clipboard = null;
|
private Clipboard clipboard = null;
|
||||||
private int schematic = 0;
|
private int schematic = 0;
|
||||||
|
|
||||||
public FightSchematic(FightTeam team, boolean rotate) {
|
public FightSchematic(FightTeam team, boolean usedRotate) {
|
||||||
super(ArenaMode.All, FightState.PostSchemSetup);
|
super(ArenaMode.All, FightState.PostSchemSetup);
|
||||||
this.team = team;
|
this.team = team;
|
||||||
this.region = team.getSchemRegion();
|
this.region = team.getSchemRegion();
|
||||||
this.rotate = rotate;
|
this.rotate = usedRotate;
|
||||||
|
this.usedRotate = usedRotate;
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setChangeRotate(boolean rotate) {
|
||||||
|
this.usedRotate = this.rotate ^ rotate;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasSchematic() {
|
public boolean hasSchematic() {
|
||||||
return clipboard != null;
|
return clipboard != null;
|
||||||
}
|
}
|
||||||
@@ -124,13 +128,15 @@ public class FightSchematic extends StateDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ArenaMode.AntiReplay.contains(Config.mode)) {
|
if(ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||||
|
boolean changeRotation = false;
|
||||||
if (Config.ActiveWinconditions.contains(Winconditions.RANDOM_ROTATE)) {
|
if (Config.ActiveWinconditions.contains(Winconditions.RANDOM_ROTATE)) {
|
||||||
rotate = new Random().nextBoolean();
|
changeRotation = new Random().nextBoolean();
|
||||||
|
usedRotate = rotate ^ changeRotation;
|
||||||
}
|
}
|
||||||
if(team.isBlue())
|
if(team.isBlue())
|
||||||
GlobalRecorder.getInstance().blueSchem(schematic, rotate);
|
GlobalRecorder.getInstance().blueSchem(schematic, changeRotation);
|
||||||
else
|
else
|
||||||
GlobalRecorder.getInstance().redSchem(schematic, rotate);
|
GlobalRecorder.getInstance().redSchem(schematic, changeRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste);
|
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.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.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||||
Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ()/2.0 - dims.getBlockZ() : -dims.getBlockZ()/2.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)),
|
).add(new Vector(usedRotate ? 1 : 0, 0, usedRotate ? 1 : 0)),
|
||||||
new AffineTransform().rotateY(rotate ? 180 : 0)
|
new AffineTransform().rotateY(usedRotate ? 180 : 0)
|
||||||
);
|
);
|
||||||
FightSystem.getHullHider().initialize(team);
|
FightSystem.getHullHider().initialize(team);
|
||||||
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
|
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
|
||||||
|
|||||||
@@ -458,12 +458,8 @@ public class FightTeam {
|
|||||||
return schematic.getId();
|
return schematic.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSchematicRotate() {
|
public void setSchematicChangeRotate(boolean rotate) {
|
||||||
return schematic.isRotate();
|
schematic.setChangeRotate(rotate);
|
||||||
}
|
|
||||||
|
|
||||||
public void setSchematicRotate(boolean rotate) {
|
|
||||||
schematic.setRotate(rotate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Clipboard getClipboard() {
|
public Clipboard getClipboard() {
|
||||||
|
|||||||
+2
-2
@@ -531,10 +531,10 @@ public class PacketProcessor implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void rotateSchem(FightTeam team) throws IOException {
|
private void rotateSchem(FightTeam team) throws IOException {
|
||||||
boolean rotate = source.readBoolean();
|
boolean changeRotate = source.readBoolean();
|
||||||
|
|
||||||
execSync(() -> {
|
execSync(() -> {
|
||||||
team.setSchematicRotate(rotate);
|
team.setSchematicChangeRotate(changeRotate);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ public interface Recorder {
|
|||||||
default void enableTeam(FightTeam team){
|
default void enableTeam(FightTeam team){
|
||||||
if(FightState.Schem.contains(FightState.getFightState())){
|
if(FightState.Schem.contains(FightState.getFightState())){
|
||||||
if(team.isBlue())
|
if(team.isBlue())
|
||||||
blueSchem(team.getSchematic(), team.getSchematicRotate());
|
blueSchem(team.getSchematic(), false);
|
||||||
else
|
else
|
||||||
redSchem(team.getSchematic(), team.getSchematicRotate());
|
redSchem(team.getSchematic(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FightState.AntiSpectate.contains(FightState.getFightState())){
|
if(FightState.AntiSpectate.contains(FightState.getFightState())){
|
||||||
@@ -123,8 +123,8 @@ public interface Recorder {
|
|||||||
* TeamIDPacket (0xb2) + int blueTeamId, redTeamId
|
* TeamIDPacket (0xb2) + int blueTeamId, redTeamId
|
||||||
* BlueEmbeddedSchemPacket (0xb3) + int blueSchemId + gzipt NBT blob
|
* BlueEmbeddedSchemPacket (0xb3) + int blueSchemId + gzipt NBT blob
|
||||||
* RedEmbeddedSchemPacket (0xb4) + int redSchemId + gzipt NBT blob
|
* RedEmbeddedSchemPacket (0xb4) + int redSchemId + gzipt NBT blob
|
||||||
* BlueSchemRotatePacket (0xb5) + boolean rotate
|
* BlueSchemRotatePacket (0xb5) + boolean changeRotate
|
||||||
* RedSchemRotatePacket (0xb6) + boolean rotate
|
* RedSchemRotatePacket (0xb6) + boolean changeRotate
|
||||||
*
|
*
|
||||||
* DEPRECATED ScoreboardTitlePacket (0xc0) + String scoreboardTitle
|
* DEPRECATED ScoreboardTitlePacket (0xc0) + String scoreboardTitle
|
||||||
* DEPRECATED ScoreboardDataPacket (0xc1) + String key + int value
|
* DEPRECATED ScoreboardDataPacket (0xc1) + String key + int value
|
||||||
@@ -261,18 +261,18 @@ public interface Recorder {
|
|||||||
write(0xb2, blueTeamId, redTeamId);
|
write(0xb2, blueTeamId, redTeamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void blueSchem(int schemId, boolean rotate) {
|
default void blueSchem(int schemId, boolean changeRotate) {
|
||||||
rotate(0xb5, rotate);
|
rotate(0xb5, changeRotate);
|
||||||
schem(0xb3, 0xb0, schemId);
|
schem(0xb3, 0xb0, schemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void redSchem(int schemId, boolean rotate) {
|
default void redSchem(int schemId, boolean changeRotate) {
|
||||||
rotate(0xb6, rotate);
|
rotate(0xb6, changeRotate);
|
||||||
schem(0xb4, 0xb1, schemId);
|
schem(0xb4, 0xb1, schemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void rotate(int packetId, boolean rotate) {
|
default void rotate(int packetId, boolean changeRotate) {
|
||||||
write(packetId, rotate);
|
write(packetId, changeRotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void schem(int embedId, int noEmbedId, int schemId){
|
default void schem(int embedId, int noEmbedId, int schemId){
|
||||||
|
|||||||
Reference in New Issue
Block a user