Guest User

Xp Giver Problem

a guest
Dec 26th, 2014
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.96 KB | None | 0 0
  1. /*
  2.  * This program is free software: you can redistribute it and/or modify it under
  3.  * the terms of the GNU General Public License as published by the Free Software
  4.  * Foundation, either version 3 of the License, or (at your option) any later
  5.  * version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful, but WITHOUT
  8.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10.  * details.
  11.  *
  12.  * You should have received a copy of the GNU General Public License along with
  13.  * this program. If not, see <http://www.gnu.org/licenses/>.
  14.  */
  15.  
  16.  
  17. package com.l2jfrozen.gameserver.handler.itemhandlers;
  18.  
  19. import com.l2jfrozen.Config;
  20. import com.l2jfrozen.gameserver.handler.IItemHandler;
  21. import com.l2jfrozen.gameserver.datatables.SkillTable;
  22. import com.l2jfrozen.gameserver.model.L2Skill;
  23. import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
  24. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
  26.  
  27. public class XpGiver implements IItemHandler
  28. {
  29.        private static final int[] ITEM_IDS =
  30.         {
  31.            1111
  32.         };
  33.  
  34. public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  35.     {
  36.  
  37.              if (!(playable instanceof L2PcInstance))
  38.                 return;
  39.              L2PcInstance activeChar = (L2PcInstance)playable;
  40.              
  41.            
  42.           if(activeChar.isInOlympiadMode())
  43.           {
  44.              activeChar.sendMessage("You can't you this in Olympiad!");
  45.           }
  46.  
  47.           else
  48.           {
  49.              activeChar.addLevel(1);
  50.              playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
  51.              activeChar.broadcastUserInfo();
  52.              activeChar.sendSkillList();
  53.           }
  54.      
  55.     }
  56.  
  57.  
  58.   public int[] getItemIds()
  59.     {
  60.        return ITEM_IDS;
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment