SkNBTPreserver

Script SkNBTPreserver 1.6.1

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

Supported Skript Version
  1. 2.8
Supported Minecraft Versions
  1. 1.20
NBT-Preserver (1).png


A very simple Skript that addresses a single issue: not being able to retrieve the same blocks that were placed!


Now placing a block or a head saves the original item for the drop when it is broken by a player or an explosion!
This Skript will be improved in the future to add more control and features. But for now, it does the job well.
Code:
- SkNBTPreserverGetItemFromBlock(block)

    Returns the original item from a block

    Example: drop SkNBTPreserverGetItemFromBlock(event-block)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- SkNBTPreserverGetItemFromLocation(location)

    Same as the function above, but from a location

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- SkNBTPreserverGetNameFromBlock(block)

    Get the name of a block

    Example: send SkNBTPreserverGetNameFromBlock(event-block)
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
- SkNBTPreserverSaveBlock(item, block)

    Save a block in database. 'item' is the block as an item in your inventory.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
- SkNBTRegisterMoreData(block, data, value)

    Lets you register more data on a block. Value is always a string.
  
    Exaple: SkNBTRegisterMoreData(event-block, "cool-variable", "cool-value")
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- SkNBTPreserverRemoveBlockNaturally(block)

    Removes a block from database and drops it
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- SkNBTPreserverRemoveBlock(block)

    Removes a block from database without dropping it
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- kNBTRemoveAllBlocksByName(string)

    Removes ALL blocks by name, without dropping anything

YAML:
/sknbtpreserver help (Main command)
    - Aliases: /sknbtp, /sknbt
    - Permission: sknbtpreserver.admin
  
/sknbtpreserver check
    - Prints all registered blocks
  
/sknbtpreserver purge
    - Checks database and removes useless data
  
/sknbtpreserver search <value>
    - Searches all blocks by their name or the player who place dit
    - /sknbtp search p:Palgia will search all blocks placed by Palgia
    - /sknbtp search n:&aCool block will search all blocks named "Cool block"
  
/sknbtpreserver removeall <name>
    - Removes all blocks by name in all worlds
  • NBT-Preserver.png
    NBT-Preserver.png
    8.7 KB · Views: 63
Author
Palgia
Downloads
224
Views
240
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Palgia

Latest updates

  1. Bug fix

    Fixed a bug that prevented player heads placed on walls from being saved correctly.
  2. New function

    Added function SkNBTAllPlacedBlocks(string) to return all placed blocks by name
  3. Added protection for blocks

    Now blocks that are registered by SkNBTPreserver will be immune to pistons and physics. This was...