From d7f7b3a281a6be975c15af1b2323db799ee1ad5c Mon Sep 17 00:00:00 2001 From: illyrius666 Date: Thu, 16 Oct 2025 15:17:28 +0200 Subject: [PATCH 1/7] init Signed-off-by: illyrius666 --- .../vanillaplus/modules/PlayerModule.kt | 62 ++++++++++++++++--- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt index ff8245ce6..b93b2f66a 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt @@ -8,12 +8,15 @@ import io.papermc.paper.datacomponent.item.ResolvableProfile import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder import org.bukkit.Material import org.bukkit.NamespacedKey +import org.bukkit.Tag +import org.bukkit.block.ShulkerBox import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.EventPriority import org.bukkit.event.entity.PlayerDeathEvent import org.bukkit.event.inventory.ClickType import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.inventory.InventoryCloseEvent import org.bukkit.event.inventory.InventoryType import org.bukkit.event.player.PlayerAdvancementDoneEvent import org.bukkit.event.player.PlayerJoinEvent @@ -21,6 +24,8 @@ import org.bukkit.event.player.PlayerQuitEvent import org.bukkit.inventory.ItemStack import org.bukkit.inventory.Recipe import org.bukkit.inventory.ShapelessRecipe +import org.bukkit.inventory.meta.BlockStateMeta +import org.bukkit.metadata.FixedMetadataValue import org.bukkit.permissions.Permission import org.bukkit.permissions.PermissionDefault import org.bukkit.persistence.PersistentDataType @@ -134,15 +139,55 @@ internal class PlayerModule( @EventHandler fun on(event: InventoryClickEvent) { - if (!enabled() || - event.click != config.enderChestClickType || - event.currentItem?.type != Material.ENDER_CHEST || - event.clickedInventory?.type != InventoryType.PLAYER + if (!enabled()) return + + val player = event.whoClicked as? Player ?: return + + if (event.clickedInventory?.type != InventoryType.PLAYER) return + + if (event.click == config.enderChestClickType && + event.currentItem?.type == Material.ENDER_CHEST ) { - return + event.isCancelled = true + player.openInventory(player.enderChest) + } + + val item = event.currentItem ?: return + + if (event.click == config.shulkerClickType && + Tag.SHULKER_BOXES.isTagged(item.type) + ) { + event.isCancelled = true + + val meta = item.itemMeta as? BlockStateMeta ?: return + val shulker = meta.blockState as? ShulkerBox ?: return + val inventory = + player.server.createInventory(player, shulker.inventory.size, meta.displayName() ?: meta.itemName()) + + inventory.contents = shulker.inventory.contents + + player.setMetadata("open_shulker", FixedMetadataValue(instance, item)) + player.openInventory(inventory) } - event.isCancelled = true - event.whoClicked.openInventory(event.whoClicked.enderChest) + } + + @EventHandler + fun on(event: InventoryCloseEvent) { + if (!enabled()) return + + val player = event.player as? Player ?: return + val metaItem = player.getMetadata("open_shulker").firstOrNull()?.value() as? ItemStack ?: return + + player.removeMetadata("open_shulker", instance) + + val meta = metaItem.itemMeta as? BlockStateMeta ?: return + val shulker = meta.blockState as? ShulkerBox ?: return + + shulker.inventory.contents = event.inventory.contents + + meta.blockState = shulker + + metaItem.itemMeta = meta } /** @@ -205,7 +250,8 @@ internal class PlayerModule( data class Config( override var enabled: Boolean = true, - var enderChestClickType: ClickType = ClickType.SHIFT_LEFT, + var enderChestClickType: ClickType = ClickType.SHIFT_RIGHT, + var shulkerClickType: ClickType = ClickType.SHIFT_RIGHT, var i18n: I18n = I18n(), ) : ModuleInterface.Config { data class I18n( From c7052533fe74bc8f75d9a9b6b163cb998b721033 Mon Sep 17 00:00:00 2001 From: illyrius666 Date: Thu, 16 Oct 2025 15:55:12 +0200 Subject: [PATCH 2/7] usage of pdc to lock Signed-off-by: illyrius666 --- .../vanillaplus/modules/PlayerModule.kt | 33 ++++++++++++------- .../org/xodium/vanillaplus/pdcs/HorsePDC.kt | 6 +--- .../org/xodium/vanillaplus/pdcs/PlayerPDC.kt | 8 +---- .../org/xodium/vanillaplus/pdcs/ShulkerPDC.kt | 25 ++++++++++++++ 4 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 src/main/kotlin/org/xodium/vanillaplus/pdcs/ShulkerPDC.kt diff --git a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt index b93b2f66a..bb37e913d 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt @@ -25,7 +25,6 @@ import org.bukkit.inventory.ItemStack import org.bukkit.inventory.Recipe import org.bukkit.inventory.ShapelessRecipe import org.bukkit.inventory.meta.BlockStateMeta -import org.bukkit.metadata.FixedMetadataValue import org.bukkit.permissions.Permission import org.bukkit.permissions.PermissionDefault import org.bukkit.persistence.PersistentDataType @@ -33,6 +32,7 @@ import org.xodium.vanillaplus.VanillaPlus.Companion.instance import org.xodium.vanillaplus.data.CommandData import org.xodium.vanillaplus.interfaces.ModuleInterface import org.xodium.vanillaplus.pdcs.PlayerPDC.nickname +import org.xodium.vanillaplus.pdcs.ShulkerPDC.lock import org.xodium.vanillaplus.utils.ExtUtils.mm import org.xodium.vanillaplus.utils.ExtUtils.tryCatch import org.xodium.vanillaplus.utils.FmtUtils.fireFmt @@ -161,12 +161,16 @@ internal class PlayerModule( val meta = item.itemMeta as? BlockStateMeta ?: return val shulker = meta.blockState as? ShulkerBox ?: return - val inventory = - player.server.createInventory(player, shulker.inventory.size, meta.displayName() ?: meta.itemName()) + + if (!shulker.lock()) shulker.lock(true) + + meta.blockState = shulker + item.itemMeta = meta + + val inventory = player.server.createInventory(player, shulker.inventory.size, item.displayName()) inventory.contents = shulker.inventory.contents - player.setMetadata("open_shulker", FixedMetadataValue(instance, item)) player.openInventory(inventory) } } @@ -176,18 +180,23 @@ internal class PlayerModule( if (!enabled()) return val player = event.player as? Player ?: return - val metaItem = player.getMetadata("open_shulker").firstOrNull()?.value() as? ItemStack ?: return - player.removeMetadata("open_shulker", instance) + for (item in player.inventory.contents) { + if (item != null && Tag.SHULKER_BOXES.isTagged(item.type)) { + val meta = item.itemMeta as? BlockStateMeta ?: continue + val shulker = meta.blockState as? ShulkerBox ?: continue - val meta = metaItem.itemMeta as? BlockStateMeta ?: return - val shulker = meta.blockState as? ShulkerBox ?: return + if (shulker.lock()) { + shulker.inventory.contents = event.inventory.contents + shulker.lock(false) - shulker.inventory.contents = event.inventory.contents + meta.blockState = shulker + item.itemMeta = meta - meta.blockState = shulker - - metaItem.itemMeta = meta + break + } + } + } } /** diff --git a/src/main/kotlin/org/xodium/vanillaplus/pdcs/HorsePDC.kt b/src/main/kotlin/org/xodium/vanillaplus/pdcs/HorsePDC.kt index d24284d22..f4e955b47 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/pdcs/HorsePDC.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/pdcs/HorsePDC.kt @@ -4,12 +4,8 @@ import org.bukkit.NamespacedKey import org.bukkit.entity.Horse import org.bukkit.persistence.PersistentDataType import org.xodium.vanillaplus.VanillaPlus.Companion.instance -import org.xodium.vanillaplus.pdcs.HorsePDC.SOLD_KEY -/** - * Provides access to horse-specific persistent data including sold status. - * @property SOLD_KEY The namespaced key used for storing sold status data. - */ +/** Provides access to horse-specific persistent data including sold status. */ internal object HorsePDC { private val SOLD_KEY = NamespacedKey(instance, "horse_sold") diff --git a/src/main/kotlin/org/xodium/vanillaplus/pdcs/PlayerPDC.kt b/src/main/kotlin/org/xodium/vanillaplus/pdcs/PlayerPDC.kt index e8a802d1b..cf117a88e 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/pdcs/PlayerPDC.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/pdcs/PlayerPDC.kt @@ -4,14 +4,8 @@ import org.bukkit.NamespacedKey import org.bukkit.entity.Player import org.bukkit.persistence.PersistentDataType import org.xodium.vanillaplus.VanillaPlus.Companion.instance -import org.xodium.vanillaplus.pdcs.PlayerPDC.NICKNAME_KEY -import org.xodium.vanillaplus.pdcs.PlayerPDC.SCOREBOARD_VISIBILITY_KEY -/** - * Provides access to player-specific persistent data including nicknames and scoreboard preferences. - * @property NICKNAME_KEY The namespaced key used for storing nickname data. - * @property SCOREBOARD_VISIBILITY_KEY The namespaced key used for storing scoreboard visibility preferences. - */ +/** Provides access to player-specific persistent data including nicknames and scoreboard preferences. */ internal object PlayerPDC { private val NICKNAME_KEY = NamespacedKey(instance, "nickname") private val SCOREBOARD_VISIBILITY_KEY = NamespacedKey(instance, "scoreboard_visibility") diff --git a/src/main/kotlin/org/xodium/vanillaplus/pdcs/ShulkerPDC.kt b/src/main/kotlin/org/xodium/vanillaplus/pdcs/ShulkerPDC.kt new file mode 100644 index 000000000..426d835ef --- /dev/null +++ b/src/main/kotlin/org/xodium/vanillaplus/pdcs/ShulkerPDC.kt @@ -0,0 +1,25 @@ +package org.xodium.vanillaplus.pdcs + +import org.bukkit.NamespacedKey +import org.bukkit.block.ShulkerBox +import org.bukkit.persistence.PersistentDataType +import org.xodium.vanillaplus.VanillaPlus.Companion.instance + +/** Provides access to shulker-specific persistent data including sold status. */ +internal object ShulkerPDC { + private val LOCK_KEY = NamespacedKey(instance, "lock") + + /** + * Retrieves the usage status of this shulker box from its persistent data container. + * @receiver The shulker box whose usage status to retrieve. + * @return `true` if the shulker box is marked as in use, `false` otherwise. + */ + fun ShulkerBox.lock(): Boolean = persistentDataContainer.get(LOCK_KEY, PersistentDataType.BOOLEAN) ?: false + + /** + * Sets the usage status of this shulker box in its persistent data container. + * @receiver The shulker box whose usage status to modify. + * @param boolean The usage state to set (`true` for in use, `false` for not in use). + */ + fun ShulkerBox.lock(boolean: Boolean) = persistentDataContainer.set(LOCK_KEY, PersistentDataType.BOOLEAN, boolean) +} From fc4c6236dd2f63f6b7ea3d79d7c436dfb0f98ba1 Mon Sep 17 00:00:00 2001 From: Illyrius Date: Thu, 16 Oct 2025 16:52:27 +0200 Subject: [PATCH 3/7] + Signed-off-by: Illyrius --- .idea/dictionaries/project.xml | 1 + ..._fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml | 4 +++- ...asyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml | 4 +++- ...__io_papermc_paper_paper_api_1_21_10_R0_1_SNAPSHOT.xml | 3 +-- .idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml | 4 +++- .../libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml | 4 +++- .../Gradle__org_checkerframework_checker_qual_3_49_5.xml | 4 +++- ..._mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml | 4 +++- .idea/modules/VanillaPlus.main.iml | 4 ++-- .idea/modules/VanillaPlus.test.iml | 8 +++++--- 10 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml index 632686292..0eebf4751 100644 --- a/.idea/dictionaries/project.xml +++ b/.idea/dictionaries/project.xml @@ -26,6 +26,7 @@ redstone rrggbb searchinv + shulker spellbite triumphteam unloadinv diff --git a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml b/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml index a304e5bf4..e25c93c60 100644 --- a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml +++ b/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml @@ -5,6 +5,8 @@ - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml b/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml index 221861392..25573a4d9 100644 --- a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml +++ b/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml @@ -5,6 +5,8 @@ - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_21_10_R0_1_SNAPSHOT.xml b/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_21_10_R0_1_SNAPSHOT.xml index 2c1b63c78..c9be72153 100644 --- a/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_21_10_R0_1_SNAPSHOT.xml +++ b/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_21_10_R0_1_SNAPSHOT.xml @@ -6,8 +6,7 @@ - - + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml b/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml index e35cc7174..ad25f7151 100644 --- a/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml +++ b/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml @@ -5,6 +5,8 @@ - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml b/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml index 799b6bbb4..a25aa6458 100644 --- a/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml +++ b/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml @@ -5,6 +5,8 @@ - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml b/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml index a5991233b..7fd13a884 100644 --- a/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml +++ b/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml @@ -5,6 +5,8 @@ - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml b/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml index a9db5a398..2110d3a71 100644 --- a/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml +++ b/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml @@ -5,6 +5,8 @@ - + + + \ No newline at end of file diff --git a/.idea/modules/VanillaPlus.main.iml b/.idea/modules/VanillaPlus.main.iml index 4e36e578b..2b08653a6 100644 --- a/.idea/modules/VanillaPlus.main.iml +++ b/.idea/modules/VanillaPlus.main.iml @@ -11,7 +11,7 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/.idea/modules/VanillaPlus.test.iml b/.idea/modules/VanillaPlus.test.iml index 4725e3a67..87b6907b5 100644 --- a/.idea/modules/VanillaPlus.test.iml +++ b/.idea/modules/VanillaPlus.test.iml @@ -2,7 +2,7 @@ - + VanillaPlus:main @@ -37,9 +37,11 @@ - + + + - + From 820708e741800e20f5e17d3e98ab4998bf1d23ad Mon Sep 17 00:00:00 2001 From: Illyrius Date: Thu, 16 Oct 2025 16:56:02 +0200 Subject: [PATCH 4/7] fix lock Signed-off-by: Illyrius --- .../org/xodium/vanillaplus/modules/PlayerModule.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt index bb37e913d..13b6734b0 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt @@ -162,16 +162,18 @@ internal class PlayerModule( val meta = item.itemMeta as? BlockStateMeta ?: return val shulker = meta.blockState as? ShulkerBox ?: return - if (!shulker.lock()) shulker.lock(true) + if (!shulker.lock()) { + shulker.lock(true) - meta.blockState = shulker - item.itemMeta = meta + meta.blockState = shulker + item.itemMeta = meta - val inventory = player.server.createInventory(player, shulker.inventory.size, item.displayName()) + val inventory = player.server.createInventory(player, shulker.inventory.size, item.displayName()) - inventory.contents = shulker.inventory.contents + inventory.contents = shulker.inventory.contents - player.openInventory(inventory) + player.openInventory(inventory) + } } } From 953292179c15e61a8d1649534d9fdc6ae0bcfa2c Mon Sep 17 00:00:00 2001 From: Illyrius Date: Thu, 16 Oct 2025 17:34:44 +0200 Subject: [PATCH 5/7] using shulker inventory instead of creating a new one Signed-off-by: Illyrius --- .../kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt index 13b6734b0..9e3542b23 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt @@ -168,11 +168,7 @@ internal class PlayerModule( meta.blockState = shulker item.itemMeta = meta - val inventory = player.server.createInventory(player, shulker.inventory.size, item.displayName()) - - inventory.contents = shulker.inventory.contents - - player.openInventory(inventory) + player.openInventory(shulker.inventory) } } } @@ -195,6 +191,8 @@ internal class PlayerModule( meta.blockState = shulker item.itemMeta = meta + player.updateInventory() + break } } From cc4a8b4d658d1e59929c0ce3db0bb1f6118c986c Mon Sep 17 00:00:00 2001 From: illyrius666 Date: Tue, 21 Oct 2025 11:07:17 +0200 Subject: [PATCH 6/7] blub Signed-off-by: illyrius666 --- ...rldedit_FastAsyncWorldEdit_Core_2_13_1.xml | 12 ----------- ...it_FastAsyncWorldEdit_Libs_Core_2_13_1.xml | 12 ----------- .../Gradle__org_antlr_antlr4_4_13_2.xml | 12 ----------- ...radle__org_antlr_antlr4_runtime_4_13_2.xml | 12 ----------- ...g_checkerframework_checker_qual_3_49_5.xml | 12 ----------- ...ada_math_MathParser_org_mXparser_6_1_0.xml | 12 ----------- .../vanillaplus/modules/PlayerModule.kt | 21 ++++++++++++------- 7 files changed, 13 insertions(+), 80 deletions(-) delete mode 100644 .idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml delete mode 100644 .idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml delete mode 100644 .idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml delete mode 100644 .idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml delete mode 100644 .idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml delete mode 100644 .idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml diff --git a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml b/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml deleted file mode 100644 index e25c93c60..000000000 --- a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Core_2_13_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml b/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml deleted file mode 100644 index 25573a4d9..000000000 --- a/.idea/libraries/Gradle__com_fastasyncworldedit_FastAsyncWorldEdit_Libs_Core_2_13_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml b/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml deleted file mode 100644 index ad25f7151..000000000 --- a/.idea/libraries/Gradle__org_antlr_antlr4_4_13_2.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml b/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml deleted file mode 100644 index a25aa6458..000000000 --- a/.idea/libraries/Gradle__org_antlr_antlr4_runtime_4_13_2.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml b/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml deleted file mode 100644 index 7fd13a884..000000000 --- a/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_49_5.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml b/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml deleted file mode 100644 index 2110d3a71..000000000 --- a/.idea/libraries/Gradle__org_mariuszgromada_math_MathParser_org_mXparser_6_1_0.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt index e1fc5201f..32e584768 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt @@ -32,6 +32,7 @@ import org.xodium.vanillaplus.VanillaPlus.Companion.instance import org.xodium.vanillaplus.data.CommandData import org.xodium.vanillaplus.interfaces.ModuleInterface import org.xodium.vanillaplus.pdcs.PlayerPDC.nickname +import org.xodium.vanillaplus.pdcs.ShulkerPDC.lock import org.xodium.vanillaplus.utils.ExtUtils.mm import org.xodium.vanillaplus.utils.ExtUtils.tryCatch import org.xodium.vanillaplus.utils.FmtUtils.fireFmt @@ -148,7 +149,10 @@ internal class PlayerModule( event.currentItem?.type == Material.ENDER_CHEST ) { event.isCancelled = true - player.openInventory(player.enderChest) + instance.server.scheduler.runTask( + instance, + Runnable { player.openInventory(player.enderChest) }, + ) } val item = event.currentItem ?: return @@ -167,7 +171,10 @@ internal class PlayerModule( meta.blockState = shulker item.itemMeta = meta - player.openInventory(shulker.inventory) + instance.server.scheduler.runTask( + instance, + Runnable { player.openInventory(shulker.inventory) }, + ) } } } @@ -190,17 +197,15 @@ internal class PlayerModule( meta.blockState = shulker item.itemMeta = meta - player.updateInventory() + instance.server.scheduler.runTask( + instance, + Runnable { player.updateInventory() }, + ) break } } } - event.isCancelled = true - instance.server.scheduler.runTask( - instance, - Runnable { event.whoClicked.openInventory(event.whoClicked.enderChest) }, - ) } /** From af28b59435d822ced79476080795165947c44593 Mon Sep 17 00:00:00 2001 From: illyrius666 Date: Tue, 21 Oct 2025 11:18:47 +0200 Subject: [PATCH 7/7] + Signed-off-by: illyrius666 --- src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt index 32e584768..51d2304b0 100644 --- a/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt +++ b/src/main/kotlin/org/xodium/vanillaplus/modules/PlayerModule.kt @@ -177,6 +177,7 @@ internal class PlayerModule( ) } } + // TODO: make it so when click on enderchest/shulker it first closes current inventory before opening the new one. } @EventHandler