RuneHive-Game
Loading...
Searching...
No Matches
WalkingPacketListener.java
Go to the documentation of this file.
1
2package com.runehive.net.packet.in;
3
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.net.codec.ByteModification;
6import com.runehive.net.codec.ByteOrder;
7import com.runehive.net.packet.ClientPackets;
8import com.runehive.net.packet.GamePacket;
9import com.runehive.net.packet.PacketListener;
10import com.runehive.net.packet.PacketListenerMeta;
11import org.jire.runehiveps.event.player.WalkEvent;
12
13/**
14 * A packet which handles walking requests.
15 *
16 * @author Graham Edgecombe
17 */
19public class WalkingPacketListener implements PacketListener {
20
21 @Override
22 public void handlePacket(Player player, GamePacket packet) {
23 final int targetX = packet.readShort(ByteOrder.LE);
24 final int targetY = packet.readShort(ByteOrder.LE, ByteModification.ADD);
25 final boolean runQueue = packet.readByte(ByteModification.NEG) == 1;
26
27 player.getEvents().interact(player, new WalkEvent(targetX, targetY, runQueue));
28 }
29
30}
This class represents a character controlled by a player.
Definition Player.java:125
Client -> Server packet opcodes.
Represents a single game packet.
void handlePacket(Player player, GamePacket packet)
Handles the packet that has just been received.
Represents RuneScape's custom value types.
ADD
Adds 128 to the value when written, subtracts 128 from the rarity when read.
Represents the order in which bytes are written.
Definition ByteOrder.java:8
LE
Represents Little-endian.
An annotation that describes what client -> server packets a PacketListener can listen to.