RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.net.packet.out.SendPlayerOption Class Reference

Shows a player options such as right clicking a player. More...

Inheritance diagram for com.runehive.net.packet.out.SendPlayerOption:
Collaboration diagram for com.runehive.net.packet.out.SendPlayerOption:

Public Member Functions

boolean encode (Player player)
 SendPlayerOption (PlayerOption option, boolean top)
 SendPlayerOption (PlayerOption option, boolean top, boolean disable)
Public Member Functions inherited from com.runehive.net.packet.OutgoingPacket
void execute (Player player)
 OutgoingPacket (int opcode, int capacity)
 OutgoingPacket (int opcode, PacketType type)
 OutgoingPacket (int opcode, PacketType type, int size)

Private Attributes

boolean disable
PlayerOption option
boolean top

Additional Inherited Members

Protected Attributes inherited from com.runehive.net.packet.OutgoingPacket
final PacketBuilder builder

Detailed Description

Shows a player options such as right clicking a player.

Author
Daniel

Definition at line 14 of file SendPlayerOption.java.

Constructor & Destructor Documentation

◆ SendPlayerOption() [1/2]

com.runehive.net.packet.out.SendPlayerOption.SendPlayerOption ( PlayerOption option,
boolean top )

Definition at line 20 of file SendPlayerOption.java.

20 {
21 this(option, top, false);
22 }

References option, and top.

◆ SendPlayerOption() [2/2]

com.runehive.net.packet.out.SendPlayerOption.SendPlayerOption ( PlayerOption option,
boolean top,
boolean disable )

Definition at line 24 of file SendPlayerOption.java.

24 {
25 super(104, PacketType.VAR_BYTE);
26 this.option = option;
27 this.top = top;
28 this.disable = disable;
29 }

References disable, option, top, and com.runehive.net.packet.PacketType.VAR_BYTE.

Member Function Documentation

◆ encode()

boolean com.runehive.net.packet.out.SendPlayerOption.encode ( Player player)

Reimplemented from com.runehive.net.packet.OutgoingPacket.

Definition at line 32 of file SendPlayerOption.java.

32 {
33 if (player.contextMenus.contains(option) && !disable) {
34 return false;
35 }
36
37 builder.writeByte(option.getIndex(), ByteModification.NEG)
38 .writeByte(top ? 1 : 0, ByteModification.ADD)
39 .writeString(disable ? "null" : option.getName());
40
41 if (disable) {
42 player.contextMenus.remove(option);
43 } else {
44 player.contextMenus.add(option);
45 }
46 return true;
47 }

References com.runehive.net.codec.ByteModification.ADD, com.runehive.net.packet.OutgoingPacket.builder, com.runehive.game.world.entity.mob.player.Player.contextMenus, disable, com.runehive.net.codec.ByteModification.NEG, option, and top.

Member Data Documentation

◆ disable

boolean com.runehive.net.packet.out.SendPlayerOption.disable
private

Definition at line 18 of file SendPlayerOption.java.

Referenced by encode(), and SendPlayerOption().

◆ option

PlayerOption com.runehive.net.packet.out.SendPlayerOption.option
private

Definition at line 16 of file SendPlayerOption.java.

Referenced by encode(), SendPlayerOption(), and SendPlayerOption().

◆ top

boolean com.runehive.net.packet.out.SendPlayerOption.top
private

Definition at line 17 of file SendPlayerOption.java.

Referenced by encode(), SendPlayerOption(), and SendPlayerOption().


The documentation for this class was generated from the following file: