Merge pull request 'Allow multiple Referees per Event' (#417) from referee into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #417 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
447c8767f1
@ -21,10 +21,7 @@ package de.steamwar.fightsystem;
|
|||||||
|
|
||||||
import de.steamwar.fightsystem.utils.Region;
|
import de.steamwar.fightsystem.utils.Region;
|
||||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||||
import de.steamwar.sql.Event;
|
import de.steamwar.sql.*;
|
||||||
import de.steamwar.sql.EventFight;
|
|
||||||
import de.steamwar.sql.SteamwarUser;
|
|
||||||
import de.steamwar.sql.Team;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -125,8 +122,8 @@ public class Config {
|
|||||||
public static final String ObfuscateWith;
|
public static final String ObfuscateWith;
|
||||||
|
|
||||||
//event parameter
|
//event parameter
|
||||||
private static final int EventKampfID;
|
|
||||||
public static final EventFight EventKampf;
|
public static final EventFight EventKampf;
|
||||||
|
private static final Set<Integer> Referees;
|
||||||
public static final int EventTeamBlueID;
|
public static final int EventTeamBlueID;
|
||||||
public static final int EventTeamRedID;
|
public static final int EventTeamRedID;
|
||||||
public static final boolean BothTeamsPublic;
|
public static final boolean BothTeamsPublic;
|
||||||
@ -317,17 +314,17 @@ public class Config {
|
|||||||
ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
|
ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
|
||||||
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ);
|
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ);
|
||||||
|
|
||||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||||
if(EventKampfID >= 1){
|
if(eventKampfID >= 1){
|
||||||
EventFight eventFight = EventFight.get(EventKampfID);
|
EventKampf = EventFight.get(eventKampfID);
|
||||||
if(eventFight == null){
|
if(EventKampf == null){
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert eventFight != null;
|
assert EventKampf != null;
|
||||||
Team team1 = Team.get(eventFight.getTeamBlue());
|
Team team1 = Team.get(EventKampf.getTeamBlue());
|
||||||
Team team2 = Team.get(eventFight.getTeamRed());
|
Team team2 = Team.get(EventKampf.getTeamRed());
|
||||||
|
|
||||||
if(team1 == null || team2 == null){
|
if(team1 == null || team2 == null){
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
|
||||||
@ -343,9 +340,9 @@ public class Config {
|
|||||||
EventTeamBlueID = team1.getTeamId();
|
EventTeamBlueID = team1.getTeamId();
|
||||||
EventTeamRedID = team2.getTeamId();
|
EventTeamRedID = team2.getTeamId();
|
||||||
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
|
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
|
||||||
EventKampf = eventFight;
|
Referees = Referee.get(Config.EventKampf.getEventID());
|
||||||
|
|
||||||
Event event = Event.get(eventFight.getEventID());
|
Event event = Event.get(EventKampf.getEventID());
|
||||||
if(BothTeamsPublic) {
|
if(BothTeamsPublic) {
|
||||||
OnlyPublicSchematics = true;
|
OnlyPublicSchematics = true;
|
||||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||||
@ -365,6 +362,7 @@ public class Config {
|
|||||||
EventTeamRedID = 0;
|
EventTeamRedID = 0;
|
||||||
EventKampf = null;
|
EventKampf = null;
|
||||||
BothTeamsPublic = true;
|
BothTeamsPublic = true;
|
||||||
|
Referees = Collections.emptySet();
|
||||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||||
LiveReplay = false;
|
LiveReplay = false;
|
||||||
}
|
}
|
||||||
@ -388,9 +386,9 @@ public class Config {
|
|||||||
mode = ArenaMode.CHECK;
|
mode = ArenaMode.CHECK;
|
||||||
}else if(PrepareSchemID != 0){
|
}else if(PrepareSchemID != 0){
|
||||||
mode = ArenaMode.PREPARE;
|
mode = ArenaMode.PREPARE;
|
||||||
}else if(EventKampfID >= 1){
|
}else if(eventKampfID >= 1){
|
||||||
mode = ArenaMode.EVENT;
|
mode = ArenaMode.EVENT;
|
||||||
}else if(EventKampfID == -1){
|
}else if(eventKampfID == -1){
|
||||||
mode = ArenaMode.TEST;
|
mode = ArenaMode.TEST;
|
||||||
}else if(ReplayID != 0){
|
}else if(ReplayID != 0){
|
||||||
mode = ArenaMode.REPLAY;
|
mode = ArenaMode.REPLAY;
|
||||||
@ -410,8 +408,6 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isReferee(Player player) {
|
public static boolean isReferee(Player player) {
|
||||||
if(EventKampf == null)
|
return Referees.contains(SteamwarUser.get(player.getUniqueId()).getId());
|
||||||
return false;
|
|
||||||
return SteamwarUser.get(player.getUniqueId()).getId() == EventKampf.getKampfleiter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren