Jump to content

Saving data to player without being lost on death


DarkGuardsman

Recommended Posts

I have a few mods i've been developing for keep player scores and simple data like home teleport locations. The issue i'm having is the data saved to the player is lost when the player dies. For something this is not so bad however for my kill and death counters this kills things. The only thing i can think of at the moment, which i'm trying out, is to catch the player's data before death, store, and then resave it. This most likely will work however is a bit around the issue and will break down the road.

Link to comment
Share on other sites

You could just keep a server side HashMap. You wouldn't really need to save it either if you do it right, do a redundancy system, where info is stored to the player and the map, and if either is null, restore with what the other has. This would allow you to get away with not actually saving the mapped data entirely.

Link to comment
Share on other sites

Save it to the world's NBT?

i'm trying to avoid saving to a custom NBT file. Really want to see if i can just save to the player first though i'm already working on a backup plan.

 

You could just keep a server side HashMap. You wouldn't really need to save it either if you do it right, do a redundancy system, where info is stored to the player and the map, and if either is null, restore with what the other has. This would allow you to get away with not actually saving the mapped data entirely.

I have yet to use a hashMap in programming but good idea to have a way to check to make sure the data matches. I might make a system after i'm done to catch cheating/hacks to cause players stats to go up. However, i do need to save since i will be copying data between servers. 

Link to comment
Share on other sites

You misunderstand, I meant save it to the world itself, as part of the world's NBT .dat, not your own.

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.