Skip to content

feat: add shulker box support for item storage and buying#18

Draft
ZvandeKamp wants to merge 19 commits into
SLNE-Development:version/26.1from
ZvandeKamp:feat/AddShulkerSupport
Draft

feat: add shulker box support for item storage and buying#18
ZvandeKamp wants to merge 19 commits into
SLNE-Development:version/26.1from
ZvandeKamp:feat/AddShulkerSupport

Conversation

@ZvandeKamp

Copy link
Copy Markdown

Summary

This PR introduces the ability for players to use Shulker Boxes to bulk-insert, bulk-withdraw, and bulk-buy items within the shop system. This significantly improves the user experience for high-volume traders by reducing the need for manual stack handling.

Key Changes

  • Shulker Box Buying: Added a new interaction in BuyShopItemView that allows players to buy items directly into an empty Shulker Box (up to 27 stacks).
  • Shulker Box Insertion: Updated ItemStorageInsertView to allow players to deposit the entire contents of a Shulker Box into their shop storage in one click.
  • Shulker Box Withdrawal: Updated ItemStorageRemoveView to allow shop owners to withdraw items directly into an empty Shulker Box.
  • Validation: Implemented checks to ensure Shulker Boxes are empty when required and contain uniform item types during insertion.

@ZvandeKamp

Copy link
Copy Markdown
Author

@TheBjoRedCraft ich möchte einmal Anmerken dass das Plugin zwar Baut ich aber keine Testumgebung hatte um alle neuen Features ordentlich durch zu testen.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Shulker Box-based bulk operations to the shop UI, enabling high-volume workflows by letting players deposit, withdraw, and buy items using Shulker Boxes as containers.

Changes:

  • Add Shulker Box withdrawal support in the storage removal view (fill an empty Shulker Box from shop stock).
  • Add Shulker Box insertion support in the storage insert view (deposit a Shulker Box’s contents into shop stock).
  • Add Shulker Box purchase option in the buy view (buy up to 27 stacks into an empty Shulker Box).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
surf-shop-paper/src/main/kotlin/dev/slne/surf/shop/paper/menu/edit/storage/ItemStorageRemoveView.kt Adds UI slot + logic to withdraw shop stock into an empty Shulker Box.
surf-shop-paper/src/main/kotlin/dev/slne/surf/shop/paper/menu/edit/storage/ItemStorageInsertView.kt Adds logic to bulk-insert items from a Shulker Box into shop storage.
surf-shop-paper/src/main/kotlin/dev/slne/surf/shop/paper/menu/buy/BuyShopItemView.kt Adds a Shulker Box buy interaction that packages purchased items into a Shulker Box.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +141 to +149
withContext(plugin.entityDispatcher(context.player)) {
val toRemove = currentShop.item.clone().apply {
amount = boughtAmount
}
val notRemoved =
context.player.inventory.removeItem(toRemove)
val removedAmount =
boughtAmount - notRemoved.values.sumOf { it.amount }

line {
appendSpace()
appendBlob()
shopColored("wird die Box teilweise befullt.")
context: me.devnatan.inventoryframework.context.SlotClickContext,
shulkerItem: ItemStack
) = withContext(plugin.entityDispatcher(context.player)) {
val emptyShulker = ItemStack(shulkerItem.type)
Comment on lines +93 to +111
for (slotItem in contents) {
if (slotItem == null || slotItem.type.isAir) {
click.player.sendActionBar(buildText {
appendErrorPrefix()
error("Die Shulker-Box muss voll sein.")
})
click.player.playNoSound()
return
}
if (!slotItem.isSimilar(shop.item)) {
click.player.sendActionBar(buildText {
appendErrorPrefix()
error("Die Shulker-Box enthält unterschiedliche Item-Typen.")
})
click.player.playNoSound()
return
}
totalItems += slotItem.amount
}
click.isCancelled = false
click.clickOrigin.currentItem = ItemStack.empty()

val emptyShulker = ItemStack(item.type)
player.sendText {
appendErrorPrefix()
error("Der Shop existiert nicht mehr.")
}
Comment on lines +391 to +408
withContext(plugin.entityDispatcher(player)) {
val emptyShulker = ItemStack(shulkerType)
val leftover = player.inventory.addItem(emptyShulker)
if (leftover.isNotEmpty()) {
leftover.values.forEach { rest ->
val dropped = player.world.dropItem(
player.location, rest
)
dropped.owner = player.uniqueId
}
}
}
return@launch
}

val filledShulker = createFilledShulker(
shulkerType, updatedShop.item, toRemove
)
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.BlockStateMeta
import kotlin.math.max
import kotlin.math.min
)) {
is Deal.DealResult.Success -> {
val boughtAmount = result.deal.amount

@TheBjoRedCraft TheBjoRedCraft marked this pull request as draft May 25, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants