Accessing multiple ItemStacks from an ItemStack storage class.

Discussion in 'Plugin Development' started by TheManiacGamers, Apr 8, 2016.

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

    TheManiacGamers

    Hello everyone of the bukkit forums!

    I would like to be able to obtain my ItemStacks from a single storage class;

    E.G.

    Code:
            ItemStack NextPage = new ItemStack(Material.ARROW, 1);
            ItemMeta NextPageMeta = NextPage.getItemMeta();
            NextPageMeta.setDisplayName(ChatColor.GRAY + ">>>" + ChatColor.RED + "" + ChatColor.BOLD + "Next page" + ChatColor.GRAY + ">>>");
            List<String> NextPageLore = new ArrayList<String>();
            NextPageLore.add(ChatColor.DARK_PURPLE + "Click me to go to the next page!");
            NextPageLore.add(ChatColor.BLUE + "Clicky Clicky!");
            NextPageMeta.setLore(NextPageLore);
            NextPage.setItemMeta(NextPageMeta);
    I have this item stack
    I would like to put this ItemStack into a class called "AchItems, with a bunch of other ItemStacks, where I can access this from multiple amounts of other classes. Please help :)
     
  2. Offline

    CraftCreeper6

  3. Offline

    Gonmarte

    He doesnt mean that, i think he means using constructors and static. Thats why i said that, dont blame me if i get it wrong.
    It was not needed @timtower , you are a bad boy! joke :-: But it was really not needed.
     
    Last edited: Apr 8, 2016
  4. Offline

    CraftCreeper6

    @Gonmarte
    He said he wanted a storage class, he wasn't very specific.
     
  5. Offline

    TheManiacGamers

    Yes Yes, It was just an example i quickly did, I'll change that later and "freshen it up"

    I just want to know how to access the ItemStack from a different class, in which, Is something I do not know how to do,

    Yes @Gonmarte, you're right, I do mean using constructors and static

    Sorry @CraftCreeper6.
    I mean a storage class that contains all of the *entirely made ItemStacks* so I can just inv.setItem(3, new ItemStack(AchItems.*itemstackname*));

    if you know what I mean?
     
  6. Offline

    Gonmarte

    Thats why i said to him to take a look at java again, but @timtower though i was attacking him... but i wasnt. I was being honest.....

    @TheManiacGamers You learn this when you "learnt" java, if you did. If not, i would advice you to do here - http://docs.oracle.com/javase/tutorial/
     
  7. Offline

    CraftCreeper6

  8. Offline

    Gonmarte

    You can create a new instance of your class also.
    Take a look at here - http://www.tutorialspoint.com/java/java_object_classes.htm
     
Thread Status:
Not open for further replies.

Share This Page