Paste this
else if (command.startsWith("admin_mass_create"))
{
try
{
String val = command.substring(17);
StringTokenizer st = new StringTokenizer(val);
if (st.countTokens()== 2)
{
String id = st.nextToken();
int idval = Integer.parseInt(id);
String num = st.nextToken();
int numval = Integer.parseInt(num);
massCreate(activeChar,idval,numval);
}
else if (st.countTokens()== 1)
{
String id = st.nextToken();
int idval = Integer.parseInt(id);
massCreate(activeChar,idval,1);
}
}
catch (StringIndexOutOfBoundsException e)
{
activeChar.sendMessage("Usage: //itemcreate <itemId> [amount]");
}
catch (NumberFormatException nfe)
{
activeChar.sendMessage("Specify a valid number.");
}
}
return true;
}
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
private boolean checkLevel(int level)
{
return (level >= REQUIRED_LEVEL);
}
private void createItem(L2PcInstance activeChar, int id, int num)
{
if (num > 20)
{
L2Item template = ItemTable.getInstance().getTemplate(id);
if (!template.isStackable())
{
activeChar.sendMessage("This item does not stack - Creation aborted.");
return;
}
}
activeChar.getInventory().addItem("Admin", id, num, activeChar, null);
ItemList il = new ItemList(activeChar, true);
activeChar.sendPacket(il);
activeChar.sendMessage("You have spawned " + num + " item(s) number " + id + " in your inventory.");
}
private void massCreate(L2PcInstance activeChar, int id, int num)
{
for (L2PcInstance _players : L2World.getInstance().getAllPlayers())
{
if (_players == activeChar) continue;
_players.getInventory().addItem("Admin", id, num, _players, null);
ItemList il = new ItemList(_players, true);
_players.sendPacket(il);
}
activeChar.sendMessage("You have spawned " + num + " item(s) number " + id + " in all chars inventory.");
}
}