Solved How to disable inventory swap?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

BrownMee

Active Member
Apr 16, 2018
126
6
18
23
Let's say you have a stone named "test" in hotbar slot 1
code_language.skript:
on inventory click:
   if name of clicked item contains "test":
       cancel event

Can't be move but there's still a way to move by swapping the item into their chest/inner inventory or any other containers.

on inventory move event doesn't work.

Any other solutions?
 
Hello, try this :

code_language.skript:
on drop:
    cancel event

on pickup:
  cancel event

on inventory click:
  cancel event
 
Hello, try this :

code_language.skript:
on drop:
    cancel event

on pickup:
  cancel event

on inventory click:
  cancel event
Doesn't work.
What on drop and on pickup has to do with it?

I'm talking about swapping items.
 
Are you talking about swapping main/off-hand items?

Like I want to disable every movement including clicking it.
The item is in my hotbar slot of 8
Clicking and moving is solved. Left the swapping like you open a chest and u point inside the container and u push key 8 and it will drag in the item
[doublepost=1534917463,1534868776][/doublepost]
Are you talking about swapping main/off-hand items?
Is there any other ideas?
 
okay i just tried
code_language.skript:
on inventory click:
    cancel event
and when i did that, i opened a chest, hovered over an empty slot and clicked 9... and it cancelled the event
 
okay i just tried
code_language.skript:
on inventory click:
    cancel event
and when i did that, i opened a chest, hovered over an empty slot and clicked 9... and it cancelled the event
Yea it canceled the event
But now try this

on inventory click
if name of clicked item contains "test":
cancel event

It somehow works if you don't check for name/lore
 
because you aren't "clicking" on said item with the name if you are doing a swap
[doublepost=1534923499,1534920701][/doublepost]okay, so i couldn't figure this out with vanilla skript, but i figured it out with Skript mirror
code_language.skript:
on inventory click:
    if "%event.getAction()%" is "swap with hotbar":
        if name of slot event.getHotbarButton() of inventory of player contains "test":
            cancel event
 
you can always use a bukkit event for detecting when a player swaps a tool with their offhand/
code_language.skript:
on "org.bukkit.event.player.PlayerSwapHandItemsEvent":
    cancel event
 
you can always use a bukkit event for detecting when a player swaps a tool with their offhand/
code_language.skript:
on "org.bukkit.event.player.PlayerSwapHandItemsEvent":
    cancel event
I'm talking about pointing swap
 
Status
Not open for further replies.