diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java index dba60ee..046cfd8 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java @@ -21,10 +21,7 @@ package de.steamwar.fightsystem; import de.steamwar.fightsystem.utils.Region; import de.steamwar.fightsystem.winconditions.Winconditions; -import de.steamwar.sql.Event; -import de.steamwar.sql.EventFight; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.Team; +import de.steamwar.sql.*; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -125,8 +122,8 @@ public class Config { public static final String ObfuscateWith; //event parameter - private static final int EventKampfID; public static final EventFight EventKampf; + private static final Set Referees; public static final int EventTeamBlueID; public static final int EventTeamRedID; 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); PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ); - EventKampfID = Integer.parseInt(System.getProperty("fightID", "0")); - if(EventKampfID >= 1){ - EventFight eventFight = EventFight.get(EventKampfID); - if(eventFight == null){ + int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0")); + if(eventKampfID >= 1){ + EventKampf = EventFight.get(eventKampfID); + if(EventKampf == null){ Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight"); Bukkit.shutdown(); } - assert eventFight != null; - Team team1 = Team.get(eventFight.getTeamBlue()); - Team team2 = Team.get(eventFight.getTeamRed()); + assert EventKampf != null; + Team team1 = Team.get(EventKampf.getTeamBlue()); + Team team2 = Team.get(EventKampf.getTeamRed()); if(team1 == null || team2 == null){ Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team"); @@ -343,9 +340,9 @@ public class Config { EventTeamBlueID = team1.getTeamId(); EventTeamRedID = team2.getTeamId(); 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) { OnlyPublicSchematics = true; MaximumTeamMembers = Integer.MAX_VALUE; @@ -365,6 +362,7 @@ public class Config { EventTeamRedID = 0; EventKampf = null; BothTeamsPublic = true; + Referees = Collections.emptySet(); MaximumTeamMembers = Integer.MAX_VALUE; LiveReplay = false; } @@ -388,9 +386,9 @@ public class Config { mode = ArenaMode.CHECK; }else if(PrepareSchemID != 0){ mode = ArenaMode.PREPARE; - }else if(EventKampfID >= 1){ + }else if(eventKampfID >= 1){ mode = ArenaMode.EVENT; - }else if(EventKampfID == -1){ + }else if(eventKampfID == -1){ mode = ArenaMode.TEST; }else if(ReplayID != 0){ mode = ArenaMode.REPLAY; @@ -410,8 +408,6 @@ public class Config { } public static boolean isReferee(Player player) { - if(EventKampf == null) - return false; - return SteamwarUser.get(player.getUniqueId()).getId() == EventKampf.getKampfleiter(); + return Referees.contains(SteamwarUser.get(player.getUniqueId()).getId()); } }