Metadata persistence?

Discussion in 'Plugin Development' started by ZeusAllMighty11, May 28, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    ZeusAllMighty11

    Is metadata persistent? Why does it manage through reloads, but not restarts? :\
     
    Minnymin3 likes this.
  2. Metadata is NOT persistent, it is reset when the server is shutdown. It is a great way of storing information information inside an object while the server is online. But you have to save the data to the disk when the server is shut down.
     
  3. Offline

    ZeusAllMighty11

    Sgt_Tailor


    Hmm... how is this any more efficient than using ItemMeta tags and stuff? o.o
     
  4. TheGreenGamerHD ItemMeta is something entirely different. I use MetaData to store chatPrefix of players inside the player themselves, so I don't have to check what rank they are and such. I can get the prefix straight from the Player itself. You can use MetaData on blocks as well. I made a funny little plugin that created landmines based on that.
     
  5. Offline

    ZeusAllMighty11

    Sgt_Tailor

    Sorry I know what ItemMeta is. I didn't mean what I said.


    I meant, like, if I give an item some meta with a lore tag of "-ttt", and I give another item a metadata with "-ttt", why would it matter if I used either which, because they both will allow checks, but metadata will erase and item meta will not.

    Ehhh



    How would I go about storing metadata? Same as regular storage?
     
  6. Offline

    Minnymin3

    Someone should make it persist through restart! Then that could get rid of all player config files (ie. essentials player config files and permission plugin groups!)
     
  7. Offline

    ZeusAllMighty11



    +1 to this.


    The metadata system is AMAZING and this flaw just makes it not worth using...
    It'd even be fine if they created a simple file in the root folder which contained metadata for ALL plugins that needed it. Or a global metadata database. Something similar.
     
    bobacadodl and Minnymin3 like this.
  8. Offline

    Minnymin3

    Well bukkit creates its own section in the player.dat file so they could at least make it persist on players and they could also make it persist on blocks and mobs because they have their own bukkit section in the level.dat. I really hope someone does this (maybe Il submit a PR for this...)
     
    com. BOY and ZeusAllMighty11 like this.
  9. Offline

    MoonStorm

    Metadata by definition is meant to be persistent. This half baked implementation looks to me like an item/plugin key based cache!
     
    Minnymin3 likes this.
  10. Offline

    ZeusAllMighty11

    Minnymin3

    So Player metadata is persistent?
     
  11. Offline

    Minnymin3

    It is not persistant but Bukkit does create a section that contains sections such as first played and last played, xp to drop, new xp, new level etc. It would not be very difficult to save a bit more data to this file (world/players/username.dat) that could be retrieved. I wonder if this is possible via the API then I could make a playermetadata saving plugin (though a PR would be better)
     
  12. Offline

    Wingzzz

    Take a look this thread that explains a lot about metadata, and to the question at hand... No, metadata is not persistent (like those above had said).
     
  13. I could make an api that can store stuff in MetaData upon start and store it to file upon shutdown.
     
  14. Offline

    Zach_1919

    Sgt_Tailor Well, I thought of that, but say you crafted a really expensive block with metadata and it serves a certain function, then the server crashes and the metadata never gets stored.
     
  15. Offline

    Minnymin3

    Make something that saves all metadata 12 times every tick! That wouldn't lag at all! :p
     
  16. Offline

    Zach_1919

  17. Offline

    MoonStorm

    Metadata must go with the item is referring to. I could go further and say both should be stored in the same physical container, so it would keep things consistent in backup & restore operations. Tile entities for example represent block metadata that can't fit in the block id/data, and they get stored in the region files (wiki link). No one complained they get lost or are saved too often. We should just duplicate that logic.

    However, considering the Bukkit moral standpoint ("oh God forbid we should move a bit further or interfere with the vanilla implementation or its storage containers"), that will never happen.
     
  18. Perhaps we can use nbtTags to store the metadata in the player/item/block
     
    MoonStorm likes this.
  19. Offline

    MoonStorm

    Bingo! I was too afraid to say it. [diamond]
     
Thread Status:
Not open for further replies.

Share This Page