Inventory Logging

Discussion in 'Archived: Plugin Requests' started by 15987632, Oct 31, 2013.

  1. Offline

    15987632

    Plugin category: Admin tools, Anti greif

    Suggested name: Inventory logger

    What I want: I would like a inventory logging/rollback plugin. I would love you if you could make it and extension for logblock as this is the rollback and logging plugin i currently use. commands and permissions don't have to be this. this is just what i would prefer. It would log the inventory on logins, logouts, and every minute.

    Ideas for commands:
    [brackets rare needed] (parenthesis are optional)
    /lb lookup inventory player [player] since (time ex 1d, 1m(minute is lowercase), 1M(month is uppercase))

    /lb inventory rollback player (player) since (time)

    Ideas for permissions: Logblock.inventory


    When I'd like it by: im in no rush but would like it as soon as possible
     
  2. Offline

    15987632

    24 hours bump

    timtower you seem to know a lot about plugins is this possible or already made?
     
  3. Online

    timtower Administrator Administrator Moderator

    Possible: Yes
    Already made: Not that I know of
    Why? This would require loads of logging, every item that gets crafted needs to be updated into the database ( would grow huge really quick )
    Timed logging wouldn't be as accurate but it will increase server performance
     
  4. Offline

    15987632

    What about if it logged the inventory like every min would that make it more reasonable?
     
  5. Online

    timtower Administrator Administrator Moderator

    Would be more reasonable and easier to use for sure.
     
  6. Offline

    15987632

    thanks i updated thread
     
    timtower likes this.
  7. Offline

    15987632

    bump 24 hours
     
  8. Offline

    15987632

    bump 45 mins less than 24 hours whatever :p
     
  9. Sounds reasonably simple- I'll whip up a prototype in a bit. Properly saving data and whatnot will take a little more dev time, however.
     
  10. Offline

    15987632

    Ok thank i would appreciate it :D
     
  11. Just an update to confirm that I'm not just playing Minecraft all day:

    The plugin is mostly complete. It autosaves everyone's inventory every 60 seconds, then writes to a log file every 10 minutes (configurable). It also writes to a different directory every day (also configurable). It handles both inventory and armor and should be able to deal with empty slots properly.

    All that's left is to do some serious bugtesting and to implement a file-reader so that old saves can be examined and used.
     
  12. Offline

    15987632

  13. 15987632 Another update fpr ya'. The file loading procedure now works and can rollback a player's inventory by typing a command like this:

    /invlog rollback [playername] yyyy-MM-dd HH-mm-ss

    You can also leave the time unspecified. Either way, it picks the closest log file it can find to the specified date and time, then loads it and searches for the player's name. If the name is found, it then rolls the player's inventory back to the way it was at that time.

    I still need to account for enchantments, however- that may prove more difficult than merely getting item types and quantities.
     
  14. Offline

    15987632

    Ok thank you if there some type of proto type or are you waiting to realise it all at once? But thank you for all your work

    Someguyfromcrowd if you could add a lookup feature so you can just look and not rollback that would be cool also. And another thing if you could add an undo command in case you mess up :p
     
  15. Offline

    15987632

    @somegufromcrowd any progress?
     

  16. Quite a bit, actually. I'm currently working on a way to check a player's inventory before rolling it back. I'm also planning out a way to clean up old log files and send a few to an archive directory for long-term storage.

    Item metadata is still going to be tricky, though. I'm looking into ways to deal with that.

    I should have a stable build up sometime tomorrow morning- I'll let you know when.
     
  17. Offline

    15987632

  18. [quote uid=90878720 name="15987632" post=1993476]Someguyfromcrowd is that build coming along nicely?[/quote]


    Apologies for the delay- finals week is looming and I've been short on free time.

    You can check out a beta build <Edit by Moderator: Redacted mediafire url>

    /invlog check <name> <date> [optional time] will display the save file closest to the given date/time. If no time is given, it's assumed to be midnight. Note that dates and times must be formatted as yyyy-MM-dd hh-mm-ss

    /invlog rollback <name> <date> [optional time] is similar but sets the player's inventory to the saved inventory.

    I still have a lot of work to do:
    * Saving a text file for every single save is a bit unwieldy. It needs to either garbage-collect after a set time (saving some backups) or write to a single file.
    * Entering dates is difficult at best. I'd like to make it interpret things like "yesterday" and "december 4th".
    * Items don't keep their enchantments. This will be a bit tricky to deal with.
    * Damage values aren't saved yet, so tools will get repaired upon a rollback.
    * Loading files consumes a fair bit of time, which I'm afraid is blocking (freezes the server). It only takes ~1 second, but that's still noticeable. Consolidating the saves will mitigate this problem.
    * An undo feature would go a long way to preventing accidental loss of items.

    I'll keep working on this in my off hours. With some luck it should be done by next week.
     
    Last edited by a moderator: Nov 4, 2016
  19. Offline

    Garris0n

    Someguyfromcrowd That's going to rack up ridiculous amounts of files...you should switch to a database.
     

  20. That's my longer-term plan. I'm currently researching how to implement such a thing, which'll take a little bit of time.
     
  21. Offline

    15987632

    Someguyfromcrowd ya I would love to use MySQL if you could
     

  22. I'll look into that. Doesn't look particularly scary to use.
     
  23. Offline

    15987632

    :D
     
  24. Offline

    15987632

    How's the MySQL coming along?
     

  25. I'm picking up on it pretty well. I'll probably try it out in Java tomorrow and then integrate it into the plugin over the next few days.
     
  26. Offline

    15987632

    Nice and sorry if I am annoying you with these posts I'm just trying to remind you about this request as I know you have a lot of projects. Just say the word and I won't ask about this anymore assuming you won't forget and will post updates here :D
     

  27. It's alright- I do need reminders to keep working on things or they tend to fall by the wayside!
     
  28. Offline

    15987632

  29. Offline

    bgsteiner

    Prism is a good logging plugin that can log pretty much anything it doesn't have inventory tracking per say but t does track item drops and pickups so you could use that for tracking. It also has an api so a plugin could be written that takes that data and uses it to keep a master record of inventories.
     

Share This Page