1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-11 09:42:54 +00:00

Teleporter implementation

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-22 02:04:35 -03:00
parent b3ff0795ec
commit 87ce7bb987
31 changed files with 900 additions and 31 deletions

View File

@@ -98,17 +98,12 @@ public class L2Character extends Player {
// ////////////////////////////////////
// / RUNTIME
// ////////////////////////////////////
/**
* The character walk mode.
* <p>
* This field is not persisted.
*/
private CharacterMoveType moveType = CharacterMoveType.WALK;
/**
* The character target, if any.
*/
private ActorID<?> targetID;
/**
* The character walking mode
@@ -125,6 +120,19 @@ public class L2Character extends Player {
}
}
/**
* The character target, if any.
*/
private ActorID<?> targetID;
/**
* State if the player is being teleported
*/
private CharacterState state;
public enum CharacterState {
TELEPORTING;
}
/**
* Creates a new instance
*
@@ -298,6 +306,28 @@ public class L2Character extends Player {
this.targetID = target;
}
/**
* @return the state
*/
public CharacterState getState() {
return state;
}
/**
* @param state
* the state to set
*/
public void setState(CharacterState state) {
this.state = state;
}
/**
* @return true if character is being teleported
*/
public boolean isTeleporting() {
return state == CharacterState.TELEPORTING;
}
/**
* @return the inventory
*/

View File

@@ -52,7 +52,7 @@ public class CharacterMoveEvent implements CharacterEvent {
}
/**
* @return the point
* @return the new point
*/
public Point getPoint() {
return point;

View File

@@ -20,11 +20,12 @@ import com.l2jserver.model.world.Player;
import com.l2jserver.util.dimensional.Point;
/**
* Event dispatched once an player is teleported to another location
* Event dispatched once an player has completed its teleportation to another
* location
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PlayerTeleportEvent extends PlayerSpawnEvent {
public class PlayerTeleportedEvent extends PlayerSpawnEvent {
/**
* Creates a new instance
*
@@ -33,7 +34,7 @@ public class PlayerTeleportEvent extends PlayerSpawnEvent {
* @param point
* the teleport point
*/
public PlayerTeleportEvent(Player player, Point point) {
public PlayerTeleportedEvent(Player player, Point point) {
super(player, point);
}
}

View File

@@ -0,0 +1,76 @@
/*
* 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.player.event;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.util.dimensional.Point;
/**
* Event dispatched once an player has started his teleported to another
* location
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PlayerTeleportingEvent implements PlayerEvent {
private final Player player;
private final Point point;
/**
* Creates a new instance
*
* @param player
* the teleported player
* @param point
* the teleport point
*/
public PlayerTeleportingEvent(Player player, Point point) {
this.player = player;
this.point = point;
}
@Override
public Actor getActor() {
return player;
}
@Override
public WorldObject getObject() {
return player;
}
@Override
public Player getPlayer() {
return player;
}
/**
* The point to which this player was teleported.
*
* @return the teleported point
*/
public Point getPoint() {
return point;
}
@Override
public ObjectID<?>[] getDispatchableObjects() {
return new ObjectID<?>[] { player.getID() };
}
}