Solved Set Inventory owner to null?

Discussion in 'Plugin Development' started by Gonmarte, Apr 27, 2016.

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

    Gonmarte

    I need to set the inventory owner to null, i have already tested it and its working fine.
    Im just wondering if it will cause any future trouble/problem/bug , anything evil :p

    Thanks!!
     
  2. Offline

    Zombie_Striker

    @Gonmarte
    But why?
     
    mine-care likes this.
  3. Offline

    Gonmarte

    Im creating my own inventory object, and its not for each player have one. So it wouldnt have a player as owner.
     
  4. Offline

    WolfMage1

    Bukkit#createInventory(null, ...)?
     
  5. Offline

    Gonmarte

    Read the main post please :)
     
  6. Offline

    WolfMage1

    Find out :p
     
  7. Offline

    Zombie_Striker

    @Gonmarte
    @WolfMage1 Is correct, if you do not mean creating a custom inventory class. That "null" in the parameters represents the 0wner. If you are creating a custom inventory class, you would need to set the owner to null inside the constructor.

    BTW: Who the owner is should not mean anything to the plugin. If you want each player to have their own inventory, create a new inventory for each player.
     
    Gonmarte likes this.
  8. Offline

    Gonmarte

    Im creating a custom inventory class and i have already putted null inside the constructor.
    Code:
        public <Class>(String name , int slots){
            this.name = name;
            this.slots = slots;
            this.inv = Bukkit.createInventory(null, slots, name);
            //doesnt matter below
        }
    
    So it is correct right?
     
  9. Offline

    Zombie_Striker

  10. Offline

    Gonmarte

    Thanks!!
     
Thread Status:
Not open for further replies.

Share This Page