Best way of creating/storing kits?

Discussion in 'Plugin Development' started by qlimax5000, Apr 21, 2014.

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

    qlimax5000

    I wanna make kits for a plugin but what would be the best way of doing this, i want 1 class per kit. Maybe i could even have the kits listeners in the same class?

    Thanks
    - Ben
     
  2. Offline

    CraftedShack

    The best way to do this is with object oriented programming. In my opinion.

    Here is an example:

    Code:java
    1. class Kit {
    2. public String name;
    3. public Inventory inv;
    4.  
    5. public Kit(String name, List<ItemStack> items) {
    6. this.name = name;
    7. this.inv = Bukkit.createInventory(null, 54, name);
    8. for (ItemStack is: items) {
    9. this.inv.addItem(is);
    10. }
    11. }
    12. }


    You can do:
    Kit kit = new Kit(nameOfKit, ListOfItems);
    to create a new Kit.
     
Thread Status:
Not open for further replies.

Share This Page