@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user