Skip to content

Packets

Dawson edited this page Jun 1, 2019 · 1 revision

Working with packets has never been easier using Atlas's API. This system is based off aadnk's TinyProtocol. Compatibility ranging from 1.7.10-1.14, handled automatically, and no need google each field of the packet every time you work on your project.

Events

package cc.funkemunky.anticheat.impl.listeners;

import cc.funkemunky.api.events.AtlasListener;
import cc.funkemunky.api.events.Listen;
import cc.funkemunky.api.events.impl.PacketReceiveEvent;
import cc.funkemunky.api.events.impl.PacketSendEvent;
import cc.funkemunky.api.utils.Init;

@Init
public class MyListener implements AtlasListener {
    
    //Listening for packets from the player.
    @Listen
    public void onEvent(PacketReceiveEvent event) {
        
    }
    
    //Listening for packets from the server.
    @Listen
    public void onEvent(PacketSendEvent event) {
        
    }
    
}

PacketReceiveEvent

Field Identifier Usage
getPlayer() Player Get the player that the packet was received from.
getPacket() Object Returns the vanilla class received from the netty connection.
isCancelled() boolean Returns whether or not the event was cancelled.
getType() String Returns the parsed name of the packet.
getTimeStamp() long Returns the exact time the packet was received.
setPacket(Object) void Allows modification of the vanilla packet class.
setCancelled(boolean) void Set the event as cancelled.

PacketSendEvent

Field Identifier Usage
getPlayer() Player Get the player that the packet was sent to.
getPacket() Object Returns the vanilla class sent through the netty connection.
isCancelled() boolean Returns whether or not the event was cancelled.
getType() String Returns the parsed name of the packet.
getTimeStamp() long Returns the exact time the packet was sent.
setPacket(Object) void Allows modification of the vanilla packet class.
setCancelled(boolean) void Set the event as cancelled.