Skip to content

Commit

Permalink
📝 add config documentation to README
Browse files Browse the repository at this point in the history
  • Loading branch information
b8daniel committed Apr 11, 2022
1 parent 1eca44a commit 941b968
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 2 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@


# C O N F I G • D E S C R I P T I O N S

- `game`:
- `durations`:
- `game`: how long does the game last
- `gameLoop`: refresh interval of the info actionbar
- `refill`: how fast the snowballs will refill
- `respawn`: time from death until respawn
- `shot`: how fast a player can shoot
- `kill`: cooldown until a player can kill again after a kill
- `timer`: how long the timer should count down until start
- `restart`: time to wait after a game until automatic restart
- `noReplace`: blocks that shouldn't be replaced
- `autostart`: should the game start automatically when enough players joined
- `minimumPlayers`: minimum players to start automatically
- `teams`: list of teams
- `material`: material used to replace blocks (`RED`|`BLUE`), only one team per material
- `displayName`: name used for the team
- `spawn`: set ingame with `/paintball teamspawn •••`
- `x`: x-pos
- `y`: y-pos
- `z`: z-pos
- `yaw`: yaw (rotation left-right)
- `pitch`: pitch (rotation up-down)
- `colorRadius`: radius of the color
- `arenaWorldName`: name of the base world to copy for an arena
- `theme`:
- `default`: default text color
- `highlight`: highlight text color
- `secondary`: secondary text color
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ class Paintball : JavaPlugin() {
INSTANCE = this

// config
saveDefaultConfig()
GameConfig.registerConfigClasses()
ThemeConfig.registerConfigClasses()
gameConfig = config.get("game") as? GameConfig ?: GameConfig()
themeConfig = config.get("theme") as? ThemeConfig ?: ThemeConfig(mutableMapOf())
themeConfig = config.get("theme") as? ThemeConfig ?: ThemeConfig()
ThemeBuilder.loadConfig(themeConfig)

// commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ package de.crightgames.blxckoxymoron.paintball.game.config

import org.bukkit.ChatColor
import org.bukkit.configuration.serialization.ConfigurationSerializable
import org.bukkit.configuration.serialization.ConfigurationSerialization

class ThemeConfig(cfg: Map<String, Any> = mutableMapOf()) : ConfigurationSerializable {

companion object {
fun registerConfigClasses() {
ConfigurationSerialization.registerClass(ThemeConfig::class.java)
}
}

class ThemeConfig(cfg: Map<String, Any>) : ConfigurationSerializable {
val default: ChatColor
val highlight: ChatColor
val secondary: ChatColor
Expand Down
63 changes: 63 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# C O N F I G (see README → https://github.com/crightgames/Paintball)
# config should only be edited when the server is stopped, since
# otherwise changes will be overwritten

game:
==: de.crightgames.blxckoxymoron.paintball.game.config.GameConfig
durations:
game:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 2
unit: MINUTES
gameLoop:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 500
unit: MILLISECONDS
refill:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 750
unit: MILLISECONDS
respawn:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 10
unit: SECONDS
shot:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 100
unit: MILLISECONDS
kill:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 15
unit: SECONDS
timer:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 10
unit: SECONDS
restart:
==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigDuration
duration: 30
unit: SECONDS
noReplace:
- REDSTONE_LAMP
- GLOWSTONE
- BARREL
- BEACON
- BEDROCK
autostart: true
minimumPlayers: 4
teams:
- ==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigTeam
material: BLUE
displayName: §3Blau§r
spawn: null
- ==: de.crightgames.blxckoxymoron.paintball.game.config.ConfigTeam
material: RED
displayName: §4Rot§r
spawn: null
colorRadius: 3
arenaWorldName: arena
theme:
==: de.crightgames.blxckoxymoron.paintball.game.config.ThemeConfig
default: RESET
highlight: AQUA
secondary: GRAY

0 comments on commit 941b968

Please sign in to comment.