Addition of OnItemUse event.

This commit is contained in:
MobiusDevelopment 2022-05-17 21:27:25 +00:00
parent f7c642df3f
commit 2cbec40c98
69 changed files with 1380 additions and 0 deletions

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -286,6 +288,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -286,6 +288,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -286,6 +288,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -286,6 +288,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -283,6 +285,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -292,6 +294,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -292,6 +294,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -292,6 +294,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -36,6 +36,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -294,6 +296,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
// TODO: New item handler for minerals.
if (VariationData.getInstance().getVariation(_itemId) != null)

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -36,6 +36,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -294,6 +296,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
// TODO: New item handler for minerals.
if (VariationData.getInstance().getVariation(_itemId) != null)

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -36,6 +36,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -294,6 +296,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
// TODO: New item handler for minerals.
if (VariationData.getInstance().getVariation(_itemId) != null)

View File

@ -127,6 +127,7 @@ import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemEnchantAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemSoulCrystalAdd;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -182,6 +183,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
ON_ITEM_ATTRIBUTE_ADD(OnItemAttributeAdd.class, void.class),
ON_ITEM_SOUL_CRYSTAL_ADD(OnItemSoulCrystalAdd.class, void.class),

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -36,6 +36,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -294,6 +296,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
// TODO: New item handler for minerals.
if (VariationData.getInstance().getVariation(_itemId) != null)

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -286,6 +288,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -286,6 +288,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -124,6 +124,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -179,6 +180,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -283,6 +285,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -292,6 +294,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -292,6 +294,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -292,6 +294,9 @@ public class UseItem implements IClientIncomingPacket
player.addTimeStampItem(item, reuseDelay);
sendSharedGroupUpdate(player, sharedReuseGroup, reuseDelay, reuseDelay);
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
}
}

View File

@ -123,6 +123,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -178,6 +179,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -35,6 +35,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -284,6 +286,9 @@ public class UseItem implements IClientIncomingPacket
{
PacketLogger.warning("Unmanaged Item handler: " + etcItem.getHandlerName() + " for Item Id: " + _itemId + "!");
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
else if (handler.useItem(player, item, _ctrlPressed))
{

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -38,6 +38,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -295,6 +297,9 @@ public class UseItem implements IClientIncomingPacket
{
PacketLogger.warning("Unmanaged Item handler: " + etcItem.getHandlerName() + " for Item Id: " + _itemId + "!");
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
else if (handler.useItem(player, item, _ctrlPressed))
{

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -39,6 +39,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -278,6 +280,9 @@ public class UseItem implements IClientIncomingPacket
player.sendPacket(sm);
return;
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
if (player.isCastingNow())
{

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -39,6 +39,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -278,6 +280,9 @@ public class UseItem implements IClientIncomingPacket
player.sendPacket(sm);
return;
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
if (player.isCastingNow())
{

View File

@ -126,6 +126,7 @@ import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChang
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeFinish;
import org.l2jmobius.gameserver.model.events.impl.sieges.OnCastleSiegeOwnerChange;
@ -181,6 +182,7 @@ public enum EventType
// Item events
ON_ITEM_BYPASS_EVENT(OnItemBypassEvent.class, void.class),
ON_ITEM_CREATE(OnItemCreate.class, void.class),
ON_ITEM_USE(OnItemUse.class, void.class),
ON_ITEM_TALK(OnItemTalk.class, void.class),
// NPC events

View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.item;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class OnItemUse implements IBaseEvent
{
private final Player _player;
private final Item _item;
public OnItemUse(Player player, Item item)
{
_player = player;
_item = item;
}
public Player getPlayer()
{
return _player;
}
public Item getItem()
{
return _item;
}
@Override
public EventType getType()
{
return EventType.ON_ITEM_USE;
}
}

View File

@ -39,6 +39,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
@ -278,6 +280,9 @@ public class UseItem implements IClientIncomingPacket
player.sendPacket(sm);
return;
}
// Notify events.
EventDispatcher.getInstance().notifyEventAsync(new OnItemUse(player, item), item.getTemplate());
}
if (player.isCastingNow())
{