Closed BlackBaroness closed 1 year ago
Is this issue also present on 1.20?
No
server.pluginManager.registerEvents(object : Listener {
@EventHandler
fun onLoad(event: PlayerJoinEvent) {
val productionGui = ScrollGui.items()
.setStructure(
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x"
)
.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
.addContent(SimpleItem(ItemWrapper(ItemStack(Material.STONE))))
.build()
val inputInventoryGui = Gui.normal()
.setStructure(
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x"
)
.addIngredient('x', VirtualInventoryManager.getInstance().createNew(UUID.randomUUID(), 18))
.build()
val outputInventoryGui = Gui.normal()
.setStructure(
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x"
)
.addIngredient('x', VirtualInventoryManager.getInstance().createNew(UUID.randomUUID(), 18))
.build()
val tabGui = TabGui.normal()
.setStructure(
"# # 0 1 # 2 3 # #",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x",
"x x x x x x x x x"
)
.setTabs(listOf(productionGui, inputInventoryGui, outputInventoryGui))
.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
.addIngredient('0', object : TabItem(0) {
override fun getItemProvider(gui: TabGui?): ItemProvider =
ItemWrapper(ItemStack(Material.CHEST))
})
.addIngredient('1', object : TabItem(1) {
override fun getItemProvider(gui: TabGui?): ItemProvider =
ItemWrapper(ItemStack(Material.STONE))
})
.addIngredient('2', object : TabItem(2) {
override fun getItemProvider(gui: TabGui?): ItemProvider =
ItemWrapper(ItemStack(Material.STONECUTTER))
})
.addIngredient('#', ItemBuilder(Material.GRAY_STAINED_GLASS_PANE).setDisplayName(Component.empty()))
.build()
server.scheduler.runTask(plugin, Runnable {
Window.single()
.setGui(tabGui)
.setTitle("Станок")
.build(event.player)
.open()
})
}
}, plugin)
This issue was because of me. I have used
override fun handleClick(clickType: ClickType, player: Player, event: InventoryClickEvent) {
player.closeInventory()
}
instead of
override fun handleClick(clickType: ClickType, player: Player, event: InventoryClickEvent) {
server.scheduler.runTask(plugin, Runnable { player.closeInventory() })
}
Hello. When using shift+click at ScrollGui, it is possible to take item to player inventory.
Paper 1.16.5. Kotlin.
I use tab gui with 3 tabs - ScrollGui and 2 Virtual Inventories (Gui). Player can extract item from the ScrollGui, what is completely unexpected.