From 3c0b33b09fc8843ff0322a3eaf4acce5d4daa475 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 27 Aug 2021 16:31:19 +0100 Subject: [PATCH] Hopefully fixed speed bug --- .../com/willfp/ecoskills/stats/stats/StatSpeed.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/stats/StatSpeed.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/stats/StatSpeed.kt index 3ebfee5..f5fa134 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/stats/StatSpeed.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/stats/StatSpeed.kt @@ -13,13 +13,13 @@ class StatSpeed : Stat( val modifier = AttributeModifier( this.uuid, this.name, - (this.config.getDouble("percent-faster-per-level") * player.getStatLevel(this)) / 100, + (this.config.getDouble("percent-faster-per-level") * player.getStatLevel(this)) / 100.0, AttributeModifier.Operation.MULTIPLY_SCALAR_1 ) - val instance = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED) ?: return - instance.removeModifier(modifier) - plugin.scheduler.runLater({ + plugin.scheduler.run { + val instance = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED) ?: return@run + instance.removeModifier(modifier) instance.addModifier(modifier) - }, 1) + } } } \ No newline at end of file