Skip to content

Commit

Permalink
✨ reset config command
Browse files Browse the repository at this point in the history
  • Loading branch information
b8daniel committed Apr 26, 2022
1 parent 9bc23cf commit 037a6aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class Paintball : JavaPlugin() {

}

fun resetConfig(alsoTheme: Boolean = true) {
gameConfig = GameConfig()

if (!alsoTheme) return

themeConfig = ThemeConfig()
ThemeBuilder.loadConfig(themeConfig)
}

override fun reloadConfig() {
super.reloadConfig()
gameConfig = gameConfig.load()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class PaintballCommand : BrigadierTabExecutor("paintball"){
).then(
literal<CommandSender?>("dev")
.then(
ResetGameConfigCommand()
).then(
ForceStartCommand()
).then(
SwitchTeamCommand()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package de.crightgames.blxckoxymoron.paintball.commands

import com.mojang.brigadier.Command
import com.mojang.brigadier.builder.ArgumentBuilder
import com.mojang.brigadier.builder.LiteralArgumentBuilder.literal
import com.mojang.brigadier.tree.CommandNode
import de.crightgames.blxckoxymoron.paintball.Paintball
import org.bukkit.command.CommandSender

class ResetGameConfigCommand : ArgumentBuilder<CommandSender, ResetGameConfigCommand>() {
override fun getThis(): ResetGameConfigCommand {
return this
}

override fun build(): CommandNode<CommandSender> {
return literal<CommandSender>("resetgameconfig").executes {
Paintball.INSTANCE.resetConfig(false)

return@executes Command.SINGLE_SUCCESS
}.build()

}
}

0 comments on commit 037a6aa

Please sign in to comment.