mirror of
https://github.com/Rogiel/l2jserver2
synced 2026-02-01 15:32:48 +00:00
Change-Id: If18611eb0a6296da808aead8f1da54be094db2a9
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user