Solved Creating custom loot inventories

Discussion in 'Plugin Development' started by Minermax7, Dec 26, 2014.

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

    Minermax7

    Hey guys,
    I am developing a sort of rewards plugin per say, well. It includes random rewards on achieving a certain point.
    I have completed the majority of the plugin, but I still need to setup the loots.

    How would I be able to list a ton of items they could get, and store them in an inventory. And every time that inventory is accessed, the contents of the chest are different.

    P.S. I am not asking to be spoon-fed code, I just need how I would be able to do it.

    Thanks!
     
  2. Offline

    Skionz

    @Minermax7 Create an ItemStack array and fill it with a shit ton of ItemStacks. Then to select a random one simple use Java's Random class like this:
    Code:
    Random r = new Random();
    ItemStack item = myArray[r.nextInt(myArray.length)];
     
    Minermax7 likes this.
  3. Offline

    Minermax7

    Well said! xD
    Will get to work on it now.
     
    Skionz likes this.
Thread Status:
Not open for further replies.

Share This Page