L2JMobius

Aztacan's Temple Admin Command to wipe target's inventory

Acacia · 4 · 236

Offline Acacia

  • Vassal
  • *
    • Posts: 2
Might be useful for someone (:
Works on any Chronicle

Code: [Select]
package handlers.admincommandhandlers;

import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.item.instance.Item;

public class AdminWipe implements IAdminCommandHandler {

    private static final String[] ADMIN_COMMANDS = {    "admin_wipe"    };

    @Override
    public String[] getAdminCommandList() { return ADMIN_COMMANDS;  }

    @Override
    public boolean useAdminCommand(String command, Player activeChar)
    {
        WorldObject target = activeChar.getTarget();

        if (target == null) {
            activeChar.sendMessage("Incorrect target");
            return false;
        }

        Player player = target.getActingPlayer();

        if (player == null || !player.isPlayer())
        {
            activeChar.sendMessage("Incorrect target");
            return false;
        }

        if (command.equalsIgnoreCase("admin_wipe")) {

            for (Item item : player.getInventory().getItems())  {

                if (item.isEquipped() || item.getId() == 57 || item.getId() == 97145 || item.getId() == 91663)  {
                    continue;
                }
                player.destroyItem("admin_wipe" , item , activeChar , true);
            }
            activeChar.sendMessage("Target's inventory has been cleared");
            player.sendMessage("Inventory has been cleared");

            return true;
        }
        return false;
    }
}

add to MasterHandler.java

Code: [Select]
AdminVitality.class,
+AdminWipe.class,
We are phantoms that cannot exist anywhere
We are phantoms with no identity


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 338
Thanks for sharing. It would be much better if you could add this in a config file, allowing the admin to edit the item whitelist (like 57, 97145, etc) and also create a seperate command that deletes all the equiped items too.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16236
Thanks for sharing. It would be much better if you could add this in a config file, allowing the admin to edit the item whitelist (like 57, 97145, etc) and also create a seperate command that deletes all the equiped items too.
Or just use //destroy items for GMs.


Offline Acacia

  • Vassal
  • *
    • Posts: 2
Or just use //destroy items for GMs.

Oh didn't notice it's existed so i made that up :')
We are phantoms that cannot exist anywhere
We are phantoms with no identity