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) | ||||
| 		{ | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import org.l2jmobius.gameserver.model.actor.Creature; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| 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.player.OnPlayerSummonAgathion; | ||||
| import org.l2jmobius.gameserver.model.item.instance.Item; | ||||
| import org.l2jmobius.gameserver.model.skill.Skill; | ||||
| @@ -59,11 +60,13 @@ public class SummonAgathion extends AbstractEffect | ||||
| 		} | ||||
| 		 | ||||
| 		final Player player = effected.getActingPlayer(); | ||||
| 		 | ||||
| 		player.setAgathionId(_npcId); | ||||
| 		player.sendPacket(new ExUserInfoCubic(player)); | ||||
| 		player.broadcastCharInfo(); | ||||
| 		 | ||||
| 		EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId)); | ||||
| 		if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_SUMMON_AGATHION)) | ||||
| 		{ | ||||
| 			EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSummonAgathion(player, _npcId)); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.model.actor.Creature; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.Trap; | ||||
| 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.player.OnTrapAction; | ||||
| import org.l2jmobius.gameserver.model.item.instance.Item; | ||||
| import org.l2jmobius.gameserver.model.skill.Skill; | ||||
| @@ -80,7 +81,10 @@ public class TrapRemove extends AbstractEffect | ||||
| 		} | ||||
| 		 | ||||
| 		// Notify to scripts | ||||
| 		EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(trap, effector, TrapAction.TRAP_DISARMED), trap); | ||||
| 		if (EventDispatcher.getInstance().hasListener(EventType.ON_TRAP_ACTION, trap)) | ||||
| 		{ | ||||
| 			EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(trap, effector, TrapAction.TRAP_DISARMED), trap); | ||||
| 		} | ||||
| 		 | ||||
| 		trap.unSummon(); | ||||
| 		if (effector.isPlayer()) | ||||
|   | ||||
| @@ -21,6 +21,7 @@ import org.l2jmobius.gameserver.model.actor.Creature; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| 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.player.OnPlayerUnsummonAgathion; | ||||
| import org.l2jmobius.gameserver.model.item.instance.Item; | ||||
| import org.l2jmobius.gameserver.model.skill.Skill; | ||||
| @@ -55,7 +56,10 @@ public class UnsummonAgathion extends AbstractEffect | ||||
| 				player.sendPacket(new ExUserInfoCubic(player)); | ||||
| 				player.broadcastCharInfo(); | ||||
| 				 | ||||
| 				EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId)); | ||||
| 				if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_UNSUMMON_AGATHION)) | ||||
| 				{ | ||||
| 					EventDispatcher.getInstance().notifyEventAsync(new OnPlayerUnsummonAgathion(player, agathionId)); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
| @@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.ActionDataHolder; | ||||
| import org.l2jmobius.gameserver.model.WorldObject; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.events.EventDispatcher; | ||||
| import org.l2jmobius.gameserver.model.events.EventType; | ||||
| import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSocialAction; | ||||
| import org.l2jmobius.gameserver.network.SystemMessageId; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.ExAskCoupleAction; | ||||
| @@ -93,7 +94,10 @@ public class SocialAction implements IPlayerActionHandler | ||||
| 			player.broadcastPacket(new org.l2jmobius.gameserver.network.serverpackets.SocialAction(player.getObjectId(), id)); | ||||
| 			 | ||||
| 			// Notify to scripts | ||||
| 			EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSocialAction(player, id), player); | ||||
| 			if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_SOCIAL_ACTION, player)) | ||||
| 			{ | ||||
| 				EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSocialAction(player, id), player); | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		return true; | ||||
|   | ||||
| @@ -842,7 +842,11 @@ public class CeremonyOfChaos extends AbstractNpcAI | ||||
| 		final StatSet params = new StatSet(); | ||||
| 		params.set("time", 30); | ||||
| 		getTimers().addTimer("match_end_countdown", params, 30000, null, null); | ||||
| 		EventDispatcher.getInstance().notifyEvent(new OnCeremonyOfChaosMatchResult(winners, memberList)); | ||||
| 		 | ||||
| 		if (EventDispatcher.getInstance().hasListener(EventType.ON_CEREMONY_OF_CHAOS_MATCH_RESULT)) | ||||
| 		{ | ||||
| 			EventDispatcher.getInstance().notifyEvent(new OnCeremonyOfChaosMatchResult(winners, memberList)); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void teleportPlayersOut() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment