mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-21 03:15:59 +01:00
Implement PlayerMoveEvent
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package emu.grasscutter.server.event.player;
|
||||
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.server.event.Cancellable;
|
||||
import emu.grasscutter.server.event.types.PlayerEvent;
|
||||
import emu.grasscutter.utils.Position;
|
||||
|
||||
/**
|
||||
* TODO: Allow plugins to change the position of the player.
|
||||
*/
|
||||
public final class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||
private final MoveType type;
|
||||
private final Position from;
|
||||
private final Position to;
|
||||
|
||||
public PlayerMoveEvent(Player player, MoveType type, Position from, Position to) {
|
||||
super(player);
|
||||
|
||||
this.type = type;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public MoveType getMoveType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public Position getSource() {
|
||||
return this.from;
|
||||
}
|
||||
|
||||
public Position getDestination() {
|
||||
return this.to;
|
||||
}
|
||||
|
||||
public enum MoveType {
|
||||
/**
|
||||
* The player has sent a combat invocation to move.
|
||||
*/
|
||||
PLAYER,
|
||||
|
||||
/**
|
||||
* The server has requested that the player moves.
|
||||
*/
|
||||
SERVER
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user