Skip to content

Commit

Permalink
Added PlayerTeleportEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-albers committed Dec 14, 2016
1 parent 4968426 commit d248786
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
71 changes: 71 additions & 0 deletions src/eu/the5zig/mod/event/PlayerTeleportEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package eu.the5zig.mod.event;

/**
* Fired, when the server teleports the client to a new Location
*/
public class PlayerTeleportEvent extends Event {

/**
* The absolute x-coordinate of the player.
*/
private double x;
/**
* The absolute y-coordinate of the player.
*/
private double y;
/**
* The absolute z-coordinate of the player.
*/
private double z;
/**
* The yaw-rotation of the player.
*/
private float yaw;
/**
* The pitch-rotation of the player.
*/
private float pitch;

public PlayerTeleportEvent(double x, double y, double z, float yaw, float pitch) {
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
}

/**
* @return the absolute x-coordinate of the player.
*/
public double getX() {
return x;
}

/**
* @return the absolute y-coordinate of the player.
*/
public double getY() {
return y;
}

/**
* @return the absolute z-coordinate of the player.
*/
public double getZ() {
return z;
}

/**
* @return the yaw-rotation of the player.
*/
public float getYaw() {
return yaw;
}

/**
* @return the pitch-rotation of the player.
*/
public float getPitch() {
return pitch;
}
}
13 changes: 13 additions & 0 deletions src/eu/the5zig/mod/server/AbstractGameListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ public void onPlayerListHeaderFooter(T gameMode, String header, String footer) {
public void onTitle(T gameMode, String title, String subTitle) {
}

/**
* Called, whenever the server teleports the client to a new location.
*
* @param gameMode the current game mode instance.
* @param x the absolute x-coordinate of the player.
* @param y the absolute y-coordinate of the player.
* @param z the absolute z-coordinate of the player.
* @param yaw the yaw-rotation of the player.
* @param pitch the pitch-rotation of the player.
*/
public void onTeleport(T gameMode, double x, double y, double z, float yaw, float pitch) {
}

/**
* Called, whenever an {@link ItemStack} gets set into a chest slot.
*
Expand Down

0 comments on commit d248786

Please sign in to comment.