1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2026-02-01 15:32:48 +00:00

Change-Id: If18611eb0a6296da808aead8f1da54be094db2a9

This commit is contained in:
rogiel
2011-04-29 20:17:45 -03:00
parent 43403d9a1e
commit 0662150229
48 changed files with 612 additions and 513 deletions

View File

@@ -1,8 +1,8 @@
package com.l2jserver.model.world.player;
import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.model.world.actor.ActorEvent;
public interface PlayerEvent extends WorldEvent {
public interface PlayerEvent extends ActorEvent {
Player getPlayer();
}

View File

@@ -1,6 +1,22 @@
package com.l2jserver.model.world.player;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.model.world.actor.ActorEvent;
import com.l2jserver.model.world.actor.ActorListener;
public interface PlayerListener extends WorldListener<PlayerEvent> {
public abstract class PlayerListener implements ActorListener {
@Override
public void dispatch(ActorEvent e) {
if (!(e instanceof PlayerEvent))
return;
dispatch((PlayerEvent) e);
}
/**
* Once the event call is dispatched, the listener <b>WILL NOT</b> be
* removed. You must manually remove it from the <tt>event</tt> object.
*
* @param e
* the event
*/
protected abstract void dispatch(PlayerEvent e);
}

View File

@@ -1,14 +1,24 @@
package com.l2jserver.model.world.player;
import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.model.world.capability.Spawnable;
import com.l2jserver.model.world.event.SpawnEvent;
import com.l2jserver.util.Coordinate;
public class PlayerSpawnEvent implements PlayerEvent, SpawnEvent {
private final Player player;
private final Coordinate coordinate;
public PlayerSpawnEvent(Player player) {
public PlayerSpawnEvent(Player player, Coordinate coordinate) {
this.player = player;
this.coordinate = coordinate;
}
@Override
public void dispatch() {
if (player != null)
player.dispatch(this);
}
@Override
@@ -22,8 +32,12 @@ public class PlayerSpawnEvent implements PlayerEvent, SpawnEvent {
}
@Override
public void dispatch() {
if(player != null)
player.dispatch(this);
public Coordinate getCoordinate() {
return coordinate;
}
@Override
public Actor getActor() {
return player;
}
}