RuneHive-Game
Loading...
Searching...
No Matches
SendProgressBar.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 * Handles sending the progress bar data to the client.
9 *
10 * @author Daniel
11 */
12public class SendProgressBar extends OutgoingPacket {
13 private final int id;
14 private final int amount;
15 private final String message;
16
17 public SendProgressBar(int id, int amount) {
18 this(id, amount, "");
19 }
20
21 public SendProgressBar(int id, int amount, String message) {
22 super(129, PacketType.VAR_BYTE);
23 this.id = id;
24 this.amount = amount;
25 this.message = message;
26 }
27
28 @Override
29 public boolean encode(Player player) {
30 builder.writeInt(id)
31 .writeShort(amount)
32 .writeString(String.valueOf(message));
33 return true;
34 }
35}
This class represents a character controlled by a player.
Definition Player.java:125
OutgoingPacket(int opcode, int capacity)
SendProgressBar(int id, int amount, String message)
Represents a type of packet.
VAR_BYTE
A variable packet where the size is indicated by a byte.