Java Code Examples for cn.nukkit.event.player.PlayerTeleportEvent#TeleportCause

The following examples show how to use cn.nukkit.event.player.PlayerTeleportEvent#TeleportCause . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Entity.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    double yaw = location.yaw;
    double pitch = location.pitch;

    Location from = this.getLocation();
    Location to = location;
    if (cause != null) {
        EntityTeleportEvent ev = new EntityTeleportEvent(this, from, to);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            return false;
        }
        to = ev.getTo();
    }

    this.ySize = 0;

    this.setMotion(this.temporalVector.setComponents(0, 0, 0));

    if (this.setPositionAndRotation(to, yaw, pitch)) {
        this.resetFallDistance();
        this.onGround = true;

        this.updateMovement();

        return true;
    }

    return false;
}
 
Example 2
Source File: Entity.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    double yaw = location.yaw;
    double pitch = location.pitch;

    Location from = this.getLocation();
    Location to = location;
    if (cause != null) {
        EntityTeleportEvent ev = new EntityTeleportEvent(this, from, to);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            return false;
        }
        to = ev.getTo();
    }

    this.ySize = 0;

    this.setMotion(this.temporalVector.setComponents(0, 0, 0));

    if (this.setPositionAndRotation(to, yaw, pitch)) {
        this.resetFallDistance();
        this.onGround = true;

        this.updateMovement();

        return true;
    }

    return false;
}
 
Example 3
Source File: Entity.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    double yaw = location.yaw;
    double pitch = location.pitch;

    Location from = this.getLocation();
    Location to = location;
    if (cause != null) {
        EntityTeleportEvent ev = new EntityTeleportEvent(this, from, to);
        this.server.getPluginManager().callEvent(ev);
        if (ev.isCancelled()) {
            return false;
        }
        to = ev.getTo();
    }

    this.ySize = 0;

    this.setMotion(this.temporalVector.setComponents(0, 0, 0));

    if (this.setPositionAndRotation(to, yaw, pitch)) {
        this.resetFallDistance();
        this.onGround = true;

        this.updateMovement();

        return true;
    }

    return false;
}
 
Example 4
Source File: Entity.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public boolean teleport(Vector3 pos, PlayerTeleportEvent.TeleportCause cause) {
    return this.teleport(Location.fromObject(pos, this.level, this.yaw, this.pitch), cause);
}
 
Example 5
Source File: Entity.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public boolean teleport(Position pos, PlayerTeleportEvent.TeleportCause cause) {
    return this.teleport(Location.fromObject(pos, pos.level, this.yaw, this.pitch), cause);
}
 
Example 6
Source File: Entity.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public boolean teleport(Vector3 pos, PlayerTeleportEvent.TeleportCause cause) {
    return this.teleport(Location.fromObject(pos, this.level, this.yaw, this.pitch), cause);
}
 
Example 7
Source File: Entity.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public boolean teleport(Position pos, PlayerTeleportEvent.TeleportCause cause) {
    return this.teleport(Location.fromObject(pos, pos.level, this.yaw, this.pitch), cause);
}
 
Example 8
Source File: Entity.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public boolean teleport(Vector3 pos, PlayerTeleportEvent.TeleportCause cause) {
    return this.teleport(Location.fromObject(pos, this.level, this.yaw, this.pitch), cause);
}
 
Example 9
Source File: Entity.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public boolean teleport(Position pos, PlayerTeleportEvent.TeleportCause cause) {
    return this.teleport(Location.fromObject(pos, pos.level, this.yaw, this.pitch), cause);
}