Would this work?

Discussion in 'Plugin Development' started by XgXXSnipz, Jan 22, 2015.

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

    XgXXSnipz

    @Skionz pseudo code? and am I on right track?
     
  2. Offline

    Skionz

    @XgXXSnipz You need to understand basic Java for this. It is not a very complex topic and all you need to do is create a new List that has ItemStack as it's generic type. Then add a bunch of ItemStacks to it and use the Random class to select a random one.
     
  3. Offline

    XgXXSnipz

    @Skionz im very confused right now :'(
    :rolleyes::oops::p
     
  4. Offline

    ZanderMan9

    @Skionz For that matter, it doesn't even need to be a List. It can just be an array, since what he's doing is very simple. Although, I do recommend a List. You'd make a list like this:
    Code:
    List<type goes here, e.g. String> name = new ArrayList<type>();
     
    Skionz likes this.
  5. Offline

    Skionz

    I will explain using this example.
    Code:
    List<Integer> list = new ArrayList<Integer>();
    The portion between the greater then and less then characters represents the generic type which is Integer. You may be wondering what the fuck an Integer is, but I will explain. Java generics do not support primitives so we have to use the wrapper class Integer.
    The new keyword creates a new instance of the class specified after it. Simply declaring and not initializing something results in a default null value.
     
  6. Offline

    ColonelHedgehog

    Er, you can't really make pseudo code for something that needs a specific syntax. :p
     
  7. Offline

    SuperOriginal

    @XgXXSnipz That is 1 item. Make a list and add that to it, along with others

    Edit... Didn't refresh the page...
     
Thread Status:
Not open for further replies.

Share This Page