SteamWar/FightSystem
Archiviert
13
1

Refactoring config to enable defaulting

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-11-05 11:07:16 +01:00
Ursprung cf666a4cb3
Commit e79bce8d6d
3 geänderte Dateien mit 119 neuen und 116 gelöschten Zeilen

Datei anzeigen

@ -1,64 +1,63 @@
Times:
# Time in seconds the server stops after starting if nobody joins
NoPlayersOnlineDuration: 30
NoPlayersOnlineDuration: 30 # defaults to 30 if missing
# Time in seconds the team leaders have to choose their schematic
PreSchemPasteDuration: 120
PreSchemPasteDuration: 120 # defaults to 120 if missing
# Time in seconds for preparing
SetupDuration: 300
SetupDuration: 300 # defaults to 300 if missing
# Time in seconds the final countdown is long
PreFightDuration: 30
PreFightDuration: 30 # defaults to 30 if missing
# Time in seconds to spectate the arena after the fight
SpectatorDuration: 30
SpectatorDuration: 30 # defaults to 30 if missing
Arena:
# The amount of blocks the schematics should be pasted under the surface
WaterDepth: 0
WaterDepth: 0 # defaults to 0 if missing
# The outer border of the arena, measured in blocks around the schematic areas
Schem2Border:
x: 24 # defaults to 24 if missing
z: 24 # defaults to 24 if missing
# The size of the team areas are expanded around the schematics
BorderFromSchematic: 12 # defaults to 12 if missing
# If ground walkable, teams can walk below the lower arena border during setup
GroundWalkable: true # defaults to true if missing
Schematic:
# The size of the schematics
Schemsize:
Size:
x: 0
y: 0
z: 0
# The outer border of the arena, measured in blocks around the schematic areas
Schem2Border:
x: 0
z: 0
# The size of the team areas are expanded around the schematics
BorderFromSchematic: 0
# If ground walkable, teams can walk below the lower arena border during setup
GroundWalkable: true
Schematic:
# If the rank system for the schematics should be enabled
RanksEnabled: false
RanksEnabled: false # defaults to false if missing
# The schematic type that can be chosen in this arena
SchematicType: normal
SchematicType: normal # defaults to normal if missing
# If the schematics should be rotated during pasting
Rotate: true
Rotate: true # defaults to true if missing
# If the schematics should be pasted aligned to the borders instead of centered
PasteAligned: false # defaults to false if missing
# If only public schematics are allowed
OnlyPublicSchematics: false
# If the public only force should be completly disabled
IgnorePublicOnly: false
OnlyPublicSchematics: false # defaults to false if missing
# If the public only force should be completely disabled
IgnorePublicOnly: false # defaults to false if missing
# If obsidian and bedrock should be replaced during PRE_RUNNING
ReplaceObsidianBedrock: false
ReplaceObsidianBedrock: false # defaults to false if missing
# If the replacement should happen with block updates
ReplaceWithBlockupdates: false
ReplaceWithBlockupdates: false # defaults to false if missing
Output:
# Name of the "Red" team
TeamRedName: Rot
# Color prefix of the "Red" team
TeamRedPrefix: '§c'
# Name of the "Blue" team
TeamBlueName: Blau
# Color of the "Blue" team
TeamBluePrefix: '§3'
# The name of the game mode presented to the players
GameName: NoGear
GameName: WarGear # defaults to WarGear if missing
# The prefix used for team chats
TeamChatDetection: +
TeamChatPrefix: + # defaults to + if missing
Blue:
Name: Blue # defaults to Blue if missing
Prefix: '§3' # defaults to '§3' if missing
Red:
Name: Red # defaults to Red if missing
Prefix: '§c' # defaults to '§c' if missing
# The list of active win conditions
WinConditions:
WinConditions: # defaults to none if missing
- TIMEOUT
# - HEART_RATIO_TIMEOUT
# - PERCENT_TIMEOUT
@ -67,20 +66,23 @@ WinConditions:
# - CAPTAIN_DEAD
# - PERCENT_SYSTEM
# - WHITELIST_PERCENT
# - RELATIVE_PERCENT
# - POINTS
- WATER_TECH_KO
# - WATER_TECH_KO
# - TIME_TECH_KO
# - PUMPKIN_TECH_KO
# - HELLS_BELLS
WinConditionParams:
# The time of any of the timeout win conditions in seconds
TimeoutTime: 1200
TimeoutTime: 1200 # defaults to 1200 if missing
# The percentage when any of the percent win conditions limits or triggers a win
PercentWin: 5.0
# Blocks ignored by the percent winconditions
IgnoredBlocks:
PercentWin: 7.0 # defaults to 7.0 if missing
# Special Blocks (Valid spigot material values) used by the percent win conditions
Blocks: # defaults to none if missing
- AIR
- WATER
- TNT
@ -88,26 +90,27 @@ WinConditionParams:
Kits:
# The kit file for this configuration
File: kits.yml
File: kits.yml # defaults to kits.yml if missing
# The default kit for team members
MemberDefault: default
MemberDefault: default # defaults to default if missing
# The default kit for team leaders
LeaderDefault: default
LeaderDefault: default # defaults to default if missing
# If the personal kit system is active
PersonalKits: false
# Items that are not allowed in the personal kit
ForbiddenItems: []
PersonalKits: false # defaults to false if missing
# Items (Valid spigot material values) that are not allowed in the personal kit
ForbiddenItems: [] # defaults to none if missing
# A list of integers containing the waiting time of this enter stage in the fight
EnterStages: []
EnterStages: [] # defaults to no enter stages (empty list) if missing
Techhider:
# if the techhider is active
Active: true
# The tech hider blocks/materials have to be valid lowercase minecraft material names
# Activates the tech hider
Active: false # defaults to false if missing
# Which block the tech hider replaces to.
ObfuscateWith: end_stone
ObfuscateWith: end_stone # defaults to end_stone if missing
# A list of all hidden blocks. "water" results in the hiding of all waterlogged blocks as well.
HiddenBlocks:
HiddenBlocks: # defaults to none if missing
- water
- note_block
- powered_rail
@ -144,8 +147,8 @@ Techhider:
- observer
- honey_block
- lever
# The block entities that are hidden (contents of blocks)
HiddenBlockEntites:
# The block entity contents that are hidden (here with minecraft:-nametag)
HiddenBlockEntites: # defaults to none if missing
- minecraft:sign
- minecraft:dispenser
- minecraft:chest
@ -158,10 +161,10 @@ Techhider:
- minecraft:jukebox
- minecraft:comparator
# The following configuration must be in the Worldforlder/config.yml
# The following configuration must be in the world folder/config.yml
#
# # The lower arena border under which players get damage
# UnderBorder:
# UnderBorder: 0 # defaults to BlueCorner.y if missing
# # The lowest corner in all axis of the blue team schematic area
# BlueCorner:
# x: 0
@ -169,11 +172,11 @@ Techhider:
# z: 0
# # The offset between the lowest corner of the blue area and the lowest corner of the red area
# BlueToRed:
# x: 0
# y: 0
# z: 0
# x: 0 # defaults to 0 if missing
# y: 0 # defaults to 0 if missing
# z: 0 # defaults to Schematic.Size.z + 50 if missing
# # The offset the teams spawn relative to the center of their area
# SpawnOffset:
# x: 0
# y: 0
# z: 0
# x: 0 # defaults to 0 if missing
# y: 0 # defaults to Schematic.Size.y if missing
# z: 0 # defaults to 0 if missing

Datei anzeigen

@ -104,7 +104,7 @@ public class Config {
public static final String MemberDefault;
public static final String LeaderDefault;
public static final boolean PersonalKits;
public static final List<String> ForbiddenItems;
public static final Set<Material> ForbiddenItems;
public static final String KitFile;
//tech hider parameter
@ -148,61 +148,55 @@ public class Config {
}
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration");
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration");
SetupDuration = config.getInt("Times.SetupDuration");
PreFightDuration = config.getInt("Times.PreFightDuration");
SpectatorDuration = config.getInt("Times.SpectatorDuration");
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 30);
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
SetupDuration = config.getInt("Times.SetupDuration", 300);
PreFightDuration = config.getInt("Times.PreFightDuration", 30);
SpectatorDuration = config.getInt("Times.SpectatorDuration", 30);
int underBorder = worldconfig.getInt("UnderBorder");
int blueCornerX = worldconfig.getInt("BlueCorner.x");
int blueCornerY = worldconfig.getInt("BlueCorner.y");
int blueCornerZ = worldconfig.getInt("BlueCorner.z");
BlueToRedX = worldconfig.getInt("BlueToRed.x");
BlueToRedY = worldconfig.getInt("BlueToRed.y");
BlueToRedZ = worldconfig.getInt("BlueToRed.z");
double teamBlueSpawnOffsetX = worldconfig.getDouble("SpawnOffset.x");
double teamBlueSpawnOffsetY = worldconfig.getDouble("SpawnOffset.y");
double teamBlueSpawnOffsetZ = worldconfig.getDouble("SpawnOffset.z");
int underBorder = worldconfig.getInt("UnderBorder", blueCornerY);
WaterDepth = config.getInt("Arena.WaterDepth");
int schemsizeX = config.getInt("Arena.Schemsize.x");
int schemsizeY = config.getInt("Arena.Schemsize.y");
int schemsizeZ = config.getInt("Arena.Schemsize.z");
int schem2BorderX = config.getInt("Arena.Schem2Border.x");
int schem2BorderZ = config.getInt("Arena.Schem2Border.z");
PreperationArea = config.getInt("Arena.BorderFromSchematic");
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
WaterDepth = config.getInt("Arena.WaterDepth", 0);
int schem2BorderX = config.getInt("Arena.Schem2Border.x", 24);
int schem2BorderZ = config.getInt("Arena.Schem2Border.z", 24);
PreperationArea = config.getInt("Arena.BorderFromSchematic", 12);
GroundWalkable = config.getBoolean("Arena.GroundWalkable", true);
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.SchematicType")));
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
boolean rotate = config.getBoolean("Schematic.Rotate");
PasteAligned = config.getBoolean("Schematic.PasteAligned");
ReplaceObsidianBedrock = config.getBoolean("Schematic.ReplaceObsidianBedrock");
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates");
int schemsizeX = config.getInt("Schematic.Size.x");
int schemsizeY = config.getInt("Schematic.Size.y");
int schemsizeZ = config.getInt("Schematic.Size.z");
RanksEnabled = config.getBoolean("Schematic.RanksEnabled", false);
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.SchematicType", "normal")));
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly", false);
boolean rotate = config.getBoolean("Schematic.Rotate", true);
PasteAligned = config.getBoolean("Schematic.PasteAligned", false);
ReplaceObsidianBedrock = config.getBoolean("Schematic.ReplaceObsidianBedrock", false);
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates", false);
GameName = config.getString("Output.GameName");
TeamChatDetection = config.getString("Output.TeamChatDetection");
GameName = config.getString("GameName", "WarGear");
TeamChatDetection = config.getString("TeamChatPrefix", "+");
ActiveWinconditions = Collections.unmodifiableSet(config.getStringList("WinConditions").stream().map(Winconditions::valueOf).collect(Collectors.toSet()));
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime");
PercentWin = config.getDouble("WinConditionParams.PercentWin");
PercentBlocks = config.getStringList("WinConditionParams.IgnoredBlocks").stream().map(Material::valueOf).collect(Collectors.toSet());
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime", 1200);
PercentWin = config.getDouble("WinConditionParams.PercentWin", 7.0);
PercentBlocks = Collections.unmodifiableSet(config.getStringList("WinConditionParams.Blocks").stream().map(Material::valueOf).collect(Collectors.toSet()));
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
KitFile = config.getString("Kits.File");
MemberDefault = config.getString("Kits.MemberDefault");
LeaderDefault = config.getString("Kits.LeaderDefault");
PersonalKits = config.getBoolean("Kits.PersonalKits");
ForbiddenItems = Collections.unmodifiableList(config.getStringList("Kits.ForbiddenItems"));
KitFile = config.getString("Kits.File", "kits.yml");
MemberDefault = config.getString("Kits.MemberDefault", "default");
LeaderDefault = config.getString("Kits.LeaderDefault", "default");
PersonalKits = config.getBoolean("Kits.PersonalKits", false);
ForbiddenItems = Collections.unmodifiableSet(config.getStringList("Kits.ForbiddenItems").stream().map(Material::valueOf).collect(Collectors.toSet()));
TechhiderActive = config.getBoolean("Techhider.Active", false);
ObfuscateWith = config.getString("Techhider.ObfuscateWith", "end_stone");
HiddenBlocks = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlocks")));
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
ObfuscateWith = config.getString("Techhider.ObfuscateWith");
TechhiderActive = config.getBoolean("Techhider.Active");
if(schemsizeX < 0){
schemsizeX = -schemsizeX;
@ -217,6 +211,12 @@ public class Config {
blueCornerZ = blueCornerZ - schemsizeZ;
}
BlueToRedX = worldconfig.getInt("BlueToRed.x", 0);
BlueToRedY = worldconfig.getInt("BlueToRed.y", 0);
BlueToRedZ = worldconfig.getInt("BlueToRed.z", schemsizeZ + 50);
double teamBlueSpawnOffsetX = worldconfig.getDouble("SpawnOffset.x", 0);
double teamBlueSpawnOffsetY = worldconfig.getDouble("SpawnOffset.y", schemsizeY);
double teamBlueSpawnOffsetZ = worldconfig.getDouble("SpawnOffset.z", 0);
int teamRedCornerX = BlueToRedX + blueCornerX;
int teamRedCornerY = BlueToRedY + blueCornerY;
@ -341,11 +341,11 @@ public class Config {
LiveReplay = event.spectateSystem();
}else{
//No event
TeamRedColor = config.getString("Output.TeamRedPrefix");
TeamBlueColor = config.getString("Output.TeamBluePrefix");
TeamRedName = config.getString("Output.TeamRedName");
TeamBlueName = config.getString("Output.TeamBlueName");
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics");
TeamRedColor = config.getString("Red.Prefix", "§c");
TeamBlueColor = config.getString("Blue.Prefix", "§3");
TeamRedName = config.getString("Red.Name", "Red");
TeamBlueName = config.getString("Blue.Name", "Blue");
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics", false);
EventTeamBlueID = 0;
EventTeamRedID = 0;
BothTeamsPublic = true;

Datei anzeigen

@ -183,7 +183,7 @@ public class Kit {
return false;
//Check for forbidden item
if(Config.ForbiddenItems.contains(stack.getType().name()))
if(Config.ForbiddenItems.contains(stack.getType()))
return true;
//Check for attribute modifiers