RuneHive-Game
Loading...
Searching...
No Matches
SendAddFriend.java
Go to the documentation of this file.
1package com.runehive.net.packet.out;
2
3import com.runehive.net.packet.OutgoingPacket;
4import com.runehive.game.world.entity.mob.player.Player;
5
6/**
7 * Handles sending the deposit friend packet.
8 *
9 * @author Daniel
10 */
11public final class SendAddFriend extends OutgoingPacket {
12
13 private final long username;
14 private int world;
15 private boolean display;
16
17 public SendAddFriend(long username, int world, boolean display) {
18 super(50, 10);
19 this.username = username;
20 this.world = world;
21 this.display = display;
22 }
23
24 public SendAddFriend(long username, int world) {
25 this(username, world, true);
26 }
27
28 @Override
29 protected boolean encode(Player player) {
30 world = world != 0 ? world + 9 : world;
31 builder.writeLong(username);
32 builder.writeByte(world);
33 builder.writeByte(display ? 1 : 0);
34 return true;
35 }
36
37}
This class represents a character controlled by a player.
Definition Player.java:125
OutgoingPacket(int opcode, int capacity)
SendAddFriend(long username, int world, boolean display)