Fix PR stuff
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-05-29 11:32:50 +02:00
parent 7d45680fcb
commit b14cf445df
5 changed files with 15 additions and 19 deletions

View File

@ -212,9 +212,7 @@ public class GUI {
SchematicNode node = SchematicNode.getSchematicNode(-1, Config.GameName, (Integer) null);
if (node != null) {
inv.setItem(2, new SWItem(SWItem.getMaterial(node.getItem()), msg.parse("SCHEM_DIRT", p), click -> {
schemSelect(p, node, fightTeam -> {
fightTeam.setIgnoreWinconditions(true);
});
schemSelect(p, node);
}));
}
}
@ -253,19 +251,16 @@ public class GUI {
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
schemSelect(p, node, fightTeam -> {
fightTeam.setIgnoreWinconditions(false);
});
schemSelect(p, node);
});
selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
selector.open();
}
private static void schemSelect(Player p, SchematicNode node, Consumer<FightTeam> fightTeamConsumer) {
private static void schemSelect(Player p, SchematicNode node) {
FightTeam fightTeam = Fight.getPlayerTeam(p);
if(fightTeam == null)
return;
fightTeamConsumer.accept(fightTeam);
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
fightTeam.pasteSchem(node);
p.closeInventory();

View File

@ -42,7 +42,6 @@ import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import lombok.Getter;
import lombok.Setter;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.*;
import org.bukkit.entity.LivingEntity;
@ -101,10 +100,6 @@ public class FightTeam {
@Getter
private boolean publicsOnly;
@Getter
@Setter
private boolean ignoreWinconditions;
private final Map<UUID, FightPlayer> players = new HashMap<>();
@Getter

View File

@ -84,8 +84,11 @@ public class WinconditionBlocks extends Wincondition implements PrintableWincond
}
private void check() {
// Edge Case for DirtBlock
if (blocks.isEmpty()) return;
blocks.removeIf(block -> !isOfType.test(block));
if(blocks.isEmpty() && !team.isIgnoreWinconditions())
if(blocks.isEmpty())
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}

View File

@ -42,8 +42,6 @@ public class WinconditionCaptainDead extends Wincondition implements Listener {
return;
FightTeam team = leader.getTeam();
if (team.isIgnoreWinconditions())
return;
win(Fight.getOpposite(team), "WIN_LEADER_DEAD", team.getPrefix() + leader.getEntity().getName());
}
}

View File

@ -40,8 +40,6 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
private final Map<FightTeam, TeamPercent> teamMap = new HashMap<>();
protected Consumer<FightTeam> checkWin = team -> {
if (team.isIgnoreWinconditions())
return;
if (getPercent(team) >= Config.PercentWin) {
win(Fight.getOpposite(team), "WIN_PERCENT", team.getColoredName());
}
@ -80,6 +78,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
private int totalBlocks = 0;
private int currentBlocks = 0;
private boolean countAnyBlock = false;
private TeamPercent(FightTeam team, Winconditions wincondition) {
this.team = team;
@ -100,7 +99,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
}
event.blockList().forEach(block -> {
if (Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) {
if (countAnyBlock || Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) {
currentBlocks--;
}
});
@ -110,10 +109,16 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
private void enable() {
totalBlocks = 0;
countAnyBlock = false;
team.getSchemRegion().forEach((x, y, z) -> {
if (Config.PercentBlocks.contains(Config.world.getBlockAt(x, y, z).getType()) == Config.PercentBlocksWhitelist)
totalBlocks++;
});
// Edge Case for DirtBlock
if (totalBlocks == 0) {
totalBlocks = team.getSchemRegion().volume();
countAnyBlock = true;
}
currentBlocks = totalBlocks;
postEnable.accept(team);
}