diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java index 04bf71da2c..f83068268b 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 01a48d82d8..2d248a47cf 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java index 04bf71da2c..f83068268b 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 01a48d82d8..2d248a47cf 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java index 04bf71da2c..f83068268b 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 01a48d82d8..2d248a47cf 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java index 04bf71da2c..f83068268b 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 01a48d82d8..2d248a47cf 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 7aecc69ad0..f6108a6173 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 344826973a..d935b635f1 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 344826973a..d935b635f1 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 344826973a..d935b635f1 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 044db2322b..16d5df32e8 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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) diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 044db2322b..16d5df32e8 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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) diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 4a80a358cb..06037641b1 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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) diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java index 18787f149a..6cf11ef0ee 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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), diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 803a8042a2..679a807cdc 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java index 3c8909d635..b66dfcb17a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 01a48d82d8..2d248a47cf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java index 3c8909d635..b66dfcb17a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 01a48d82d8..2d248a47cf 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java index 3c8909d635..b66dfcb17a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index af8d094c49..188c1526c4 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 506a920b4d..678e14dc5a 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 506a920b4d..678e14dc5a 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 506a920b4d..678e14dc5a 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()); } } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java index a81d6adf6c..15398162de 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 4525517ddb..166e047163 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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)) { diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 990e7f91a0..6256cc7d88 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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)) { diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 2c12de214e..18e7ec37ac 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()) { diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 2c12de214e..18e7ec37ac 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()) { diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/EventType.java index cea88eef7f..0e09874abe 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -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 diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java new file mode 100644 index 0000000000..8644ed64a7 --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/events/impl/item/OnItemUse.java @@ -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 . + */ +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; + } +} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index faa5b67eb0..8d5d5be631 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -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()) {