Search in sources :

Example 1 with PlayerPositionLookMessage

use of net.glowstone.net.message.play.player.PlayerPositionLookMessage in project Dragonet-Legacy by DragonetMC.

the class MovePlayerPacketTranslator method handleSpecific.

@Override
public Message[] handleSpecific(MovePlayerPacket packet) {
    Location loc = new Location(this.getSession().getPlayer().getWorld(), packet.x, packet.y, packet.z);
    if (!this.getSession().validateMovement(loc)) {
        //Revert
        this.getSession().sendPosition();
        System.out.println("Reverted movement! ");
        return null;
    }
    //Hack ;P
    ((DragonetPlayer) this.getSession().getPlayer()).setLocation(new Location(((DragonetPlayer) this.getSession().getPlayer()).getWorld(), packet.x, packet.y, packet.z, packet.yaw, packet.pitch));
    return new Message[] { new PlayerPositionLookMessage(false, (double) packet.x, (double) packet.y, (double) packet.z, packet.yaw, packet.pitch) };
}
Also used : DragonetPlayer(org.dragonet.entity.DragonetPlayer) PlayerPositionLookMessage(net.glowstone.net.message.play.player.PlayerPositionLookMessage) Message(com.flowpowered.networking.Message) PlayerPositionLookMessage(net.glowstone.net.message.play.player.PlayerPositionLookMessage) Location(org.bukkit.Location)

Aggregations

Message (com.flowpowered.networking.Message)1 PlayerPositionLookMessage (net.glowstone.net.message.play.player.PlayerPositionLookMessage)1 Location (org.bukkit.Location)1 DragonetPlayer (org.dragonet.entity.DragonetPlayer)1