> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/spoof_manager.md).

# Spoof Manager

The `spoofManager` namespace lets your script intercept, cancel, delay, and release packets in both directions. Like the rotation manager, it uses a priority system for when multiple scripts are active.

This manager is mainly meant for making lag based modules. For basic packet manipulation we recommend [PacketSendEvent](/api/events/packetsendevent.md).

***

### Setup

Set your priority during initialization.

```javascript
spoofManager.setPriority(10);
```

***

### Intercepting Packets

#### `onPacketSend`

Called for every outbound packet (client → server). Return a `SpoofAction` to decide what happens to it.

```javascript
spoofManager.onPacketSend((packet) => {
    if (packet instanceof C0BPacketEntityAction) {
        if (packet.getAction() === "START_SNEAKING") {
            return "CANCEL"; // block sneak packets from reaching the server
        }
    }
    return "PROCESS"; // let everything else through
});
```

***

#### `onPacketReceive`

Called for every inbound packet (server → client). Same `SpoofAction` return values apply.

```javascript
spoofManager.onPacketReceive((packet) => {
    if (packet instanceof S08PacketPlayerPosLook) {
        return "DELAY"; // hold the teleport packet until we're ready
    }
    return "PROCESS";
});
```

***

### SpoofAction Values

| Value       | Description                                           |
| ----------- | ----------------------------------------------------- |
| `"PROCESS"` | Do nothing, let the packet continue as normal         |
| `"CANCEL"`  | Drop the packet entirely — it will never be processed |
| `"DELAY"`   | Hold the packet until you manually release it         |

### Releasing Delayed Packets

#### `onUpdate`

Called every tick when there are delayed packets waiting. Use this to decide when to release them.

```javascript
spoofManager.onUpdate((packets) => {
    for (let packet of packets) {
        if (packet.hasAged(1000)) { // release after 1 second
            spoofManager.release(packet);
        }
    }
});
```

Each `DelayedPacket` exposes:

| Property / Method | Description                                                       |
| ----------------- | ----------------------------------------------------------------- |
| `packet`          | The original `Packet` object                                      |
| `time`            | Epoch ms timestamp of when it was delayed                         |
| `direction()`     | `"IN"` or `"OUT"`                                                 |
| `hasAged(ms)`     | `true` if the packet has been held for at least `ms` milliseconds |

### Flushing Packets

If you need to release everything at once — for example when the script is disabled — use the flush helpers.

```typescript
spoofManager.flushAll();      // release all delayed packets
spoofManager.flushIncoming(); // release only inbound packets
spoofManager.flushOutgoing(); // release only outbound packets
```

> Always call `flushAll()` in your `script.onDisable` callback to avoid packets being stuck indefinitely.

***

### Sending Packets Manually

You can also inject your own packets directly to the server.

```typescript
spoofManager.sendPacket(new C05PacketPlayerLook(90.0, 0.0, true), false);
```

{% hint style="info" %}
See [https://github.com/LoseBypass/breeze-docs/blob/main/docs/examples/page-1.md](https://github.com/LoseBypass/breeze-docs/blob/main/docs/examples/page-1.md "mention") for a basic implementation of the spoof manager.
{% endhint %}
