Discussion in 'Plugin Development' started by ZeusAllMighty11, May 28, 2013.
Is metadata persistent? Why does it manage through reloads, but not restarts? :\
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.
Hmm... how is this any more efficient than using ItemMeta tags and stuff? o.o
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.
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.
How would I go about storing metadata? Same as regular storage?
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!)
+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.
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...)
Metadata by definition is meant to be persistent. This half baked implementation looks to me like an item/plugin key based cache!
So Player metadata is persistent?
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)
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).
I could make an api that can store stuff in MetaData upon start and store it to file upon shutdown.
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.
Make something that saves all metadata 12 times every tick! That wouldn't lag at all!
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.
Perhaps we can use nbtTags to store the metadata in the player/item/block
Bingo! I was too afraid to say it.
Separate names with a comma.