Skip to content

Commit

Permalink
Stop switching items in hands
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDog896 committed Jan 24, 2022
1 parent fa8125c commit 491a5e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/kotlin/world/cepi/gooey/GooeyExtension.kt
Expand Up @@ -3,6 +3,7 @@ package world.cepi.gooey
import net.minestom.server.event.inventory.InventoryPreClickEvent
import net.minestom.server.event.item.ItemDropEvent
import net.minestom.server.event.player.PlayerSpawnEvent
import net.minestom.server.event.player.PlayerSwapItemEvent
import net.minestom.server.extensions.Extension;
import world.cepi.kstom.event.listenOnly
import world.cepi.kstom.util.log
Expand All @@ -23,6 +24,18 @@ class GooeyExtension : Extension() {
}
}

node.listenOnly<PlayerSwapItemEvent> {
if (InventoryManager.hasItem(mainHandItem)) {
isCancelled = true
return@listenOnly
}

if (InventoryManager.hasItem(offHandItem)) {
isCancelled = true
return@listenOnly
}
}

node.listenOnly<ItemDropEvent> {
if (InventoryManager.hasItem(itemStack)) {
isCancelled = true
Expand Down

0 comments on commit 491a5e0

Please sign in to comment.