diff options
Diffstat (limited to 'src')
5 files changed, 9 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 6249ac295..116cecd19 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -46,7 +46,6 @@ import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.TimeUtils.formatted -import java.util.function.Supplier import kotlin.time.Duration.Companion.seconds internal var confirmedUnknownLines = listOf<String>() @@ -75,7 +74,7 @@ private fun onRemoval(line: String) { internal var amountOfUnknownLines = 0 enum class ScoreboardElement( - private val displayPair: Supplier<List<ScoreboardElementType>>, + private val displayPair: () -> List<ScoreboardElementType>, val showWhen: () -> Boolean, private val configLine: String, ) { @@ -285,7 +284,7 @@ enum class ScoreboardElement( private fun getPair(): List<ScoreboardElementType> { return try { - displayPair.get() + displayPair() } catch (e: NoSuchElementException) { listOf("<hidden>" to HorizontalAlignment.LEFT) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt index d8fdf532b..ebeed5eee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.eventsConfig -import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.NEW_YEAR import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.VOTING import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern import at.hannibal2.skyhanni.features.misc.ServerRestartTitle @@ -19,7 +18,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.removeResets import at.hannibal2.skyhanni.utils.TabListData -import java.util.function.Supplier import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern /** @@ -35,7 +33,7 @@ private fun getSbLines(): List<String> { } enum class ScoreboardEvents( - private val displayLine: Supplier<List<String>>, + private val displayLine: () -> List<String>, private val showWhen: () -> Boolean, private val configLine: String, ) { @@ -193,7 +191,7 @@ enum class ScoreboardEvents( override fun toString() = configLine - fun getLines(): List<String> = displayLine.get() + fun getLines(): List<String> = displayLine() companion object { fun getEvent() = buildList<ScoreboardEvents?> { diff --git a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt index 447a6f5aa..94894507c 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupport.kt @@ -1,16 +1,12 @@ package at.hannibal2.skyhanni.test.hotswap -import java.util.function.Supplier - object HotswapSupport { private val isForgeSidePresent = runCatching { Class.forName("moe.nea.hotswapagentforge.forge.HotswapEvent") }.isSuccess private val obj = if (isForgeSidePresent) { - Supplier<HotswapSupportHandle?> { HotswapSupportImpl() } - } else { - Supplier<HotswapSupportHandle?> { null } - }.get() + HotswapSupportImpl() + } else null fun isLoaded(): Boolean { return obj?.isLoaded() ?: false diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/Shader.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/Shader.kt index 8bbe5bba3..c110d6d6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/shader/Shader.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/Shader.kt @@ -9,7 +9,6 @@ import net.minecraft.client.shader.ShaderLinkHelper import org.apache.commons.lang3.StringUtils import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.OpenGLException -import java.util.function.Supplier /** * Superclass for shader objects to compile and attach vertex and fragment shaders to the shader program @@ -106,7 +105,7 @@ abstract class Shader(val vertex: String, val fragment: String) { * to the uniform in the shader file. * @param uniformValuesSupplier The supplier that changes / sets the uniform's value */ - fun <T> registerUniform(uniformType: Uniform.UniformType<T>, name: String, uniformValuesSupplier: Supplier<T>) { + fun <T> registerUniform(uniformType: Uniform.UniformType<T>, name: String, uniformValuesSupplier: () -> T) { uniforms.add(Uniform(this, uniformType, name, uniformValuesSupplier)) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt b/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt index e3adf2b4d..139b2082c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/shader/Uniform.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.utils.shader import java.util.Objects -import java.util.function.Supplier /** * Class to handle shader uniform types @@ -14,7 +13,7 @@ class Uniform<T>( shader: Shader, private val uniformType: UniformType<T>, val name: String, - private val uniformValuesSupplier: Supplier<T>, + private val uniformValuesSupplier: () -> T, ) { class UniformType<T> { @@ -32,7 +31,7 @@ class Uniform<T>( private var previousUniformValue: T? = null fun update() { - val newUniformValue: T = uniformValuesSupplier.get() + val newUniformValue: T = uniformValuesSupplier() if (!Objects.deepEquals(previousUniformValue, newUniformValue)) { when (uniformType) { UniformType.FLOAT -> { |