Solved Inventory

Discussion in 'Spigot Plugin Development' started by bys1, Jun 10, 2016.

Thread Status:
Not open for further replies.
  1. What is the difference between Inventory#getName and Inventory#getTitle?
     
  2. Not sure but i think they return the same String, the only thing i found out it that in some cases you can call both methods and in others just the getTitle one.
     
    • Like Like x 1
  3. After decompiling the Spigot API and hunting around a bit, because I've been curious of this too, I found that getTitle(); and getName(); return the same thing. So it does not seem like there is any difference at the moment. Maybe in the future they will make it so you can give a bunch of inventories the same title, but give them all different names to identify them. However, at the moment, there is no difference.
     
  4. Code (Text):
    public class CraftInventory implements Inventory {
        protected final IInventory inventory;

        public IInventory getInventory() {
            return inventory;
        }
        public String getName() {
            return getInventory().getName();
        }
        public String getTitle() {
            return inventory.getName();
        }
    }

     
     
  5. That's the one :)
     
  6. Thank you, solved.
     
Thread Status:
Not open for further replies.