Inventory Management

Discussion in 'Spigot Plugin Development' started by WillFTW, May 1, 2017.

  1. Hello, I'm working on a plugin and I've been having some trouble going about my inventory management. Currently my system is like this:

    public class Inventories {

    //ex
    public Inventory getInventoryExample() {
    return null;
    }
    }

    public class ListenerClass implements Listener() {

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
    Inventories inv = new Inventories();

    if (p.hasCorrectItem) {

    p.openInventory(inv.getINventoryExample()) ;
    }

    }

    }


    Is this efficient? (I realized if I instance it on the event it might be inefficient), what is the best solution.
     
  2. Hey,
    if you do not save data for every gui, you don't need a constructor. You can get the gui by a simple method.