mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
fix stupid init bug
This commit is contained in:
parent
762e7d4e0b
commit
21a3663723
2 changed files with 28 additions and 9 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
package xyz.alexcrea.cuanvil.util
|
package xyz.alexcrea.cuanvil.util
|
||||||
|
|
||||||
import io.delilaheve.util.ConfigOptions
|
|
||||||
import org.bukkit.Material
|
import org.bukkit.Material
|
||||||
import xyz.alexcrea.cuanvil.config.WorkPenaltyType.WorkPenaltyPart
|
import xyz.alexcrea.cuanvil.config.WorkPenaltyType.WorkPenaltyPart
|
||||||
|
|
||||||
|
|
@ -52,20 +51,14 @@ enum class AnvilUseType(
|
||||||
),
|
),
|
||||||
;
|
;
|
||||||
|
|
||||||
companion object {
|
|
||||||
private fun defaultPath(typeName: String): String {
|
|
||||||
return "${ConfigOptions.WORK_PENALTY_ROOT}.$typeName"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
typeName: String,
|
typeName: String,
|
||||||
defaultPenalty: WorkPenaltyPart,
|
defaultPenalty: WorkPenaltyPart,
|
||||||
displayName: String, displayMat: Material
|
displayName: String, displayMat: Material
|
||||||
) :
|
) :
|
||||||
this(
|
this(
|
||||||
typeName, defaultPath(typeName),
|
typeName,
|
||||||
|
AnvilUseTypeUtil.defaultPath(typeName), // stupid util class
|
||||||
defaultPenalty,
|
defaultPenalty,
|
||||||
displayName, displayMat
|
displayName, displayMat
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package xyz.alexcrea.cuanvil.util
|
||||||
|
|
||||||
|
import io.delilaheve.util.ConfigOptions
|
||||||
|
|
||||||
|
object AnvilUseTypeUtil {
|
||||||
|
|
||||||
|
/*
|
||||||
|
By stupidity of kotlin not allowing static function outside of companion object I need to do another util class only for 1 function:
|
||||||
|
Companion object on enum class seems to get initialized AFTER the enum itself
|
||||||
|
that mean. if you want to call a static function on the enum class itself YOU CAN'T. you need to do this stupid thing
|
||||||
|
or you can make a stupid top level function OR object that even worse because of global scope pollution
|
||||||
|
(btw was gpt ""solution"". fortunately I do not "vibe code" so I do what I know instead of stupid AI solution & code)
|
||||||
|
I mean, this is still global scope pollution bc of a USELESS class that SHOULD not exist but as a class is better than a random *ss function
|
||||||
|
|
||||||
|
sorry for the rent but this made me frustrated
|
||||||
|
|
||||||
|
Note: I still like a lot of part of kotlin compared to java but this part is one that I hate
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Get config path for normal anvil use
|
||||||
|
*/
|
||||||
|
fun defaultPath(typeName: String): String {
|
||||||
|
return "${ConfigOptions.WORK_PENALTY_ROOT}.$typeName"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue