Skip to content

Commit b33b70a

Browse files
committed
fix: Fix persistent items saving the wrong inventory contents
1 parent 9424517 commit b33b70a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

interfaces/src/main/kotlin/com/noxcrew/interfaces/InterfacesListeners.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
268268
public fun saveInventoryContentsIfOpened(player: HumanEntity) {
269269
// Saves any persistent items stored in the main inventory whenever we are currently
270270
// showing a combined or player inventory before we draw the new one over-top
271-
val currentlyShown = convertHolderToInterfaceView(player.openInventory.topInventory.getHolder(false))
272-
?: getBackgroundPlayerInterface(player.uniqueId)
271+
val currentlyShown = openInventory[player]
273272
if (currentlyShown != null && currentlyShown !is ChestInterfaceView) {
274273
if (currentlyShown.builder.persistAddedItems) {
275274
currentlyShown.savePersistentItems(player.inventory)

interfaces/src/main/kotlin/com/noxcrew/interfaces/exception/StandardInterfacesExceptionHandler.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ public open class StandardInterfacesExceptionHandler(
2525
// When building a player menu we absolutely do not want to fail as
2626
// it results in nothing being drawn. We retry up to 3 times!
2727
logger.error(
28-
"Failed `${context.operation.description}` for ${context.player.name}, retrying (${context.retries + 1}/3)!", exception
28+
"Failed `${context.operation.description}` for ${context.player.name}, retrying (${context.retries + 1}/3)!",
29+
exception
2930
)
3031
InterfacesExceptionResolution.RETRY
3132
} else {
3233
// Ignore the drawing but kick the player off the server
3334
logger.error(
3435
"Failed `${context.operation.description}` for ${context.player.name} 3 times, " +
35-
"kicking player to prevent invalid state", exception
36+
"kicking player to prevent invalid state",
37+
exception
3638
)
3739
InterfacesListeners.INSTANCE.runSync {
3840
context.player.kick(Component.text("Unknown exception occurred while rendering GUI menus"))

0 commit comments

Comments
 (0)