Refactoring config to enable defaulting
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
cf666a4cb3
Commit
e79bce8d6d
@ -1,64 +1,63 @@
|
|||||||
Times:
|
Times:
|
||||||
# Time in seconds the server stops after starting if nobody joins
|
# 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
|
# 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
|
# Time in seconds for preparing
|
||||||
SetupDuration: 300
|
SetupDuration: 300 # defaults to 300 if missing
|
||||||
# Time in seconds the final countdown is long
|
# 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
|
# Time in seconds to spectate the arena after the fight
|
||||||
SpectatorDuration: 30
|
SpectatorDuration: 30 # defaults to 30 if missing
|
||||||
|
|
||||||
Arena:
|
Arena:
|
||||||
# The amount of blocks the schematics should be pasted under the surface
|
# 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
|
# The size of the schematics
|
||||||
Schemsize:
|
Size:
|
||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
z: 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
|
# 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
|
# 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
|
# 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
|
# If only public schematics are allowed
|
||||||
OnlyPublicSchematics: false
|
OnlyPublicSchematics: false # defaults to false if missing
|
||||||
# If the public only force should be completly disabled
|
# If the public only force should be completely disabled
|
||||||
IgnorePublicOnly: false
|
IgnorePublicOnly: false # defaults to false if missing
|
||||||
# If obsidian and bedrock should be replaced during PRE_RUNNING
|
# 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 blockupdates
|
# If the replacement should happen with block updates
|
||||||
ReplaceWithBlockupdates: false
|
ReplaceWithBlockupdates: false # defaults to false if missing
|
||||||
|
|
||||||
Output:
|
# The name of the game mode presented to the players
|
||||||
# Name of the "Red" team
|
GameName: WarGear # defaults to WarGear if missing
|
||||||
TeamRedName: Rot
|
# The prefix used for team chats
|
||||||
# Color prefix of the "Red" team
|
TeamChatPrefix: + # defaults to + if missing
|
||||||
TeamRedPrefix: '§c'
|
Blue:
|
||||||
# Name of the "Blue" team
|
Name: Blue # defaults to Blue if missing
|
||||||
TeamBlueName: Blau
|
Prefix: '§3' # defaults to '§3' if missing
|
||||||
# Color of the "Blue" team
|
Red:
|
||||||
TeamBluePrefix: '§3'
|
Name: Red # defaults to Red if missing
|
||||||
# The name of the gamemode presented to the players
|
Prefix: '§c' # defaults to '§c' if missing
|
||||||
GameName: NoGear
|
|
||||||
# The prefix used for team chats
|
|
||||||
TeamChatDetection: +
|
|
||||||
|
|
||||||
# The list of active winconditions
|
# The list of active win conditions
|
||||||
WinConditions:
|
WinConditions: # defaults to none if missing
|
||||||
- TIMEOUT
|
- TIMEOUT
|
||||||
# - HEART_RATIO_TIMEOUT
|
# - HEART_RATIO_TIMEOUT
|
||||||
# - PERCENT_TIMEOUT
|
# - PERCENT_TIMEOUT
|
||||||
@ -67,20 +66,23 @@ WinConditions:
|
|||||||
# - CAPTAIN_DEAD
|
# - CAPTAIN_DEAD
|
||||||
|
|
||||||
# - PERCENT_SYSTEM
|
# - PERCENT_SYSTEM
|
||||||
|
# - WHITELIST_PERCENT
|
||||||
# - RELATIVE_PERCENT
|
# - RELATIVE_PERCENT
|
||||||
# - POINTS
|
# - POINTS
|
||||||
|
|
||||||
- WATER_TECH_KO
|
# - WATER_TECH_KO
|
||||||
# - TIME_TECH_KO
|
# - TIME_TECH_KO
|
||||||
# - PUMPKIN_TECH_KO
|
# - PUMPKIN_TECH_KO
|
||||||
|
|
||||||
|
# - HELLS_BELLS
|
||||||
|
|
||||||
WinConditionParams:
|
WinConditionParams:
|
||||||
# The time of any of the timeout winconditions in seconds
|
# 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 winconditions limits or triggers a win
|
# The percentage when any of the percent win conditions limits or triggers a win
|
||||||
PercentWin: 5.0
|
PercentWin: 7.0 # defaults to 7.0 if missing
|
||||||
# Blocks ignored by the percent winconditions
|
# Special Blocks (Valid spigot material values) used by the percent win conditions
|
||||||
IgnoredBlocks:
|
Blocks: # defaults to none if missing
|
||||||
- AIR
|
- AIR
|
||||||
- WATER
|
- WATER
|
||||||
- TNT
|
- TNT
|
||||||
@ -88,26 +90,27 @@ WinConditionParams:
|
|||||||
|
|
||||||
Kits:
|
Kits:
|
||||||
# The kit file for this configuration
|
# The kit file for this configuration
|
||||||
File: kits.yml
|
File: kits.yml # defaults to kits.yml if missing
|
||||||
# The default kit for team members
|
# The default kit for team members
|
||||||
MemberDefault: default
|
MemberDefault: default # defaults to default if missing
|
||||||
# The default kit for team leaders
|
# The default kit for team leaders
|
||||||
LeaderDefault: default
|
LeaderDefault: default # defaults to default if missing
|
||||||
# If the personal kit system is active
|
# If the personal kit system is active
|
||||||
PersonalKits: false
|
PersonalKits: false # defaults to false if missing
|
||||||
# Items that are not allowed in the personal kit
|
# Items (Valid spigot material values) that are not allowed in the personal kit
|
||||||
ForbiddenItems: []
|
ForbiddenItems: [] # defaults to none if missing
|
||||||
|
|
||||||
# A list of integers containing the waiting time of this enter stage in the fight
|
# 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:
|
Techhider:
|
||||||
# if the techhider is active
|
# The tech hider blocks/materials have to be valid lowercase minecraft material names
|
||||||
Active: true
|
# Activates the tech hider
|
||||||
# Which block the techhider replaces to.
|
Active: false # defaults to false if missing
|
||||||
ObfuscateWith: end_stone
|
# Which block the tech hider replaces to.
|
||||||
|
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.
|
# 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
|
- water
|
||||||
- note_block
|
- note_block
|
||||||
- powered_rail
|
- powered_rail
|
||||||
@ -144,8 +147,8 @@ Techhider:
|
|||||||
- observer
|
- observer
|
||||||
- honey_block
|
- honey_block
|
||||||
- lever
|
- lever
|
||||||
# The block entities that are hidden (contents of blocks)
|
# The block entity contents that are hidden (here with minecraft:-nametag)
|
||||||
HiddenBlockEntites:
|
HiddenBlockEntites: # defaults to none if missing
|
||||||
- minecraft:sign
|
- minecraft:sign
|
||||||
- minecraft:dispenser
|
- minecraft:dispenser
|
||||||
- minecraft:chest
|
- minecraft:chest
|
||||||
@ -158,10 +161,10 @@ Techhider:
|
|||||||
- minecraft:jukebox
|
- minecraft:jukebox
|
||||||
- minecraft:comparator
|
- 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
|
# # 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
|
# # The lowest corner in all axis of the blue team schematic area
|
||||||
# BlueCorner:
|
# BlueCorner:
|
||||||
# x: 0
|
# x: 0
|
||||||
@ -169,11 +172,11 @@ Techhider:
|
|||||||
# z: 0
|
# z: 0
|
||||||
# # The offset between the lowest corner of the blue area and the lowest corner of the red area
|
# # The offset between the lowest corner of the blue area and the lowest corner of the red area
|
||||||
# BlueToRed:
|
# BlueToRed:
|
||||||
# x: 0
|
# x: 0 # defaults to 0 if missing
|
||||||
# y: 0
|
# y: 0 # defaults to 0 if missing
|
||||||
# z: 0
|
# z: 0 # defaults to Schematic.Size.z + 50 if missing
|
||||||
# # The offset the teams spawn relative to the center of their area
|
# # The offset the teams spawn relative to the center of their area
|
||||||
# SpawnOffset:
|
# SpawnOffset:
|
||||||
# x: 0
|
# x: 0 # defaults to 0 if missing
|
||||||
# y: 0
|
# y: 0 # defaults to Schematic.Size.y if missing
|
||||||
# z: 0
|
# z: 0 # defaults to 0 if missing
|
@ -104,7 +104,7 @@ public class Config {
|
|||||||
public static final String MemberDefault;
|
public static final String MemberDefault;
|
||||||
public static final String LeaderDefault;
|
public static final String LeaderDefault;
|
||||||
public static final boolean PersonalKits;
|
public static final boolean PersonalKits;
|
||||||
public static final List<String> ForbiddenItems;
|
public static final Set<Material> ForbiddenItems;
|
||||||
public static final String KitFile;
|
public static final String KitFile;
|
||||||
|
|
||||||
//tech hider parameter
|
//tech hider parameter
|
||||||
@ -148,61 +148,55 @@ public class Config {
|
|||||||
}
|
}
|
||||||
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
||||||
|
|
||||||
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration");
|
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 30);
|
||||||
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration");
|
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
|
||||||
SetupDuration = config.getInt("Times.SetupDuration");
|
SetupDuration = config.getInt("Times.SetupDuration", 300);
|
||||||
PreFightDuration = config.getInt("Times.PreFightDuration");
|
PreFightDuration = config.getInt("Times.PreFightDuration", 30);
|
||||||
SpectatorDuration = config.getInt("Times.SpectatorDuration");
|
SpectatorDuration = config.getInt("Times.SpectatorDuration", 30);
|
||||||
|
|
||||||
int underBorder = worldconfig.getInt("UnderBorder");
|
|
||||||
int blueCornerX = worldconfig.getInt("BlueCorner.x");
|
int blueCornerX = worldconfig.getInt("BlueCorner.x");
|
||||||
int blueCornerY = worldconfig.getInt("BlueCorner.y");
|
int blueCornerY = worldconfig.getInt("BlueCorner.y");
|
||||||
int blueCornerZ = worldconfig.getInt("BlueCorner.z");
|
int blueCornerZ = worldconfig.getInt("BlueCorner.z");
|
||||||
BlueToRedX = worldconfig.getInt("BlueToRed.x");
|
int underBorder = worldconfig.getInt("UnderBorder", blueCornerY);
|
||||||
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");
|
|
||||||
|
|
||||||
WaterDepth = config.getInt("Arena.WaterDepth");
|
WaterDepth = config.getInt("Arena.WaterDepth", 0);
|
||||||
int schemsizeX = config.getInt("Arena.Schemsize.x");
|
int schem2BorderX = config.getInt("Arena.Schem2Border.x", 24);
|
||||||
int schemsizeY = config.getInt("Arena.Schemsize.y");
|
int schem2BorderZ = config.getInt("Arena.Schem2Border.z", 24);
|
||||||
int schemsizeZ = config.getInt("Arena.Schemsize.z");
|
PreperationArea = config.getInt("Arena.BorderFromSchematic", 12);
|
||||||
int schem2BorderX = config.getInt("Arena.Schem2Border.x");
|
GroundWalkable = config.getBoolean("Arena.GroundWalkable", true);
|
||||||
int schem2BorderZ = config.getInt("Arena.Schem2Border.z");
|
|
||||||
PreperationArea = config.getInt("Arena.BorderFromSchematic");
|
|
||||||
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
|
|
||||||
|
|
||||||
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
|
int schemsizeX = config.getInt("Schematic.Size.x");
|
||||||
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.SchematicType")));
|
int schemsizeY = config.getInt("Schematic.Size.y");
|
||||||
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
|
int schemsizeZ = config.getInt("Schematic.Size.z");
|
||||||
boolean rotate = config.getBoolean("Schematic.Rotate");
|
RanksEnabled = config.getBoolean("Schematic.RanksEnabled", false);
|
||||||
PasteAligned = config.getBoolean("Schematic.PasteAligned");
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.SchematicType", "normal")));
|
||||||
ReplaceObsidianBedrock = config.getBoolean("Schematic.ReplaceObsidianBedrock");
|
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly", false);
|
||||||
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates");
|
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");
|
GameName = config.getString("GameName", "WarGear");
|
||||||
TeamChatDetection = config.getString("Output.TeamChatDetection");
|
TeamChatDetection = config.getString("TeamChatPrefix", "+");
|
||||||
|
|
||||||
ActiveWinconditions = Collections.unmodifiableSet(config.getStringList("WinConditions").stream().map(Winconditions::valueOf).collect(Collectors.toSet()));
|
ActiveWinconditions = Collections.unmodifiableSet(config.getStringList("WinConditions").stream().map(Winconditions::valueOf).collect(Collectors.toSet()));
|
||||||
|
|
||||||
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime");
|
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime", 1200);
|
||||||
PercentWin = config.getDouble("WinConditionParams.PercentWin");
|
PercentWin = config.getDouble("WinConditionParams.PercentWin", 7.0);
|
||||||
PercentBlocks = config.getStringList("WinConditionParams.IgnoredBlocks").stream().map(Material::valueOf).collect(Collectors.toSet());
|
PercentBlocks = Collections.unmodifiableSet(config.getStringList("WinConditionParams.Blocks").stream().map(Material::valueOf).collect(Collectors.toSet()));
|
||||||
|
|
||||||
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
|
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
|
||||||
|
|
||||||
KitFile = config.getString("Kits.File");
|
KitFile = config.getString("Kits.File", "kits.yml");
|
||||||
MemberDefault = config.getString("Kits.MemberDefault");
|
MemberDefault = config.getString("Kits.MemberDefault", "default");
|
||||||
LeaderDefault = config.getString("Kits.LeaderDefault");
|
LeaderDefault = config.getString("Kits.LeaderDefault", "default");
|
||||||
PersonalKits = config.getBoolean("Kits.PersonalKits");
|
PersonalKits = config.getBoolean("Kits.PersonalKits", false);
|
||||||
ForbiddenItems = Collections.unmodifiableList(config.getStringList("Kits.ForbiddenItems"));
|
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")));
|
HiddenBlocks = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlocks")));
|
||||||
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
||||||
ObfuscateWith = config.getString("Techhider.ObfuscateWith");
|
|
||||||
TechhiderActive = config.getBoolean("Techhider.Active");
|
|
||||||
|
|
||||||
if(schemsizeX < 0){
|
if(schemsizeX < 0){
|
||||||
schemsizeX = -schemsizeX;
|
schemsizeX = -schemsizeX;
|
||||||
@ -217,6 +211,12 @@ public class Config {
|
|||||||
blueCornerZ = blueCornerZ - schemsizeZ;
|
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 teamRedCornerX = BlueToRedX + blueCornerX;
|
||||||
int teamRedCornerY = BlueToRedY + blueCornerY;
|
int teamRedCornerY = BlueToRedY + blueCornerY;
|
||||||
@ -341,11 +341,11 @@ public class Config {
|
|||||||
LiveReplay = event.spectateSystem();
|
LiveReplay = event.spectateSystem();
|
||||||
}else{
|
}else{
|
||||||
//No event
|
//No event
|
||||||
TeamRedColor = config.getString("Output.TeamRedPrefix");
|
TeamRedColor = config.getString("Red.Prefix", "§c");
|
||||||
TeamBlueColor = config.getString("Output.TeamBluePrefix");
|
TeamBlueColor = config.getString("Blue.Prefix", "§3");
|
||||||
TeamRedName = config.getString("Output.TeamRedName");
|
TeamRedName = config.getString("Red.Name", "Red");
|
||||||
TeamBlueName = config.getString("Output.TeamBlueName");
|
TeamBlueName = config.getString("Blue.Name", "Blue");
|
||||||
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics");
|
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics", false);
|
||||||
EventTeamBlueID = 0;
|
EventTeamBlueID = 0;
|
||||||
EventTeamRedID = 0;
|
EventTeamRedID = 0;
|
||||||
BothTeamsPublic = true;
|
BothTeamsPublic = true;
|
||||||
|
@ -183,7 +183,7 @@ public class Kit {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Check for forbidden item
|
//Check for forbidden item
|
||||||
if(Config.ForbiddenItems.contains(stack.getType().name()))
|
if(Config.ForbiddenItems.contains(stack.getType()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Check for attribute modifiers
|
//Check for attribute modifiers
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren