Adding NBT to blocks

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

L0v0lup

Member
Feb 19, 2017
26
2
3
27
Skript Version: Skript 2.2 (dev36)
Skript Author: Bensku
Minecraft Version: 1.12
---
Full Code:

code_language.skript:
on place:
    add "Placed" to custom nbt of event-block

on break:
    if nbt of block contains "Placed":
    cancel event


Errors on Reload:

"event-block is not a world (Jobs.sk, line 153: add "Placed" to custom nbt of event-block')"

Addons using:
skript-mirror-0.12.1, SkStuff 1.6.4.1


Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it?
Previously i used metadata but that wasnt an long-term option, since they are getting removed after a server restart.

What i am trying to do:
I need to somehow mark the blocks that been placed for my Job system. People shall not be able to break/place the same block over and over again to farm EXP for free.
 
I remember trying to do something like this, and if Im not mistaken, general blocks dont hold NBT when placed.
What I had to do, is set location variables for when the block was placed, and then when a player breaks a block, it loops all the variables, and checks to see if that specific location was saved.
 
Even if i add the NBT after the block is placed on the ground? :/
Well maybe i can hook it up with CoreProtect's MySQL database to check if a block has been placed by a player.
But im not sure if that even works :c
 
as fas as i know, correct. Most blocks do not hold NBT whilst they are placed... the only ones that do, are ones such as chests, furnaces, anvils.... but standard blocks like dirt, stone, cobble do not
 
  • Like
Reactions: L0v0lup
Status
Not open for further replies.