Uniquely identifying an Inventory?

Discussion in 'Plugin Development' started by ZephireNZ, Feb 27, 2014.

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

    ZephireNZ

    I want to be able to tell when a player opens/closes a certain (virtual) inventory.

    I've tried saving the Inventory object in an array, but through a variable debugger, I can see that the object gets changed between the two events happening. I've also had a look at most of the methods, and haven't seen one that jumped out as being a unique way of identifying them.

    I know in the past people used the inv.getName(), but now that you can rename a chest whatever, that's quite useless.
     
  2. Offline

    xize

    ZephireNZ
    I'm not sure if its the same as inventory.getName() but what if you do inventory.getTitle() and compair the titles with .equals or .equalsIgnoreCase + with color checks?
     
  3. Offline

    MooshViolet

    Maybe when they open it, rename the chest to their player name, and then display that or something
     
  4. Offline

    ZephireNZ

    xize I think that colour idea could be good. Have a specific sequence of colours that relate to the type of chest, which would be invisible to the player. The players wouldn't be able to find it easily and rename a chest, but it means I can easily compare it with a static variable.

    I'll try that out, and report back!
     
Thread Status:
Not open for further replies.

Share This Page