Update some GUI feature in readme.md (#52)
* Update readme.md * Update readme.md
This commit is contained in:
12
readme.md
12
readme.md
@@ -54,26 +54,26 @@ firstAsync {
|
|||||||
|
|
||||||
Inventories are great for viewing GUI information. However, they are not designed for developing GUIs. The KSpigot
|
Inventories are great for viewing GUI information. However, they are not designed for developing GUIs. The KSpigot
|
||||||
Inventory GUI API provides an easy way to build inventory GUIs the way you would expect such an API to be. In addition,
|
Inventory GUI API provides an easy way to build inventory GUIs the way you would expect such an API to be. In addition,
|
||||||
it offers full type safety for slots.
|
it offers full type safety for slots. Attention, the Slots is designed from bottom to top, so the page button will be at the bottom of GUI
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val gui = kSpigotGUI(GUIType.FIVE_BY_NINE) {
|
val gui = kSpigotGUI(GUIType.FIVE_BY_NINE) {
|
||||||
title = "Example Inventory"
|
title = literalText("Example Inventory")
|
||||||
|
|
||||||
page(0) {
|
page(1) {
|
||||||
// slot ranges like rectTo or linTo reduce the amount of code
|
// slot ranges like rectTo or linTo reduce the amount of code
|
||||||
placeholder(Slots.RowOneSlotOne rectTo Slots.RowFiveSlotNine, ItemStack(Material.RED_STAINED_GLASS))
|
placeholder(Slots.RowOneSlotOne rectTo Slots.RowFiveSlotNine, ItemStack(Material.RED_STAINED_GLASS))
|
||||||
nextPage(Slots.RowOneSlotNine, ItemStack(Material.PAPER))
|
nextPage(Slots.RowOneSlotNine, ItemStack(Material.PAPER))
|
||||||
}
|
}
|
||||||
|
|
||||||
page(1) {
|
page(2) {
|
||||||
// define fancy transitions
|
// define fancy transitions
|
||||||
transitionFrom = PageChangeEffect.SLIDE_HORIZONTALLY
|
transitionFrom = PageChangeEffect.SLIDE_HORIZONTALLY
|
||||||
transitionTo = PageChangeEffect.SLIDE_HORIZONTALLY
|
transitionTo = PageChangeEffect.SLIDE_HORIZONTALLY
|
||||||
|
|
||||||
// get special slot compounds easily with constants like Slots.Border
|
// get special slot compounds easily with constants like Slots.Border
|
||||||
placeholder(Slots.Border, ItemStack(Material.GLASS_PANE))
|
placeholder(Slots.Border, ItemStack(Material.GLASS_PANE))
|
||||||
|
|
||||||
// page change buttons
|
// page change buttons
|
||||||
previousPage(Slots.RowTwoSlotTwo, ItemStack(Material.PAPER))
|
previousPage(Slots.RowTwoSlotTwo, ItemStack(Material.PAPER))
|
||||||
nextPage(Slots.RowTwoSlotEight, ItemStack(Material.PAPER))
|
nextPage(Slots.RowTwoSlotEight, ItemStack(Material.PAPER))
|
||||||
@@ -88,7 +88,7 @@ val gui = kSpigotGUI(GUIType.FIVE_BY_NINE) {
|
|||||||
freeSlot(Slots.RowTwoSlotFive)
|
freeSlot(Slots.RowTwoSlotFive)
|
||||||
}
|
}
|
||||||
|
|
||||||
page(2) {
|
page(3) {
|
||||||
// placeholders are there to block any player action while displaying a specific item
|
// placeholders are there to block any player action while displaying a specific item
|
||||||
placeholder(Slots.RowOneSlotOne rectTo Slots.RowFiveSlotNine, ItemStack(Material.PINK_GLAZED_TERRACOTTA))
|
placeholder(Slots.RowOneSlotOne rectTo Slots.RowFiveSlotNine, ItemStack(Material.PINK_GLAZED_TERRACOTTA))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user