Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.lunarclient.apollo.event.Event;
import com.lunarclient.apollo.module.packetenrichment.PlayerInfo;
import com.lunarclient.apollo.player.ApolloPlayer;
import lombok.Value;

/**
Expand All @@ -35,6 +36,14 @@
@Value
public class ApolloPlayerChatCloseEvent implements Event {

/**
* The player that sent the packet.
*
* @return the player
* @since 1.1.9
*/
ApolloPlayer player;

/**
* The {@code long} representing the unix timestamp
* when the packet was created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.lunarclient.apollo.event.Event;
import com.lunarclient.apollo.module.packetenrichment.PlayerInfo;
import com.lunarclient.apollo.player.ApolloPlayer;
import lombok.Value;

/**
Expand All @@ -35,6 +36,14 @@
@Value
public class ApolloPlayerChatOpenEvent implements Event {

/**
* The player that sent the packet.
*
* @return the player
* @since 1.1.9
*/
ApolloPlayer player;

/**
* The {@code long} representing the unix timestamp
* when the packet was created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.lunarclient.apollo.event.Event;
import com.lunarclient.apollo.module.packetenrichment.PlayerInfo;
import com.lunarclient.apollo.player.ApolloPlayer;
import lombok.Value;

/**
Expand All @@ -35,6 +36,14 @@
@Value
public class ApolloPlayerAttackEvent implements Event {

/**
* The player that sent the packet.
*
* @return the player
* @since 1.1.9
*/
ApolloPlayer player;

/**
* The {@code long} representing the unix timestamp
* when the packet was created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.lunarclient.apollo.event.Event;
import com.lunarclient.apollo.module.packetenrichment.PlayerInfo;
import com.lunarclient.apollo.player.ApolloPlayer;
import lombok.Value;

/**
Expand All @@ -35,6 +36,14 @@
@Value
public class ApolloPlayerUseItemEvent implements Event {

/**
* The player that sent the packet.
*
* @return the player
* @since 1.1.9
*/
ApolloPlayer player;

/**
* The {@code long} representing the unix timestamp
* when the packet was created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public PacketEnrichmentImpl() {
private void onReceivePacket(ApolloReceivePacketEvent event) {
event.unpack(PlayerAttackMessage.class).ifPresent(packet -> {
ApolloPlayerAttackEvent playerAttackEvent = new ApolloPlayerAttackEvent(
event.getPlayer(),
NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()),
NetworkTypes.fromProtobuf(packet.getTargetInfo()),
NetworkTypes.fromProtobuf(packet.getAttackerInfo()),
Expand All @@ -70,6 +71,7 @@ private void onReceivePacket(ApolloReceivePacketEvent event) {

event.unpack(PlayerChatOpenMessage.class).ifPresent(packet -> {
ApolloPlayerChatOpenEvent playerChatOpenEvent = new ApolloPlayerChatOpenEvent(
event.getPlayer(),
NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()),
NetworkTypes.fromProtobuf(packet.getPlayerInfo()));

Expand All @@ -82,6 +84,7 @@ private void onReceivePacket(ApolloReceivePacketEvent event) {

event.unpack(PlayerChatCloseMessage.class).ifPresent(packet -> {
ApolloPlayerChatCloseEvent playerChatCloseEvent = new ApolloPlayerChatCloseEvent(
event.getPlayer(),
NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()),
NetworkTypes.fromProtobuf(packet.getPlayerInfo()));

Expand All @@ -94,6 +97,7 @@ private void onReceivePacket(ApolloReceivePacketEvent event) {

event.unpack(PlayerUseItemMessage.class).ifPresent(packet -> {
ApolloPlayerUseItemEvent playerUseItemEvent = new ApolloPlayerUseItemEvent(
event.getPlayer(),
NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()),
NetworkTypes.fromProtobuf(packet.getPlayerInfo()),
packet.getMainHand()
Expand Down
4 changes: 4 additions & 0 deletions docs/developers/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ _Called when the player closes their chat._

| Field | Description |
| -------------------------- | -------------------------------------------------- |
| `ApolloPlayer player` | The Apollo player that sent the packet. |
| `long instantiationTimeMs` | The unix timestamp when the packet was created. |
| `PlayerInfo playerInfo` | The player's general information. |

Expand All @@ -197,6 +198,7 @@ _Called when the player opens their chat._

| Field | Description |
| -------------------------- | -------------------------------------------------- |
| `ApolloPlayer player` | The Apollo player that sent the packet. |
| `long instantiationTimeMs` | The unix timestamp when the packet was created. |
| `PlayerInfo playerInfo` | The player's general information. |

Expand All @@ -211,6 +213,7 @@ _Called when the player attacks another player._

| Field | Description |
| -------------------------- | -------------------------------------------------- |
| `ApolloPlayer player` | The Apollo player that sent the packet. |
| `long instantiationTimeMs` | The unix timestamp when the packet was created. |
| `PlayerInfo targetInfo` | The target player general information. |
| `PlayerInfo attackerInfo` | The attacker player general information. |
Expand All @@ -227,6 +230,7 @@ _Called when the player uses an item (1.16.1+)._

| Field | Description |
| -------------------------- | -------------------------------------------------- |
| `ApolloPlayer player` | The Apollo player that sent the packet. |
| `long instantiationTimeMs` | The unix timestamp when the packet was created. |
| `PlayerInfo playerInfo` | The player's general information. |
| `boolean mainHand` | Whether the item was in the player's main hand. |
Expand Down