Skip to content

Events (v1)

Elikill58 edited this page Sep 17, 2020 · 1 revision

Spigot

Negativity use default spigot events.

They are splitted into 2 parts :

  • Main events, located at com.elikill58.negativity.spigot.listeners.

PlayerCheatEvent : Called just after all check. It's just an information event, you cannot edit any data.

PlayerCheatBypassEvent : Called only if you have bypass enabled, and if the player has bypass permission.

PlayerCheatAlertEvent : If the player don't bypass, this event is called. You can cancel the alert to make Negativity don't log or save it.

PlayerCheatKickEvent : After saving alert and before checking for ban, you can choose to kick (or not) the player. This event is called only is the cheat allow kick AND the player has enough reliability.

PlayerPacketsClearEvent : Each seconds, Negativity clear packets and analyze it. Before clearing, it call this event.

ShowAlertPermissionEvent : When sending alert, this event is called to know if the player can see the cheating alert.

  • Packets events, located at com.elikill58.negativity.spigot.packets.event.

PacketReceiveEvent (extends PacketEvent) : called when the server receive a packet from the player.

PacketSendEvent (extends PacketEvent) : called when the server send a packet to the player.

They are compatible with ProtocolLib. You can now the packet source by calling getPacketSourceType. If it's a ProtocolLib one, you can cast the AsbtractPacket to ProtocollibPacket.

Sponge

Negativity use sponge event system.

They are splitted into 2 parts :

  • Main events, located at com.elikill58.negativity.sponge.listeners.

To keep the same system as Sponge, all cheat events are PlayerCheatEvent, like PlayerCheatEvent.SomeThing.

PlayerCheatEvent : Called just after all check. It's just an information event, you cannot edit any data.

PlayerCheatEvent.Bypass : Called only if you have bypass enabled, and if the player has bypass permission.

PlayerCheatEvent.Alert : If the player don't bypass, this event is called. You can cancel the alert to make Negativity don't log or save it.

PlayerCheatEvent.Kick : After saving alert and before checking for ban, you can choose to kick (or not) the player. This event is called only is the cheat allow kick AND the player has enough reliability.

PlayerPacketsClearEvent : Each seconds, Negativity clear packets and analyze it. Before clearing, it call this event.

  • Packets events, located at com.elikill58.negativity.sponge.packets.event.

PacketReceiveEvent (extends PacketEvent) : called when the server receive a packet from the player.

PacketSendEvent (extends PacketEvent) : called when the server send a packet to the player.

Now, there is only PacketGate as a service to provide packet feature. So, the packet source type cannot be CUSTOM.