Added constructor for rect space compound
This commit is contained in:
@@ -267,7 +267,6 @@ class GUIPageBuilder<T : ForInventory>(
|
|||||||
GUISpaceCompoundScrollButton(
|
GUISpaceCompoundScrollButton(
|
||||||
icon,
|
icon,
|
||||||
compound,
|
compound,
|
||||||
compound.compoundWidth,
|
|
||||||
scrollTimes,
|
scrollTimes,
|
||||||
reverse
|
reverse
|
||||||
)
|
)
|
||||||
|
@@ -5,12 +5,16 @@ import net.axay.kspigot.runnables.task
|
|||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
|
|
||||||
class GUISpaceCompoundScrollButton<T : ForInventory>(
|
class GUISpaceCompoundScrollButton<T : ForInventory>(
|
||||||
|
|
||||||
icon: ItemStack,
|
icon: ItemStack,
|
||||||
|
|
||||||
private val compound: AbstractGUISpaceCompound<T, *>,
|
private val compound: AbstractGUISpaceCompound<T, *>,
|
||||||
private val scrollDistance: Int,
|
private val scrollDistance: Int,
|
||||||
private val scrollTimes: Int,
|
private val scrollTimes: Int,
|
||||||
private val reverse: Boolean = false
|
private val reverse: Boolean = false
|
||||||
|
|
||||||
) : GUIButton<T>(icon, {
|
) : GUIButton<T>(icon, {
|
||||||
|
|
||||||
if (scrollTimes > 1) {
|
if (scrollTimes > 1) {
|
||||||
task(
|
task(
|
||||||
period = 1,
|
period = 1,
|
||||||
@@ -21,4 +25,14 @@ class GUISpaceCompoundScrollButton<T : ForInventory>(
|
|||||||
}
|
}
|
||||||
} else if (scrollTimes == 1)
|
} else if (scrollTimes == 1)
|
||||||
if (reverse) compound.scroll(-scrollDistance) else compound.scroll(scrollDistance)
|
if (reverse) compound.scroll(-scrollDistance) else compound.scroll(scrollDistance)
|
||||||
})
|
|
||||||
|
}) {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
icon: ItemStack,
|
||||||
|
compound: GUIRectSpaceCompound<T, *>,
|
||||||
|
scrollTimes: Int = 1,
|
||||||
|
reverse: Boolean = false
|
||||||
|
) : this(icon, compound, compound.compoundWidth, scrollTimes, reverse)
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user