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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
### 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.
1 2 3 4 |
if (item.isEquipped()) continue; |
Don’t forget add return link to this blog if you will be use this on other resource. Have fun!