why this doesnt work?: Code: if(args.length <= 1) { p.sendMessage("§cBitte benutze: /spawner <anzahl> <type>"); } else if(args.length == 2) { EntityType type = EntityType.valueOf(args[1].toUpperCase()); if (type != null) { ItemStack item = getSpawnerItem(Integer.valueOf(args[0]).intValue(), type); p.getInventory().addItem(new ItemStack[] { item }); } else { p.sendMessage("§cUnbekanntes Entity: " + args[0]); } } else { p.sendMessage("§cBitte benutze: /spawner <anzahl> <type>"); } private ItemStack getSpawnerItem(int amount, EntityType type) { ItemStack item = new ItemStack(Material.MOB_SPAWNER, amount); List lore = new ArrayList(); String loreString = type.toString(); loreString = type.getName() + " Spawner"; lore.add(loreString); ItemMeta meta = item.getItemMeta(); meta.setLore(lore); item.setItemMeta(meta); return item; }
I don't know if you can actually change the spawner type in the itemstack but you can when the spawner is placed, set the entity type based on the lore... http://jd.bukkit.org/rb/doxygen/dc/ddd/interfaceorg_1_1bukkit_1_1block_1_1CreatureSpawner.html