mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-13 10:42:54 +00:00
@@ -29,7 +29,7 @@ import com.l2jserver.model.world.capability.Listenable;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterLoggedInEvent implements CharacterEvent {
|
||||
public class CharacterEnterWorldEvent implements CharacterEvent {
|
||||
/**
|
||||
* The character that is logging in
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public class CharacterLoggedInEvent implements CharacterEvent {
|
||||
* @param date
|
||||
* the login date
|
||||
*/
|
||||
public CharacterLoggedInEvent(L2Character character, Date date) {
|
||||
public CharacterEnterWorldEvent(L2Character character, Date date) {
|
||||
this.character = character;
|
||||
this.date = date;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class CharacterLoggedInEvent implements CharacterEvent {
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterLoggedInEvent(L2Character character) {
|
||||
public CharacterEnterWorldEvent(L2Character character) {
|
||||
this(character, new Date());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver 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.
|
||||
*
|
||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.event;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.capability.Listenable;
|
||||
|
||||
/**
|
||||
* Event triggered once a character logs-out.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterLeaveWorldEvent implements CharacterEvent {
|
||||
/**
|
||||
* The character that is logging in
|
||||
*/
|
||||
private final L2Character character;
|
||||
/**
|
||||
* The time that this character has logged off
|
||||
*/
|
||||
private final Date date;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
* @param date
|
||||
* the logout date
|
||||
*/
|
||||
public CharacterLeaveWorldEvent(L2Character character, Date date) {
|
||||
this.character = character;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance. Login date is set to now.
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterLeaveWorldEvent(L2Character character) {
|
||||
this(character, new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the logout date
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getPlayer() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Actor getActor() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldObject getObject() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listenable<?, ?>[] getDispatchableObjects() {
|
||||
return new Listenable<?, ?>[] { character };
|
||||
}
|
||||
}
|
||||
@@ -16,18 +16,17 @@
|
||||
*/
|
||||
package com.l2jserver.model.world.character.event;
|
||||
|
||||
import com.l2jserver.model.world.player.event.PlayerEvent;
|
||||
import com.l2jserver.model.world.player.event.PlayerListener;
|
||||
import com.l2jserver.service.game.world.event.WorldEvent;
|
||||
import com.l2jserver.service.game.world.event.WorldListener;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* This listener will filter to only dispatch {@link CharacterEvent} events.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class CharacterListener extends PlayerListener {
|
||||
public abstract class CharacterListener implements WorldListener {
|
||||
@Override
|
||||
protected boolean dispatch(PlayerEvent e) {
|
||||
public boolean dispatch(WorldEvent e) {
|
||||
if (!(e instanceof CharacterEvent))
|
||||
return false;
|
||||
return dispatch((CharacterEvent) e);
|
||||
|
||||
Reference in New Issue
Block a user