Not sure how to approach this one (chest viewer)

Discussion in 'Plugin Development' started by d3x, Mar 10, 2011.

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

    d3x

    I am working on something to show chest contents in a browser. My current design is

    • add xyz and playername to database when a chest is placed
    • after it is interacted with clear what is recorded in database for its contents and log its new contents to database
    • delete chest (and contents) from database when a chest is broke

    anyone have any other ideas or suggestions?
     
  2. Offline

    Bubby4j

    Seems like a good idea, just make sure you make the database efficient. If you need I can help you with the database design, I'm really good with MySQL.
     
  3. Offline

    Lodran

    You'll also want to add a periodic task which validates the database - when worldedit (and other bulk edit plugins) change the world, there are no break events.

    This also begs the question - if controllerblock (or something like it) is swapping a block containing a chest with something else, should the chest data remain in your database, or not?
     
  4. Offline

    d3x

    @Bubby4j

    I will definitely run my table structure/queries past you, thanks for the offer!

    @Lodran

    Good call. When controller block removes/places a chest does its contents remain?
     
  5. Offline

    Bubby4j

    You know, even better then a plugin, would be a standalone application that reads the world files and scans for chests and updates the database. It wouldn't be as live (just as live as the worldsave is) but it would be better.
    [MERGETIME="1299808670"][/MERGETIME]
    You might want to make a plugin that triggers the application to read the world files when the world is done saving. You could then make a web interface to view the chests. Btw, if you want I might could design the interface and/or the PHP/CFML scripts (depending on what you use).
     
  6. Offline

    Lodran

    From what I understand, the controllerblock plugin swaps the contents of cuboids between two states, so I would expect that it would retain the contents of chests as they were swapped in and out.

    One state could contain a chest, and the other none, or one state could contain a chest with one set of contents, and the other contain a chest with different contents.
     
  7. Offline

    d3x

    That could make things very difficult unless chests are assigned some sort of unique id.
    [MERGETIME="1299821168"][/MERGETIME]
    I did think of making it an application as I could avoid the performance hit of using Java and live would be nice but the real problem is I just don't want to get into the nitty grittys of parsing the map files.

    The interface is just one html file with some css/javascript and it gets its data directly from the plugin via a http request that is replied to with a json string.
     
  8. Offline

    Bubby4j

    Okay.
     
  9. Offline

    d3x

    If you are good with HTML/CSS I could use a fancy design. I am not very good at making things look nice :D
     
  10. Offline

    Bubby4j

    I might could make one that looks just like a chest, tell me and I'll start on it ASAP. (ASAP is probably mondayish, maybe late sunday.)
     
  11. Offline

    d3x

  12. Offline

    d3x

    I just realized I have no idea what to do when it comes to double chests, how do they work?!
     
  13. Offline

    eltorqiro

    Have you seen the LWC plugin? It does chest management very well, maybe you could have a look at the code for that (it is used for protection, not content saving, but the management of the chests themselves is quite comprehensive).
     
  14. Offline

    d3x

    Database structure as of now

    I have finished the plugin (I think) and could use some testers before I release it.
     
  15. Offline

    Bubby4j

    Seems pretty good,
    In what way will you query the data? This will be the most important aspect.
     
  16. Offline

    darknesschaos

    you could use plaintext, if I remember correctly php handles plaintext, if not, ignore this post XD
     
  17. Offline

    d3x

    newest DB schema
    queries
     
  18. Offline

    Bubby4j

    That is a good way to query, the only thing I see is that you don't have indexes on the fields you are querying, add indexes to the fields you are querying.
     
  19. Offline

    d3x

    What fields do I query that I don't have an index on? I don't see any..
     
  20. Offline

    Bubby4j

  21. Offline

    d3x

    KEY does not create indexes?
     
Thread Status:
Not open for further replies.

Share This Page