diff --git a/src/main/kotlin/net/axay/kspigot/gui/GUIBuilder.kt b/src/main/kotlin/net/axay/kspigot/gui/GUIBuilder.kt index 7dadf8a7..d34a2be1 100644 --- a/src/main/kotlin/net/axay/kspigot/gui/GUIBuilder.kt +++ b/src/main/kotlin/net/axay/kspigot/gui/GUIBuilder.kt @@ -267,7 +267,6 @@ class GUIPageBuilder( GUISpaceCompoundScrollButton( icon, compound, - compound.compoundWidth, scrollTimes, reverse ) diff --git a/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompoundScrollButton.kt b/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompoundScrollButton.kt index fbb44b40..e4d7717e 100644 --- a/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompoundScrollButton.kt +++ b/src/main/kotlin/net/axay/kspigot/gui/elements/GUISpaceCompoundScrollButton.kt @@ -5,12 +5,16 @@ import net.axay.kspigot.runnables.task import org.bukkit.inventory.ItemStack class GUISpaceCompoundScrollButton( + icon: ItemStack, + private val compound: AbstractGUISpaceCompound, private val scrollDistance: Int, private val scrollTimes: Int, private val reverse: Boolean = false + ) : GUIButton(icon, { + if (scrollTimes > 1) { task( period = 1, @@ -21,4 +25,14 @@ class GUISpaceCompoundScrollButton( } } else if (scrollTimes == 1) if (reverse) compound.scroll(-scrollDistance) else compound.scroll(scrollDistance) -}) \ No newline at end of file + +}) { + + constructor( + icon: ItemStack, + compound: GUIRectSpaceCompound, + scrollTimes: Int = 1, + reverse: Boolean = false + ) : this(icon, compound, compound.compoundWidth, scrollTimes, reverse) + +} \ No newline at end of file