Hello, First off, the code i am using: Code:java if(cmd.getName().equalsIgnoreCase("itemme")){ if (s instanceof Player){ Player player = (Player)s; PlayerInventory inv = player.getInventory(); String i = args[0]; ItemStack item = new ItemStack(Material.i, 1); } What i am trying to do i get the argument from a command, and then use that argument to create an itemstack which will then be given to the user. now on line 7, more specifically "Material.i" i am getting an error: "i cannot be resolved or is not a field." So, how could i make this work? Thanks, Anerdson
Code: ItemStack item =new ItemStack(Material.args[0], 1); and one thing the player need to do it in caps /itemme IRON_SWORD to fix this you need to make a enum
RawCode Most people here are new to java, welcome to bukkit Funergy No. Try this: Code:java if(cmd.getName().equalsIgnoreCase("itemme")){if (s instanceof Player){Player player = (Player)s;PlayerInventory inv = player.getInventory();String i = args[0]; ItemStack item = new ItemStack(Material.matchMaterial(i), 1); Be careful however, and read the documentation on the Material#matchMaterial(String) method: http://jd.bukkit.org/rb/apidocs/org/bukkit/Material.html#matchMaterial(java.lang.String) Also consider reading the actual implementation of the method: http://jd.bukkit.org/rb/apidocs/src-html/org/bukkit/Material.html#line.595 Finally, learn more about how enumeration types work here: http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html