Skip to content

Commit

Permalink
Added configurable tree support to clickgui
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Oct 18, 2021
1 parent 854b338 commit 99e1f21
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
*/
package net.ccbluex.liquidbounce.config

import com.google.gson.*
import com.google.gson.GsonBuilder
import com.google.gson.JsonElement
import com.google.gson.JsonParser
import com.google.gson.reflect.TypeToken
import net.ccbluex.liquidbounce.LiquidBounce
import net.ccbluex.liquidbounce.config.adapter.*
Expand Down Expand Up @@ -84,7 +86,7 @@ object ConfigSystem {
*/
fun load() {
for (configurable in configurables) { // Make a new .json file to save our root configurable
File(rootFolder, "${configurable.name}.json").runCatching {
File(rootFolder, "${configurable.name.lowercase()}.json").runCatching {
if (!exists()) {
store()
return@runCatching
Expand Down Expand Up @@ -155,7 +157,7 @@ object ConfigSystem {
*/
fun store() {
for (configurable in configurables) { // Make a new .json file to save our root configurable
File(rootFolder, "${configurable.name}.json").runCatching {
File(rootFolder, "${configurable.name.lowercase()}.json").runCatching {
if (!exists()) {
createNewFile().let { logger.debug("Created new file (status: $it)") }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ object CommandManager : Iterable<Command> {

internal val commands = mutableListOf<Command>()

object Options : Configurable("commands") {
object Options : Configurable("Commands") {
/**
* The prefix of the commands.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import net.ccbluex.liquidbounce.config.Configurable
import net.ccbluex.liquidbounce.config.ListValueType
import java.util.*

object FriendManager : Configurable("friends") {
object FriendManager : Configurable("Friends") {

val friends by value(name, TreeSet<Friend>(), listType = ListValueType.Friend)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import java.util.*
/**
* Proxy Manager
*/
object ProxyManager : Configurable("proxies") {
object ProxyManager : Configurable("Proxies") {

val proxies by value(name, TreeSet<Proxy>(), listType = ListValueType.Proxy)

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/net/ccbluex/liquidbounce/render/Fonts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object Fonts {
}
}

private object Options : Configurable("fonts") {
private object Options : Configurable("Fonts") {

val fonts by value(
"Fonts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import kotlin.math.sqrt
/**
* Configurable to configure the dynamic rotation engine
*/
class RotationsConfigurable : Configurable("rotations") {
class RotationsConfigurable : Configurable("Rotations") {
val turnSpeed by curve("TurnSpeed", arrayOf(4f, 7f, 10f, 3f, 2f, 0.7f))
val fixVelocity by boolean("FixVelocity", true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ val globalEnemyConfigurable = EnemyConfigurable()
/**
* Configurable to configure which entities and their state (like being dead) should be considered as enemy
*/
class EnemyConfigurable : Configurable("enemies") {
class EnemyConfigurable : Configurable("Enemies") {

// Players should be considered as a enemy
val players by boolean("Players", true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import net.minecraft.entity.LivingEntity
/**
* A target tracker to choose the best enemy to attack
*/
class TargetTracker(defaultPriority: PriorityEnum = PriorityEnum.HEALTH) : Configurable("target") {
class TargetTracker(defaultPriority: PriorityEnum = PriorityEnum.HEALTH) : Configurable("Target") {

var lockedOnTarget: Entity? = null
var maxDistanceSquared: Double = 0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fun convertClientSlotToServerSlot(slot: Int): Int {
/**
* Configurable to configure the dynamic rotation engine
*/
class InventoryConstraintsConfigurable : Configurable("inventoryConstraints") {
class InventoryConstraintsConfigurable : Configurable("InventoryConstraints") {
internal var delay by intRange("Delay", 2..4, 0..20)
internal val invOpen by boolean("InvOpen", false)
internal val simulateInventory by boolean("SimulateInventory", true)
Expand Down
2 changes: 1 addition & 1 deletion theme
Submodule theme updated from 86c0b8 to 018266

0 comments on commit 99e1f21

Please sign in to comment.