2020-08-26 18:24:44 +02:00
|
|
|
/*
|
|
|
|
This file is a part of the SteamWar software.
|
|
|
|
|
|
|
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-11-16 08:37:33 +01:00
|
|
|
package de.steamwar.fightsystem;
|
|
|
|
|
|
|
|
import de.steamwar.sql.Event;
|
|
|
|
import de.steamwar.sql.EventFight;
|
|
|
|
import de.steamwar.sql.Team;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.World;
|
2020-01-06 20:37:41 +01:00
|
|
|
import org.bukkit.configuration.ConfigurationSection;
|
2019-11-16 08:37:33 +01:00
|
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
2020-05-22 23:16:26 +02:00
|
|
|
import org.bukkit.util.Vector;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
import java.io.File;
|
2020-01-06 20:37:41 +01:00
|
|
|
import java.util.*;
|
2019-11-16 08:37:33 +01:00
|
|
|
import java.util.logging.Level;
|
|
|
|
|
|
|
|
public class Config {
|
|
|
|
|
|
|
|
private Config(){}
|
|
|
|
|
2020-01-11 15:56:31 +01:00
|
|
|
//Fight sequence
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final int NoPlayerOnlineDuration;
|
2020-01-11 15:56:31 +01:00
|
|
|
public static final int PreSchemPasteDuration;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final int SetupDuration;
|
|
|
|
public static final int PreFightDuration;
|
|
|
|
public static final int SpectatorDuration;
|
2020-06-03 10:19:57 +02:00
|
|
|
|
|
|
|
// entern parameter
|
|
|
|
public static final List<Integer> EnterStages;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//arena parameter
|
|
|
|
public static final int SchemsizeX;
|
|
|
|
public static final int SchemsizeY;
|
|
|
|
public static final int SchemsizeZ;
|
|
|
|
public static final int TeamBlueCornerX;
|
|
|
|
public static final int TeamBlueCornerY;
|
|
|
|
public static final int TeamBlueCornerZ;
|
2019-11-23 18:15:45 +01:00
|
|
|
private static final int TeamBluePasteX;
|
|
|
|
private static final int TeamBluePasteZ;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final Location TeamBlueSpawn;
|
|
|
|
public static final int TeamRedCornerX;
|
|
|
|
public static final int TeamRedCornerY;
|
|
|
|
public static final int TeamRedCornerZ;
|
2019-11-23 18:15:45 +01:00
|
|
|
private static final int TeamRedPasteX;
|
|
|
|
private static final int TeamRedPasteZ;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final Location TeamRedSpawn;
|
|
|
|
private static final int TeamBluetoReddistanceX;
|
|
|
|
private static final int TeamBluetoReddistanceY;
|
|
|
|
public static final int TeamBluetoReddistanceZ;
|
|
|
|
public static final Location SpecSpawn;
|
|
|
|
public static final int underArenaBorder;
|
|
|
|
public static final int BorderFromSchematic;
|
|
|
|
public static final int upperArenaBorder;
|
|
|
|
public static final boolean AlignWater;
|
|
|
|
public static final int WaterDepth;
|
|
|
|
private static final int Schem2BorderX;
|
|
|
|
private static final int Schem2BorderZ;
|
|
|
|
public static final int ArenaMinX;
|
|
|
|
public static final int ArenaMinZ;
|
|
|
|
public static final int ArenaMaxX;
|
|
|
|
public static final int ArenaMaxZ;
|
2020-05-21 08:42:39 +02:00
|
|
|
public static final boolean GroundWalkable;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//schematic parameter
|
2020-05-22 10:09:34 +02:00
|
|
|
public static final boolean RanksEnabled;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final boolean OnlyPublicSchematics;
|
2020-01-19 17:32:29 +01:00
|
|
|
public static final boolean IgnorePublicOnly;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final de.steamwar.sql.SchematicType SchematicType;
|
|
|
|
public static final boolean TeamRedRotate;
|
|
|
|
public static final boolean TeamBlueRotate;
|
2019-12-06 22:51:26 +01:00
|
|
|
public static final boolean ReplaceObsidian;
|
|
|
|
public static final boolean ReplaceBedrock;
|
2020-04-21 10:08:02 +02:00
|
|
|
public static final boolean ReplaceWithBlockupdates;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//team parameter
|
|
|
|
public static final String TeamRedName;
|
|
|
|
public static final String TeamBlueName;
|
2020-12-28 18:02:04 +01:00
|
|
|
public static final String TeamRedColor;
|
|
|
|
public static final String TeamBlueColor;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final String GameName;
|
|
|
|
public static final String TeamChatDetection;
|
|
|
|
public static final UUID BlueLeader;
|
|
|
|
public static final UUID RedLeader;
|
2020-07-07 17:56:35 +02:00
|
|
|
public static final boolean Ranked;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//Active win conditions
|
|
|
|
public static final boolean Timeout;
|
2019-12-24 14:38:42 +01:00
|
|
|
public static final boolean HeartRatioTimeout;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final boolean AllDead;
|
|
|
|
public static final boolean CaptainDead;
|
|
|
|
public static final boolean PercentSystem;
|
2019-12-21 20:46:31 +01:00
|
|
|
public static final boolean RelativePercent;
|
|
|
|
public static final boolean Points;
|
2019-11-16 08:37:33 +01:00
|
|
|
public static final boolean TechKO;
|
|
|
|
public static final boolean WaterTechKO;
|
2019-12-27 12:32:15 +01:00
|
|
|
public static final boolean PumpkinTechKO;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//win condition parameters
|
|
|
|
public static final int TimeoutTime;
|
|
|
|
public static final double PercentWin;
|
2019-12-21 20:46:31 +01:00
|
|
|
public static final List<String> IgnoredBlocks;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//default kits
|
|
|
|
public static final String MemberDefault;
|
|
|
|
public static final String LeaderDefault;
|
2020-01-19 17:25:11 +01:00
|
|
|
public static final boolean PersonalKits;
|
2020-01-23 08:31:32 +01:00
|
|
|
public static final List<String> ForbiddenItems;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//tech hider parameter
|
2020-05-19 09:42:49 +02:00
|
|
|
public static final boolean TechhiderActive;
|
2020-01-06 20:37:41 +01:00
|
|
|
public static final Set<Integer> HiddenBlocks;
|
|
|
|
public static final Set<String> HiddenBlockTags;
|
|
|
|
public static final Set<String> HiddenBlockEntities;
|
2019-11-25 17:53:23 +01:00
|
|
|
public static final int ObfuscateWith;
|
|
|
|
public static final String ObfuscateWithTag;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
//event parameter
|
|
|
|
private static final int EventKampfID;
|
|
|
|
public static final int EventTeamBlueID;
|
|
|
|
public static final int EventTeamRedID;
|
|
|
|
public static final boolean BothTeamsPublic;
|
|
|
|
public static final int MaximumTeamMembers;
|
2020-10-30 14:06:38 +01:00
|
|
|
public static final boolean SpectateSystem;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
2020-04-30 16:09:24 +02:00
|
|
|
//check parameter
|
|
|
|
public static final int CheckSchemID;
|
|
|
|
|
2020-08-22 10:45:40 +02:00
|
|
|
//live recorder parameter
|
|
|
|
public static final String spectateIP = "127.0.0.1";
|
|
|
|
public static final int spectatePort = 2222;
|
|
|
|
|
2019-11-16 08:37:33 +01:00
|
|
|
static{
|
|
|
|
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
|
|
|
if(!worldConfigFile.exists()) {
|
|
|
|
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
|
|
|
IFightSystem.shutdown(null);
|
|
|
|
}
|
|
|
|
if(!new File(IFightSystem.getPlugin().getDataFolder(), "config.yml").exists()) {
|
|
|
|
IFightSystem.getPlugin().saveDefaultConfig();
|
|
|
|
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
|
|
|
IFightSystem.shutdown(null);
|
|
|
|
}
|
|
|
|
FileConfiguration config = IFightSystem.getPlugin().getConfig();
|
|
|
|
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
|
|
|
|
|
|
|
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration");
|
2020-01-11 15:56:31 +01:00
|
|
|
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration");
|
2019-11-16 08:37:33 +01:00
|
|
|
SetupDuration = config.getInt("Times.SetupDuration");
|
|
|
|
PreFightDuration = config.getInt("Times.PreFightDuration");
|
|
|
|
SpectatorDuration = config.getInt("Times.SpectatorDuration");
|
|
|
|
|
|
|
|
int schemsizeX = worldconfig.getInt("Arena.Schemsize.x");
|
|
|
|
int schemsizeY = worldconfig.getInt("Arena.Schemsize.y");
|
|
|
|
int schemsizeZ = worldconfig.getInt("Arena.Schemsize.z");
|
|
|
|
int teamBlueCornerX = worldconfig.getInt("Arena.TeamBlueCorner.x");
|
|
|
|
int teamBlueCornerY = worldconfig.getInt("Arena.TeamBlueCorner.y");
|
|
|
|
int teamBlueCornerZ = worldconfig.getInt("Arena.TeamBlueCorner.z");
|
|
|
|
TeamBluetoReddistanceX = worldconfig.getInt("Arena.TeamBluetoReddistance.x");
|
|
|
|
TeamBluetoReddistanceY = worldconfig.getInt("Arena.TeamBluetoReddistance.y");
|
|
|
|
TeamBluetoReddistanceZ = worldconfig.getInt("Arena.TeamBluetoReddistance.z");
|
|
|
|
Schem2BorderX = worldconfig.getInt("Arena.Schem2Border.x");
|
|
|
|
Schem2BorderZ = worldconfig.getInt("Arena.Schem2Border.z");
|
|
|
|
underArenaBorder = worldconfig.getInt("Arena.underArenaBorder");
|
|
|
|
BorderFromSchematic = worldconfig.getInt("Arena.BorderFromSchematic");
|
|
|
|
AlignWater = worldconfig.getBoolean("Arena.AlignWater");
|
|
|
|
WaterDepth = worldconfig.getInt("Arena.WaterDepth");
|
2020-05-21 08:42:39 +02:00
|
|
|
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
|
2020-05-21 09:28:50 +02:00
|
|
|
double teamBlueSpawnOffsetX = worldconfig.getDouble("Arena.SpawnOffset.x");
|
|
|
|
double teamBlueSpawnOffsetY = worldconfig.getDouble("Arena.SpawnOffset.y");
|
|
|
|
double teamBlueSpawnOffsetZ = worldconfig.getDouble("Arena.SpawnOffset.z");
|
2019-11-16 08:37:33 +01:00
|
|
|
|
2020-05-22 10:09:34 +02:00
|
|
|
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
|
2019-11-16 08:37:33 +01:00
|
|
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
2020-01-19 17:32:29 +01:00
|
|
|
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
|
2019-11-16 08:37:33 +01:00
|
|
|
boolean rotate = config.getBoolean("Schematic.Rotate");
|
2019-12-06 22:51:26 +01:00
|
|
|
ReplaceObsidian = config.getBoolean("Schematic.ReplaceObsidian");
|
|
|
|
ReplaceBedrock = config.getBoolean("Schematic.ReplaceBedrock");
|
2020-04-21 10:08:02 +02:00
|
|
|
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates");
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
GameName = config.getString("Output.GameName");
|
|
|
|
TeamChatDetection = config.getString("Output.TeamChatDetection");
|
|
|
|
|
|
|
|
Timeout = config.getBoolean("WinConditions.Timeout");
|
2019-12-24 14:38:42 +01:00
|
|
|
HeartRatioTimeout = config.getBoolean("WinConditions.HeartRatioTimeout");
|
2019-11-16 08:37:33 +01:00
|
|
|
AllDead = config.getBoolean("WinConditions.AllDead");
|
|
|
|
CaptainDead = config.getBoolean("WinConditions.CaptainDead");
|
|
|
|
PercentSystem = config.getBoolean("WinConditions.PercentSystem");
|
2019-12-21 20:46:31 +01:00
|
|
|
RelativePercent = config.getBoolean("WinConditions.RelativePercent");
|
|
|
|
Points = config.getBoolean("WinConditions.Points");
|
2019-11-16 08:37:33 +01:00
|
|
|
TechKO = config.getBoolean("WinConditions.TechKO");
|
|
|
|
WaterTechKO = config.getBoolean("WinConditions.WaterTechKO");
|
2019-12-27 12:32:15 +01:00
|
|
|
PumpkinTechKO = config.getBoolean("WinConditions.PumpkinTechKO");
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime");
|
|
|
|
PercentWin = config.getDouble("WinConditionParams.PercentWin");
|
2019-12-21 20:46:31 +01:00
|
|
|
IgnoredBlocks = Collections.unmodifiableList(config.getStringList("WinConditionParams.IgnoredBlocks"));
|
2019-11-16 08:37:33 +01:00
|
|
|
|
2020-06-03 10:19:57 +02:00
|
|
|
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
|
|
|
|
|
2019-11-16 08:37:33 +01:00
|
|
|
MemberDefault = config.getString("Kits.MemberDefault");
|
|
|
|
LeaderDefault = config.getString("Kits.LeaderDefault");
|
2020-01-19 17:25:11 +01:00
|
|
|
PersonalKits = config.getBoolean("Kits.PersonalKits");
|
2020-01-23 08:31:32 +01:00
|
|
|
ForbiddenItems = config.getStringList("Kits.ForbiddenItems");
|
2019-11-16 08:37:33 +01:00
|
|
|
|
2020-01-06 20:37:41 +01:00
|
|
|
ConfigurationSection techhiderConfig = config.getConfigurationSection("Techhider.HiddenBlocks");
|
|
|
|
Set<Integer> blocks = new HashSet<>();
|
|
|
|
Set<String> blockTags = new HashSet<>();
|
|
|
|
for(String key : techhiderConfig.getKeys(false)){
|
|
|
|
blockTags.add(key);
|
|
|
|
if(techhiderConfig.isInt(key))
|
|
|
|
blocks.add(techhiderConfig.getInt(key));
|
|
|
|
else{
|
|
|
|
List<Integer> minmax = techhiderConfig.getIntegerList(key); // Entry 0: Minimum, Entry 1: Maximum
|
|
|
|
for(int i = minmax.get(0); i <= minmax.get(1); i++)
|
|
|
|
blocks.add(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
HiddenBlocks = Collections.unmodifiableSet(blocks);
|
|
|
|
HiddenBlockTags = Collections.unmodifiableSet(blockTags);
|
|
|
|
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
2019-11-25 17:53:23 +01:00
|
|
|
ObfuscateWith = config.getInt("Techhider.ObfuscateWith");
|
|
|
|
ObfuscateWithTag = config.getString("Techhider.ObfuscateWithTag");
|
2020-05-19 09:42:49 +02:00
|
|
|
TechhiderActive = config.getBoolean("Techhider.Active");
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
if(schemsizeX < 0){
|
|
|
|
SchemsizeX = -schemsizeX;
|
|
|
|
TeamBlueCornerX = teamBlueCornerX - SchemsizeX;
|
|
|
|
}else{
|
|
|
|
SchemsizeX = schemsizeX;
|
|
|
|
TeamBlueCornerX = teamBlueCornerX;
|
|
|
|
}
|
|
|
|
if(schemsizeY < 0){
|
|
|
|
SchemsizeY = -schemsizeY;
|
|
|
|
TeamBlueCornerY = teamBlueCornerY - SchemsizeY;
|
|
|
|
}else{
|
|
|
|
SchemsizeY = schemsizeY;
|
|
|
|
TeamBlueCornerY = teamBlueCornerY;
|
|
|
|
}
|
|
|
|
if(schemsizeZ < 0){
|
|
|
|
SchemsizeZ = -schemsizeZ;
|
|
|
|
TeamBlueCornerZ = teamBlueCornerZ - SchemsizeZ;
|
|
|
|
}else{
|
|
|
|
SchemsizeZ = schemsizeZ;
|
|
|
|
TeamBlueCornerZ = teamBlueCornerZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
upperArenaBorder = TeamBlueCornerY + SchemsizeY + BorderFromSchematic;
|
|
|
|
|
|
|
|
TeamRedCornerX = TeamBluetoReddistanceX + TeamBlueCornerX;
|
|
|
|
TeamRedCornerY = TeamBluetoReddistanceY + TeamBlueCornerY;
|
|
|
|
TeamRedCornerZ = TeamBluetoReddistanceZ + TeamBlueCornerZ;
|
|
|
|
|
2019-11-23 18:15:45 +01:00
|
|
|
TeamBluePasteX = TeamBlueCornerX + SchemsizeX / 2;
|
|
|
|
TeamBluePasteZ = TeamBlueCornerZ + SchemsizeZ / 2;
|
|
|
|
TeamRedPasteX = TeamBluePasteX + TeamBluetoReddistanceX;
|
|
|
|
TeamRedPasteZ = TeamBluePasteZ + TeamBluetoReddistanceZ;
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
World world = Bukkit.getWorlds().get(0);
|
2020-05-22 17:16:19 +02:00
|
|
|
|
2020-05-21 09:28:50 +02:00
|
|
|
TeamBlueSpawn = new Location(world,
|
|
|
|
TeamBluePasteX + 0.5 + teamBlueSpawnOffsetX,
|
|
|
|
TeamBlueCornerY + 0.5 + teamBlueSpawnOffsetY,
|
|
|
|
TeamBluePasteZ + 0.5 + teamBlueSpawnOffsetZ);
|
2020-05-22 17:16:19 +02:00
|
|
|
|
2020-05-21 09:28:50 +02:00
|
|
|
TeamRedSpawn = new Location(world,
|
|
|
|
TeamRedPasteX + 0.5 - teamBlueSpawnOffsetX,
|
|
|
|
TeamRedCornerY + 0.5 + teamBlueSpawnOffsetY,
|
|
|
|
TeamRedPasteZ + 0.5 - teamBlueSpawnOffsetZ);
|
2020-05-22 17:52:32 +02:00
|
|
|
|
2020-05-22 23:16:26 +02:00
|
|
|
Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector());
|
2020-05-23 12:27:08 +02:00
|
|
|
double pitch = Math.toDegrees(v1.angle(v1.clone().setY(0)));
|
2020-05-23 12:50:55 +02:00
|
|
|
double yaw = Math.toDegrees(v1.clone().setY(0).angle(new Vector(0, 0, 1)));
|
2020-05-22 23:16:26 +02:00
|
|
|
double pitchInverted = pitch * -1;
|
|
|
|
double yawInverted = yaw + 180;
|
2020-05-22 17:52:32 +02:00
|
|
|
|
2020-05-23 12:50:55 +02:00
|
|
|
TeamBlueSpawn.setYaw((float) yawInverted);
|
2020-05-22 23:44:58 +02:00
|
|
|
TeamBlueSpawn.setPitch((float) pitch);
|
2020-05-22 23:16:26 +02:00
|
|
|
|
2020-05-23 12:50:55 +02:00
|
|
|
TeamRedSpawn.setYaw((float) yaw);
|
2020-05-22 23:44:58 +02:00
|
|
|
TeamRedSpawn.setPitch((float) pitchInverted);
|
2020-05-22 17:16:19 +02:00
|
|
|
|
2019-11-16 08:37:33 +01:00
|
|
|
SpecSpawn = new Location(world,
|
2019-11-23 18:15:45 +01:00
|
|
|
TeamBluePasteX + TeamBluetoReddistanceX/2.0,
|
2019-11-16 08:37:33 +01:00
|
|
|
TeamBlueCornerY + TeamBluetoReddistanceY/2.0 + SchemsizeY/2.0,
|
2019-11-23 18:15:45 +01:00
|
|
|
TeamBluePasteZ + TeamBluetoReddistanceZ/2.0);
|
2019-11-16 08:37:33 +01:00
|
|
|
|
|
|
|
boolean teamRedRotate;
|
|
|
|
boolean teamBlueRotate;
|
|
|
|
if(TeamBluetoReddistanceX > 0){
|
|
|
|
ArenaMinX = TeamBlueCornerX - Schem2BorderX;
|
|
|
|
ArenaMaxX = TeamRedCornerX + SchemsizeX + Schem2BorderX;
|
|
|
|
teamRedRotate = true;
|
|
|
|
teamBlueRotate = false;
|
|
|
|
}else{
|
|
|
|
ArenaMinX = TeamRedCornerX - Schem2BorderX;
|
|
|
|
ArenaMaxX = TeamBlueCornerX + SchemsizeX + Schem2BorderX;
|
|
|
|
teamRedRotate = false;
|
|
|
|
teamBlueRotate = true;
|
|
|
|
}
|
|
|
|
if(TeamBluetoReddistanceZ > 0){
|
|
|
|
ArenaMinZ = TeamBlueCornerZ - Schem2BorderZ;
|
|
|
|
ArenaMaxZ = TeamRedCornerZ + SchemsizeZ + Schem2BorderZ;
|
|
|
|
teamRedRotate = true;
|
|
|
|
teamBlueRotate = false;
|
|
|
|
}else{
|
|
|
|
ArenaMinZ = TeamRedCornerZ - Schem2BorderZ;
|
|
|
|
ArenaMaxZ = TeamBlueCornerZ + SchemsizeZ + Schem2BorderZ;
|
|
|
|
if(TeamBluetoReddistanceZ != 0){
|
|
|
|
teamRedRotate = false;
|
|
|
|
teamBlueRotate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!rotate){
|
|
|
|
teamRedRotate = false;
|
|
|
|
teamBlueRotate = false;
|
|
|
|
}
|
|
|
|
TeamRedRotate = teamRedRotate;
|
|
|
|
TeamBlueRotate = teamBlueRotate;
|
|
|
|
|
|
|
|
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
|
|
|
if(event()){
|
|
|
|
EventFight eventFight = EventFight.get(EventKampfID);
|
|
|
|
if(eventFight == null){
|
|
|
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
|
|
|
IFightSystem.shutdown(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert eventFight != null;
|
|
|
|
Team team1 = Team.get(eventFight.getTeamBlue());
|
|
|
|
Team team2 = Team.get(eventFight.getTeamRed());
|
|
|
|
|
|
|
|
if(team1 == null || team2 == null){
|
|
|
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
|
|
|
|
IFightSystem.shutdown(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert team1 != null;
|
|
|
|
assert team2 != null;
|
|
|
|
TeamBlueName = team1.getTeamKuerzel();
|
|
|
|
TeamRedName = team2.getTeamKuerzel();
|
2020-12-28 18:02:04 +01:00
|
|
|
TeamBlueColor = team1.getTeamColor();
|
|
|
|
TeamRedColor = team2.getTeamColor();
|
2019-11-16 08:37:33 +01:00
|
|
|
EventTeamBlueID = team1.getTeamId();
|
|
|
|
EventTeamRedID = team2.getTeamId();
|
|
|
|
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
|
|
|
|
|
|
|
|
IFightSystem.setEventFight(eventFight);
|
|
|
|
|
|
|
|
Event event = Event.get(eventFight.getEventID());
|
2019-11-18 18:52:12 +01:00
|
|
|
if(BothTeamsPublic) {
|
2019-11-16 08:37:33 +01:00
|
|
|
OnlyPublicSchematics = true;
|
2019-11-18 18:52:12 +01:00
|
|
|
MaximumTeamMembers = Integer.MAX_VALUE;
|
|
|
|
}else{
|
2019-11-16 08:37:33 +01:00
|
|
|
OnlyPublicSchematics = event.publicSchemsOnly();
|
2019-11-18 18:52:12 +01:00
|
|
|
MaximumTeamMembers = event.getMaximumTeamMembers();
|
|
|
|
}
|
2020-10-30 14:06:38 +01:00
|
|
|
SpectateSystem = event.spectateSystem();
|
2019-11-16 08:37:33 +01:00
|
|
|
}else{
|
|
|
|
//No event
|
2020-12-28 18:02:04 +01:00
|
|
|
TeamRedColor = config.getString("Output.TeamRedPrefix");
|
|
|
|
TeamBlueColor = config.getString("Output.TeamBluePrefix");
|
2019-11-16 08:37:33 +01:00
|
|
|
TeamRedName = config.getString("Output.TeamRedName");
|
|
|
|
TeamBlueName = config.getString("Output.TeamBlueName");
|
|
|
|
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics");
|
|
|
|
EventTeamBlueID = 0;
|
|
|
|
EventTeamRedID = 0;
|
|
|
|
BothTeamsPublic = true;
|
|
|
|
MaximumTeamMembers = Integer.MAX_VALUE;
|
2020-10-30 14:06:38 +01:00
|
|
|
SpectateSystem = false;
|
2019-11-16 08:37:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
String blueLeader = System.getProperty("blueLeader", null);
|
|
|
|
String redLeader = System.getProperty("redLeader", null);
|
|
|
|
if(blueLeader != null)
|
|
|
|
BlueLeader = UUID.fromString(blueLeader);
|
|
|
|
else
|
|
|
|
BlueLeader = null;
|
|
|
|
if(redLeader != null)
|
|
|
|
RedLeader = UUID.fromString(redLeader);
|
|
|
|
else
|
|
|
|
RedLeader = null;
|
2020-04-30 16:09:24 +02:00
|
|
|
|
|
|
|
CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0"));
|
2020-07-07 17:56:35 +02:00
|
|
|
Ranked = Boolean.parseBoolean(System.getProperty("ranked", "false"));
|
2019-11-16 08:37:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean event(){
|
|
|
|
return EventKampfID >= 1;
|
|
|
|
}
|
|
|
|
public static boolean test(){
|
|
|
|
return EventKampfID == -1;
|
|
|
|
}
|
2020-04-30 16:09:24 +02:00
|
|
|
public static boolean check(){
|
|
|
|
return CheckSchemID != 0;
|
|
|
|
}
|
2020-08-22 19:18:11 +02:00
|
|
|
public static boolean recording(){
|
2020-12-13 15:02:48 +01:00
|
|
|
return event() && SpectateSystem;
|
2020-08-22 19:18:11 +02:00
|
|
|
}
|
2019-11-16 08:37:33 +01:00
|
|
|
}
|