on break/left click on chest (Get chest's name)

  • 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.

Daniel Greer

Member
Dec 11, 2020
18
2
3
  1. Script Version (do not put latest): Skript 2.2-dev27
  2. Script Author: Me, ItsDvance
  3. Minecraft Version: 1.8.9
  4. Full Code:

Code:
on break of chest:
    if the event-block's name != "%player%":
        cancel the event
        send "&cThis chest can only be modified by &f%event-block's name%"

When running this, and breaking a chest, I am sent "This chest can only be modified by <none>"

I am using > skRayFall, SkQuery, TuSKe, Tablisknu < though this information doesn't matter because this is specifically a 'vanilla' Skript event.
[doublepost=1619338383,1619311161][/doublepost]I solved it myself, but for those who come after me, here's the code I used.

Code:
on break of chest:
    if {hub.lobby::%player%} = "survival":
        if "%event-block's inventory name%" != "%player%" or "chest" or "Large chest" or "container.chest":
            send "&cThis chest can only be modified by &f%event-block's inventory name%"
            cancel the event


on place of chest:
    if {hub.lobby::%player%} = "survival":
        if "%event-block's inventory name%" != "%player%":
            cancel the event
            send "&cPlace this chest again to lock it."
            set the player's tool's name to "%player%"

Fixed my code, 5/14/2021
 
Last edited:
Status
Not open for further replies.