2013-07-17 03:52:27 +02:00
|
|
|
package com.comphenix.protocol.events;
|
|
|
|
|
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a custom packet serializer onto the network stream.
|
|
|
|
*
|
|
|
|
* @author Kristian
|
|
|
|
*/
|
|
|
|
public interface PacketOutputHandler {
|
|
|
|
/**
|
|
|
|
* Retrieve the priority that decides the order each network handler is allowed to manipulate the output buffer.
|
|
|
|
* <p>
|
|
|
|
* Higher priority is executed before lower.
|
|
|
|
* @return The handler priority.
|
|
|
|
*/
|
|
|
|
public ListenerPriority getPriority();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The plugin that owns this output handler.
|
|
|
|
* @return The owner plugin.
|
|
|
|
*/
|
|
|
|
public Plugin getPlugin();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when a given packet is to be written to the output stream.
|
|
|
|
* <p>
|
2013-12-06 18:02:26 +01:00
|
|
|
* Note that the buffer is initially filled with the output from the default write method.
|
|
|
|
* <p>
|
|
|
|
* In Minecraft 1.6.4, the header is always excluded, whereas it MUST be included in Minecraft 1.7.2. Call
|
2023-04-15 23:09:15 +02:00
|
|
|
* NetworkMarker#requireOutputHeader() to determine this.
|
2013-07-17 03:52:27 +02:00
|
|
|
* @param event - the packet that will be outputted.
|
|
|
|
* @param buffer - the data that is currently scheduled to be outputted.
|
|
|
|
* @return The modified byte array to write. NULL is not permitted.
|
|
|
|
*/
|
|
|
|
public byte[] handle(PacketEvent event, byte[] buffer);
|
|
|
|
}
|