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

Jason Paige

Member
Mar 31, 2023
14
0
1
27
Hey, recently I wanted to make custom item bags that are based on player heads. these items can then be crafted into something else for sale and transport, as well as being placeable and only holds 8 items that are exchanged via crafting recipe. simple enough I thought. Wrong, but I digress. I had to go with storing the coordinates of each block and when player heads with a list of specific skull textures break it it deletes the item drop via loop in 3 radius of the player. My issue is storage, how do I efficiently store these values. I know json is the most effect file type but I am to lazy to poke that bear. Herein my question lies, I am currently using a yml file from skript-yml that saves the values as storage on specific timed events and stop. whenever the world saves I check all these specific blocks. there are about 15 types of them and remove all the ones that no longer exist. When the game stops i save all these values to the yml file, and get them again right after the server starts. they are stored in skript variables at this point and the files are just a backup and for easy editing. I have no clue how inefficient this is so my options are

  1. Do the same thing but with MYSQL database
  2. Do the same but poke the bear and do it in Json
  3. Do the opposite and get the locations from the yml file directly on block break and store it to the file directly on block place
  4. Do the opposite '' '' '' but with MYSQL database
  5. do the opposite '' '' '' but with Json
of all these options what would be the smartest to do. I was going to do MYSQL at first but i though the constant connecting and disconnecting would cost to much.


Thanks in advance and sorry for the long post
 
Hi, apologies for waiting a day before responding. I read your post, but shyed away when I read SQL.

I'm almost certain most people use yml for stuff like this. I'm pretty sure the Slimefun plugin, which does stuff like this all the time, also uses yml. Might be a good resource to look at. When deciding how to name your elements though, I'd recommend structuring your nodes like "%world%.%x%|%y%|%z%" where | is some separator character used to distinguish between these values. This way, you don't need to linearly search through your values, which is kind of annoying with skript-yaml. Another thought would be to hash the data within the item bags and use the output as a node, but that might get a bit complicated (or storage intensive) for a result that's much easier to achieve with the previous suggestion.

TL;DR: Use yml