Addition of EventDispatcher hasListener methods.
This commit is contained in:
		| @@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.actor.Summon; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.Pet; | ||||
| import org.l2jmobius.gameserver.model.events.EventDispatcher; | ||||
| import org.l2jmobius.gameserver.model.events.EventType; | ||||
| import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; | ||||
| import org.l2jmobius.gameserver.network.SystemMessageId; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.PetStatusShow; | ||||
| @@ -79,7 +80,10 @@ public class PetAction implements IActionHandler | ||||
| 					player.sendPacket(new PetStatusShow((Pet) target)); | ||||
| 					 | ||||
| 					// Notify to scripts | ||||
| 					EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonTalk((Summon) target), (Summon) target); | ||||
| 					if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_SUMMON_TALK, target)) | ||||
| 					{ | ||||
| 						EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonTalk((Summon) target), target); | ||||
| 					} | ||||
| 				} | ||||
| 				player.updateNotMoveUntil(); | ||||
| 			} | ||||
|   | ||||
| @@ -24,6 +24,7 @@ import org.l2jmobius.gameserver.model.WorldObject; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.actor.Summon; | ||||
| import org.l2jmobius.gameserver.model.events.EventDispatcher; | ||||
| import org.l2jmobius.gameserver.model.events.EventType; | ||||
| import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; | ||||
| import org.l2jmobius.gameserver.network.SystemMessageId; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; | ||||
| @@ -48,7 +49,10 @@ public class SummonAction implements IActionHandler | ||||
| 			player.sendPacket(ActionFailed.STATIC_PACKET); | ||||
| 			 | ||||
| 			// Notify to scripts | ||||
| 			EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonTalk((Summon) target), (Summon) target); | ||||
| 			if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_SUMMON_TALK, target)) | ||||
| 			{ | ||||
| 				EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonTalk((Summon) target), target); | ||||
| 			} | ||||
| 		} | ||||
| 		else if (player.getTarget() != target) | ||||
| 		{ | ||||
|   | ||||
| @@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.model.actor.instance.Trap; | ||||
| import org.l2jmobius.gameserver.model.conditions.Condition; | ||||
| import org.l2jmobius.gameserver.model.effects.AbstractEffect; | ||||
| import org.l2jmobius.gameserver.model.events.EventDispatcher; | ||||
| import org.l2jmobius.gameserver.model.events.EventType; | ||||
| import org.l2jmobius.gameserver.model.events.impl.creature.trap.OnTrapAction; | ||||
| import org.l2jmobius.gameserver.model.skill.BuffInfo; | ||||
| import org.l2jmobius.gameserver.network.SystemMessageId; | ||||
| @@ -83,7 +84,11 @@ public class TrapRemove extends AbstractEffect | ||||
| 		} | ||||
| 		 | ||||
| 		// Notify to scripts | ||||
| 		EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(trap, info.getEffector(), TrapAction.TRAP_DISARMED), trap); | ||||
| 		if (EventDispatcher.getInstance().hasListener(EventType.ON_TRAP_ACTION, trap)) | ||||
| 		{ | ||||
| 			EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(trap, info.getEffector(), TrapAction.TRAP_DISARMED), trap); | ||||
| 		} | ||||
| 		 | ||||
| 		trap.unSummon(); | ||||
| 		if (info.getEffector().isPlayer()) | ||||
| 		{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment