Howto keep entity-related data between server restarts

Discussion in 'Plugin Development' started by Fipil, Feb 12, 2012.

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

    Fipil

    Hi!
    Please I'm working on some plugin related to Minecarts.
    I work with some data structure, related to each minecart instance. And I need to keep the data between server restarts.
    I thought that I can use the entityId returned by the Entity.getEntityId(). Then I'll save the related data to a data file and associate it with the entityId.
    But it seems that the entity id's are not constant between server restarts and are generated again during server start, so the minecart instances have different id's than before.
    Please is there any unique entity id, that's constant for the whole entity life-cycle, no matter that server restarts or not?

    Only idea I have for now is to asociate the minecart data with a Location of minecart just in time of shutting down server. Then when server is starting, I'll check these locations and if there is a minecart on the location, I'll assign the saved data associated with the location to the minecart.

    Has anyone better idea how to do that?
    Thanks!
     
  2. Offline

    Njol

  3. Offline

    Fipil

    Yes! It works! Thanks a lot!:)
     
Thread Status:
Not open for further replies.

Share This Page