Jump to content
  • 0

[Help] New item handler



So I tried to create an item that when you click it, it gives you an armor part and then it disappears.

It doesn't give me any compile errors and it is clear at the gameserver window as well.

It still doesn't seem to work though,when i press it nothing happens.(although i have registered it)

I'm using the latest rev of l2j.Any help?


* 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 2, 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
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
* http://www.gnu.org/copyleft/gpl.html
package handlers.itemhandlers;

import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.L2Playable;

public class Equipment implements IItemHandler
private static final int[] ITEM_IDS = { 3472 };

public void useItem(L2Playable playable, L2ItemInstance item)
      if (!(playable instanceof L2PcInstance))
      L2PcInstance activeChar = (L2PcInstance)playable;
       int itemId = item.getItemId();
   if (itemId == 3472)
   		    playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
			activeChar.sendMessage("(1) No-grade equipment item disappeared. You have received your no-grade equipment.");
                activeChar.getInventory().addItem("Wooden Helmet", 43, 1, activeChar, null);

    public int[] getItemIds()
    	return ITEM_IDS;

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...