diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml b/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml index 2cd619a4f0..8d5eae3719 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml @@ -115,6 +115,12 @@ + + + + + + diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java index d477f43810..09454b83ed 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminCreateItem; import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminCursedWeapons; import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminDMEngine; import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminDelete; +import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminDestroyItems; import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminDonator; import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminDoorControl; import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminEditChar; @@ -114,6 +115,7 @@ public class AdminCommandHandler registerAdminCommandHandler(new AdminCTFEngine()); registerAdminCommandHandler(new AdminCursedWeapons()); registerAdminCommandHandler(new AdminDelete()); + registerAdminCommandHandler(new AdminDestroyItems()); registerAdminCommandHandler(new AdminDMEngine()); registerAdminCommandHandler(new AdminDonator()); registerAdminCommandHandler(new AdminDoorControl()); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDestroyItems.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDestroyItems.java new file mode 100644 index 0000000000..e7caf32041 --- /dev/null +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDestroyItems.java @@ -0,0 +1,61 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.handler.admincommandhandlers; + +import org.l2jmobius.gameserver.handler.IAdminCommandHandler; +import org.l2jmobius.gameserver.model.PlayerInventory; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; + +/** + * @author Mobius + */ +public class AdminDestroyItems implements IAdminCommandHandler +{ + private static final String[] ADMIN_COMMANDS = + { + "admin_destroy_items", + "admin_destroy_all_items", + "admin_destroyitems", + "admin_destroyallitems" + }; + + @Override + public boolean useAdminCommand(String command, PlayerInstance activeChar) + { + final PlayerInventory inventory = activeChar.getInventory(); + final InventoryUpdate iu = new InventoryUpdate(); + for (ItemInstance item : inventory.getItems()) + { + if (item.isEquipped() && !command.contains("all")) + { + continue; + } + iu.addRemovedItem(item); + inventory.destroyItem("Admin Destroy", item, activeChar, null); + } + activeChar.sendPacket(iu); + return true; + } + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } +}