Every time after something was tested on the server, the admin accumulates unnecessary items in the inventory that require a lot of time to be removed. This little addon is cleanup self inventory. Ignores only Adena.
### Eclipse Workspace Patch 1.0 #P aCis_datapack Index: data/xml/admin_commands_rights.xml =================================================================== --- data/xml/admin_commands_rights.xml (revision 0) +++ data/xml/admin_commands_rights.xml (working copy) @@ -184,6 +184,9 @@ <aCar name="admin_invul" accessLevel="1" /> <aCar name="admin_setinvul" accessLevel="1" /> + <!-- INVENTORY --> + <aCar name="admin_inventory_cleanup" accessLevel="5" /> + <!-- KICK --> <aCar name="admin_character_disconnect" accessLevel="1" /> <aCar name="admin_kick" accessLevel="1" /> #P aCis_gameserver Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminCreateItem.java =================================================================== --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminCreateItem.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminCreateItem.java (working copy) @@ -10,7 +10,9 @@ import net.sf.l2j.gameserver.model.World; import net.sf.l2j.gameserver.model.actor.instance.Player; import net.sf.l2j.gameserver.model.item.ArmorSet; +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; import net.sf.l2j.gameserver.model.item.kind.Item; +import net.sf.l2j.gameserver.model.itemcontainer.PcInventory; import net.sf.l2j.gameserver.network.serverpackets.ItemList; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; @@ -31,7 +33,8 @@ "admin_create_item", "admin_create_set", "admin_create_coin", - "admin_reward_all" + "admin_reward_all", + "admin_inventory_cleanup" }; @Override @@ -44,6 +47,20 @@ { AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm"); } + else if (command.equals("admin_inventory_cleanup")) + { + PcInventory inventory = activeChar.getInventory(); + for (ItemInstance item : inventory.getItems()) + { + if (item.getItemId() == 57) + continue; + + inventory.destroyItem("Destroy Item", item, activeChar, null); + } + + activeChar.sendPacket(new ItemList(activeChar, false)); + activeChar.sendMessage("Inventory was cleanup."); + } else if (command.equals("admin_reward_all")) { try[/code]
If added this inside FOR cycle, then all equipped items will be skipped.
if (item.isEquipped()) continue;
Don’t forget add return link to this blog if you will be use this on other resource. Have fun!