RuneHive-Game
Loading...
Searching...
No Matches
SendGameMessage.java
Go to the documentation of this file.
1package com.runehive.net.packet.out;
2
3import com.runehive.net.packet.OutgoingPacket;
4import com.runehive.net.packet.PacketType;
5import com.runehive.game.world.entity.mob.player.Player;
6
7/**
8 * The {@code OutgoingPacket} responsible for sending game messages.
9 *
10 * @author Daniel
11 */
12public class SendGameMessage extends OutgoingPacket {
13
14 private final int id;
15 private final int time;
16 private final Object context;
17
18 public SendGameMessage(int id, int time, Object context) {
19 super(114, PacketType.VAR_BYTE);
20 this.id = id;
21 this.time = time;
22 this.context = context;
23 }
24
25 @Override
26 public boolean encode(Player player) {
27 builder.writeShort(id).writeShort(time * 3000)
28 .writeString(String.valueOf(context));
29 return true;
30 }
31
32}
This class represents a character controlled by a player.
Definition Player.java:125
OutgoingPacket(int opcode, int capacity)
SendGameMessage(int id, int time, Object context)
Represents a type of packet.
VAR_BYTE
A variable packet where the size is indicated by a byte.