item lock [help]

  • 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 community!

    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!

kingbee8884

New Member
Aug 18, 2024
5
0
1
so i want to make a item that cant be dropped or put in a chest or anything else, so its always in the players inventory and the only way for you to move it around in your inv is when you click e and open it up not in a chest all i have is this code that isn't working for me.

on inventory click:
if inventory type of player's current inventory is "CHEST":
if item is enchanted with curse of vanishing:
cancel event
wait 1 tick
close player's inventory
send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player
 
Java:
on inventory click:
    if type of event-inventory is not player inventory:
        if item is enchanted with curse of vanishing:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player

It's changed only 2nd line. Let's try.

If it works, the player who click on the designated item can only pick it up or drop it in their inventory
 
Last edited:
Java:
on inventory click:
    if type of event-inventory is not player inventory:
        if item is enchanted with curse of vanishing:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player

It's changed only 2nd line. Let's try.

If it's working, who clicked with item which is determined can pick up or drop only in the self-inventory
this is close but it still allows me to put it into a chest just not take it out another ideas?
 
i understood.
Java:
on inventory click:
    if event-inventory is not player inventory:
        if cursor slot of player is enchanted with curse of vanishing:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player

it should be working
 
i understood.
Java:
on inventory click:
    if event-inventory is not player inventory:
        if cursor slot of player is enchanted with curse of vanishing:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player

it should be working
it works really well unless you shift click it into the chest any chance you can fix that?
 
it works really well unless you shift click it into the chest any chance you can fix that?
yes, it possible. but dealing with scripts is torture. i'm coding spigot java.

let's try
Java:
on inventory click:
    if cursor slot of player is enchanted with curse of vanishing:
        if click type is not left mouse button or right mouse button:
            cancel event
            stop
        if event-inventory is not player inventory:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player
 
yes, it possible. but dealing with scripts is torture. i'm coding spigot java.

let's try
Java:
on inventory click:
    if cursor slot of player is enchanted with curse of vanishing:
        if click type is not left mouse button or right mouse button:
            cancel event
            stop
        if event-inventory is not player inventory:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player
no it still allows you to shift it in
 
Code:
on inventory click:
    if event-inventory's name is "Chest":
        if event-slot is enchanted with curse of vanishing:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player
This is similar to your first piece of code, try detecting the name instead of the type.(No clue if this will work)
 
let's try this

Java:
on inventory item move:   
    if event-item is enchanted with curse of vanishing:
        if type of holder of event-inventory is not player inventory:
            cancel event
            wait 1 tick
            close player's inventory
            send "You can not put items enchanted with &6Curse of Vanishing&r into chests" to player
 
Last edited: