SteamWar/FightSystem
Archiviert
13
1

Add initial setup for ranked rework
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-02-23 10:02:13 +01:00
Ursprung 84f0ccee81
Commit 737f8f6ebd
5 geänderte Dateien mit 32 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -92,6 +92,8 @@ public class Config {
public static final UUID BlueLeader;
public static final UUID RedLeader;
public static final boolean Ranked;
public static final List<UUID> BlueTeam;
public static final List<UUID> RedTeam;
//Active win conditions
public static final Set<Winconditions> ActiveWinconditions;
@ -371,6 +373,19 @@ public class Config {
Ranked = Boolean.parseBoolean(System.getProperty("ranked", "false"));
ReplayID = Integer.parseInt(System.getProperty("replay", "0"));
String blueTeam = System.getProperty("blueTeam", null);
String redTeam = System.getProperty("redTeam", null);
if (blueTeam != null) {
BlueTeam = Arrays.stream(blueTeam.split(",")).map(UUID::fromString).collect(Collectors.toList());
} else {
BlueTeam = new ArrayList<>(0);
}
if (redTeam != null) {
RedTeam = Arrays.stream(redTeam.split(",")).map(UUID::fromString).collect(Collectors.toList());
} else {
RedTeam = new ArrayList<>(0);
}
if(Ranked){
mode = ArenaMode.RANKED;
}else if(CheckSchemID != 0){

Datei anzeigen

@ -39,8 +39,8 @@ import java.util.List;
public class Fight {
private Fight(){}
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, Config.RedLeader);
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, Config.BlueLeader);
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, Config.RedLeader, Config.RedTeam);
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, Config.BlueLeader, Config.BlueTeam);
public static FightTeam getPlayerTeam(Player player) {
if(redTeam.isPlayerInTeam(player))

Datei anzeigen

@ -48,6 +48,7 @@ import java.util.*;
public class FightTeam {
private UUID designatedLeader;
private List<UUID> designatedMembers;
private FightPlayer leader;
private int schemRank;
@ -69,7 +70,7 @@ public class FightTeam {
private final Region extendRegion;
@SuppressWarnings("deprecation")
public FightTeam(String name, String prefix, Location spawn, Region schemRegion, Region extendRegion, boolean rotate, boolean blue, UUID designatedLeader) {
public FightTeam(String name, String prefix, Location spawn, Region schemRegion, Region extendRegion, boolean rotate, boolean blue, UUID designatedLeader, List<UUID> designatedMembers) {
this.spawn = spawn;
this.schemRegion = schemRegion;
this.extendRegion = extendRegion;
@ -78,6 +79,7 @@ public class FightTeam {
this.skip = false;
this.blue = blue;
this.designatedLeader = designatedLeader;
this.designatedMembers = designatedMembers;
setPrefixAndName(prefix, name);
this.schematic = new FightSchematic(this, rotate);
new KitLoader();
@ -221,7 +223,7 @@ public class FightTeam {
GlobalRecorder.getInstance().playerJoins(player);
TechHider.reloadChunks(player, chunksToReload, false);
if(isLeaderless())
if(isLeaderless() && canbeLeader(player))
setLeader(fightPlayer, silent);
else if(!silent)
FightUI.addSubtitle("UI_PLAYER_JOINS", prefix, player.getName());
@ -276,6 +278,7 @@ public class FightTeam {
this.leader = leader;
designatedLeader = null;
designatedMembers = null;
if(ready)
setReady(false);

Datei anzeigen

@ -47,6 +47,11 @@ public class NormalJoin implements Listener {
}else if(Fight.getRedTeam().canbeLeader(player)) {
Fight.getRedTeam().addMember(player);
}
if (Config.RedTeam.contains(player.getUniqueId())) {
Fight.getBlueTeam().addMember(player, true);
} else if (Config.BlueTeam.contains(player.getUniqueId())) {
Fight.getRedTeam().addMember(player, true);
}
}
}
}

Datei anzeigen

@ -47,6 +47,11 @@ public class RankedJoin implements Listener {
}else if(Fight.getRedTeam().canbeLeader(player)) {
Fight.getRedTeam().addMember(player);
}
if (Config.RedTeam.contains(player.getUniqueId())) {
Fight.getBlueTeam().addMember(player, true);
} else if (Config.BlueTeam.contains(player.getUniqueId())) {
Fight.getRedTeam().addMember(player, true);
}
}
}
}