Skip to content

Server plugins

Gameplay and the world

Server plugins change how the game plays without adding blocks, items or entities, so players join with an unmodified vanilla client. This page covers what such a plugin reaches: sounds and particles, block changes and drops, redstone, containers, players' attributes and movement, travel, progress, saved data and the level's tick. ObsidianPlugin is a working server-side plugin that vanilla clients can join; start with Writing a plugin for a plugin's shape. New blocks, items and entities need a mod on the player's side: see Blocks and items and Entities.

Sounds

Declare sound events in ConfigureRegistry, on both sides in a mod with a client side. RegisterSound(string identifier, float? fixedRange = null) returns a SoundEvent for IPlayer.SendSoundAsync:

var chime = registry.RegisterSound("ruby:machine.chime", fixedRange: 24);
var effect = SoundEffectBuilder.Create(chime, SoundCategory.Blocks)
    .WithSoundPosition(new SoundPosition(4.5, 70.5, 4.5))
    .WithVolume(0.7f)
    .WithPitch(1)
    .Build();
await player.SendSoundAsync(effect);

The identifier must be in the plugin's namespace. A null fixedRange means a variable range. Get the SoundEvent again on each load; registering it on reload replaces its range.

Sounds are sent by name, without registry ids, so a sound-only plugin keeps vanilla clients able to join. They play the sound if their resource pack has it, and ignore it otherwise.

A mod's blocks can make registered sounds, and the Obsidian client can play them itself (see Block sounds and Client sounds).

Particles

ILevel.SpawnParticles sends any particle, as vanilla's /particle does, to players within 32 blocks (512 with force). A count of 0 sends one particle moving along spread times speed; otherwise count particles are scattered by up to spread on each axis. A vanilla particle without options is a ParticleData naming its ParticleType:

sealed class Flame : ParticleData
{
    public override ParticleType ParticleType => ParticleType.Flame;
}

level.SpawnParticles(new Flame(), position, count: 8, spread: new VectorF(0.2f), speed: 0.05f);

A particle type of a plugin's own needs a client mod to draw it (see Particle types).

Block updates

Block changes run side effects as their BlockUpdateFlags ask. ILevel.SetBlockAsync with doBlockUpdate: true, players placing and breaking blocks, and explosions use All. SetBlockAsync(position, block, flags) and IBlockLevel.SetBlock take any flags, and doBlockUpdate: false is a plain change, without hooks or updates.

  • Without Clients, players aren't sent the change.
  • Without Neighbors, the old block isn't told it was removed and the neighbours don't get NeighborChanged.
  • KnownShape skips shape updates, and SkipOnPlace skips OnPlaced.

Of vanilla's blocks, liquids flow, falling blocks fall and redstone components react to updates. Other vanilla blocks only change shape when water or lava changes blocks.

ILevel.ScheduleBlockTick and IBlockLevel.ScheduleTick schedule a block's tick in a number of game ticks, with a TickPriority. There's one per block and position, and it runs only if the block is still there. Scheduled ticks are saved with their chunk, and a plugin block's ticks wait while its plugin is unloaded.

A cancellable BlockPlaceEventArgs, next to BlockBreakEventArgs, is raised before a player places a block, with the state they'd place. Cancelling it keeps the block from being placed, and the player keeps the item.

A mod's own blocks react to these updates through their behaviour's hooks (see Block hooks).

Block drops

DestroyBlock(position, dropItems, breaker) on ILevel or IBlockLevel breaks a block as the game does: it drops its loot, plays the break effect and leaves any fluid behind. It runs on the next tick, and returns false when there's nothing to break (air, an unloaded chunk, or a break already queued). Use it when a block loses its support; RemoveBlock removes a block without loot. A container's contents spill either way.

SpawnItem(position, stack) drops an item entity straight away. For drops that belong to a player's break, add them to the break context's ExtraDrops instead, so that creative mode and the block_drops rule apply.

Blocks use vanilla's loot tables when players break them and explosions destroy them. A plugin's data/minecraft/loot_table/blocks/stone.json replaces stone's table, minecraft:blocks/stone:

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:diamond",
          "functions": [
            { "function": "minecraft:set_count", "count": 2 },
            { "function": "minecraft:explosion_decay" }
          ]
        }
      ]
    }
  ]
}

A mod's blocks have tables of their own (see Block loot).

Tables can add or replace any namespace's tables. Files apply in plugin load order, then the server's data packs in name order. Reloading replaces a plugin's tables, and unloading restores the previous table or vanilla's. A malformed table is logged and left out, and the plugin still loads.

The evaluator supports:

  • entries: item, empty, dynamic and table; alternatives, groups and sequences;
  • number providers: constant, uniform and binomial;
  • conditions: match_tool (item ids or tags, counts and enchantments such as silk touch and fortune), block_state_property, table_bonus, random_chance, survives_explosion, location_check, entity_properties, all_of, any_of and inverted;
  • functions: set_count, limit_count, apply_bonus (all three formulas), explosion_decay, copy_state and copy_components.

A block that RequiresCorrectTool drops only for a player with the right tool, decided by the tool's minecraft:tool component. Vanilla's tools read the mineable/* and incorrect_for_*_tool block tags, so a plugin can add its blocks to those tags. Explosions don't check the tool. To evaluate a table yourself, LootTableJson.Parse(string json, string identifier = "") builds a LootTable that takes a LootContext.

Redstone

ISignalReader, on ILevel and on the IBlockLevel a hook gets, reads power: GetSignal, GetDirectSignal (strong power), GetDirectSignalTo, HasSignal, HasNeighborSignal (whether anything powers a position, as a lamp checks) and GetBestNeighborSignal. The direction is from the block asking to the block read, so a block reads its west neighbour with GetSignal(position + Vector.West, BlockFace.West). A plugin block conducts strong power when its template is opaque, with collision.

ILevel.UpdateNeighbors(position, source) tells a position's six neighbours that it changed, so redstone and plugin blocks react. Use it when power changes outside a block's hooks, such as from a block entity's tick or a level ticker. It runs at once under the level's tick lock, so don't call it while holding a lock that hooks may wait on, like a window's.

Vanilla's redstone components work, but other powered blocks, such as doors and pistons, don't react yet.

A mod's blocks give power, and react to it, through their behaviour's hooks (see Redstone hooks).

Item access

IItemAccess, like NeoForge's item handler capability, reaches the items of whatever is at a position, from a side. Get it with ILevel.GetItemAccess(position, side), or IBlockLevel.GetItemAccess in a block hook; both read only loaded chunks. The side is the face the caller reaches through: a hopper above a furnace uses BlockFace.Up, and null means no particular side.

  • SlotCount and GetItem(slot) read the slots.
  • Insert(slot, stack) and Insert(stack) (into the slots in order, like a hopper) return what didn't go in.
  • Extract(slot, count) returns what came out, or null.
  • Every call takes simulate: a simulated call reports what it would do and changes nothing, so a pipe can plan both ends of a transfer first.

Stacks passed in aren't changed, and stacks returned are yours. Each call is atomic, but two calls aren't a transaction: a player's click can come between them, so check what the real call returns.

Vanilla's chests, barrels, dispensers, droppers, hoppers, shulker boxes, furnaces and brewing stands are ContainerBlockEntitys (see Container block entities), so await level.GetBlockEntityAsync(position) is ContainerBlockEntity chest reaches a chest's items. Their slots follow vanilla's sides, and a double chest is one 54-slot inventory.

Inside a block hook, a container that's busy with a click, or still waiting to roll its loot table, takes and gives nothing for that call. Hoppers, droppers and dispensers move items through item access, so they reach plugins' blocks too, at vanilla's pace.

A mod's block entities give access of their own, and a machine changes its own inventory under its lock (see Container block entities).

Click handlers

[EventPriority(Priority = Priority.Normal)]
public ValueTask OnClick(ContainerClickEventArgs click)
{
    if (click.Container is not MenuContainer { Menu.Identifier: "ruby:pouch" } pouch || click.ClickedSlot != 0)
        return ValueTask.CompletedTask;

    // Selling the diamonds in the first slot: decided on what the slot held as the click arrived.
    if (click.Item?.Is(ItemsRegistry.Diamond) == true)
    {
        click.Cancel();
        click.ApplyWithClick(() => pouch.SetItem(0, new ItemStack(ItemsRegistry.Emerald, click.Item.Count)));
    }

    return ValueTask.CompletedTask;
}

The example handles a mod's menu (see Menus); clicks in a chest or any other container reach handlers the same way.

Click handlers run before the server applies the click, and outside the container's lock, so a handler may await. The server then applies the click, unless it's cancelled or the window's contents changed while handlers decided. A click that isn't applied is corrected: the player is sent the window and cursor again.

  • Item is a copy of what the clicked slot held as the click arrived. Changing it changes nothing.
  • To change slots with the click, use ApplyWithClick. It runs right after the click (or in its place, when cancelled), only if the click is applied, and must not block or wait.
  • Changing the container directly (SetItem, RemoveItem), or a stack it holds, isn't part of the click: it makes the click stale, and may race other viewers' clicks.
  • Component values are immutable. Replace one through the stack's indexer, as in stack[food.Type] = food with { Nutrition = 5 };.
  • A ContainerClosedEventArgs handler may open another container for the player.
  • The packets the server sends about a window go through QueuePacketEventArgs handlers like any packet.

Attributes

Living entities have vanilla's attributes. Vanilla's mobs use their type's defaults, and a plugin's mobs vanilla's mob defaults with the type's MaxHealth, MovementSpeed and FlyingSpeed.

  • IEntity.GetAttributeValue gives an attribute's value with its modifiers applied (Add, then MulBase, then MulTotal), clamped to vanilla's range.
  • IEntity.SetAttributeModifier(attribute, id, amount, operation) adds or replaces a modifier, which is saved, and RemoveAttributeModifier takes it off.
  • Players also get the modifiers of what they hold and wear (items' AttributeModifiers) and of sprinting. These aren't saved.

Clients are sent attribute changes as vanilla syncs them. minecraft:scale scales hitboxes, eye height and passengers' seats, and on the Obsidian client the model too.

Movement

Attribute modifiers (see Attributes) tune the movement players and mobs already have: minecraft:jump_strength, minecraft:gravity, minecraft:movement_speed, minecraft:step_height, minecraft:safe_fall_distance and the rest are synced, so the server and every client move alike. For moves no attribute gives, a plugin grants a player MovementAbilities with IPlayer.SetMovementAbilities(id, abilities):

  • CanFly: creative-style flight in any game mode. It works with every client.

ExtraJumps and CanGlide need the Obsidian client (see Movement).

// Flight while a player holds a rank, from a command handler, say.
player.SetMovementAbilities("example:flight", new MovementAbilities { CanFly = true });

// Taken away.
player.RemoveMovementAbilities("example:flight");

Grants with different ids add up (their extra jumps sum, the rest combine), and the same id replaces its grant. IPlayer.MovementAbilities is the total. Grants aren't saved, and unloading the plugin that made them takes them back, flight included.

Mob loot

A dying plugin mob, and some of vanilla's mobs, drops its type's loot table when the mob_drops rule is on: data/<namespace>/loot_table/entities/<path>.json for <namespace>:<path>. A data pack can override it.

The table's context has the mob, the attacker and the player who hurt it in the last 100 ticks, so minecraft:killed_by_player, minecraft:random_chance_with_enchanted_bonus and minecraft:enchanted_count_increase (looting) work. entity_properties checks an entity's type, flags, equipment and vehicle, and furnace_smelt cooks drops for burning mobs and #minecraft:smelts_loot enchantments.

Of vanilla's mobs, these drop their tables so far: zombies, husks, drowned, zombie villagers, skeletons, strays, bogged, parched, wither skeletons, spiders, cave spiders, creepers, endermen, blazes, breezes, witches, zombified piglins, cows, mooshrooms, pigs, chickens, rabbits, hoglins and zoglins. Baby animals drop nothing, and the other mobs keep their own drops. A plugin's data/minecraft/loot_table/entities/zombie.json replaces the zombie's table:

{ "type": "minecraft:entity", "pools": [{
  "rolls": 1,
  "conditions": [{ "condition": "minecraft:killed_by_player" }],
  "entries": [{ "type": "minecraft:item", "name": "minecraft:emerald", "functions": [
    { "function": "minecraft:enchanted_count_increase", "enchantment": "minecraft:looting", "count": 1 }
  ] }]
}] }

Travel and portals

Move a player or any server entity without replacing its state:

await entity.TeleportAsync(targetLevel, new VectorD(8.5, 72, -3.5), yaw: 90f, pitch: 0f);

IEntity.TeleportAsync(ILevel level, VectorD position, Angle? yaw = null, Angle? pitch = null) keeps the rotation you leave out. Destination chunks load before the entity leaves. A player changing level keeps its health, inventory, effects, attachments and the rest. The position may be above or below the build range.

A vehicle carries its passengers, who keep their seats; an entity teleported on its own gets off its vehicle. IEntity.StartRiding(vehicle) mounts any entity on another with a free seat, IEntity.StopRiding() takes it off, and IEntity.Vehicle and IEntity.Passengers describe it, so a skeleton can ride a skeleton horse. IPlayer.StartRiding only boards mobs.

Packet handlers may await a teleport, respawn or kill of any player (see Outgoing packets). PlayerTeleportEventArgs handlers run once the teleport's packets are queued.

Register rectangular portals on the server in ConfigureRegistry. A portal that fills with vanilla's Nether portal block keeps vanilla clients able to join:

var portal = registry.RegisterPortal("ruby:crystal_gate", new PortalProperties
{
    IsFrame = block => block.Is(BlockIds.AmethystBlock),
    FrameBlock = new SimpleBlockState { Name = "minecraft:amethyst_block" }.ToBlock(),
    PortalBlock = new SimpleBlockState { Name = "minecraft:nether_portal" }.ToBlock(),
    Igniter = ItemsRegistry.Diamond,
    WaitTicks = 40,
    ResolveTarget = level =>
    {
        var world = level is IDimension child ? child.ParentWorld : level as IWorld;
        return level.DimensionName == "ruby:crystal_world"
            ? world
            : world?.GetLevel("ruby:crystal_world");
    }
});

IWorld.GetLevel(identifier) finds a world's root level or a loaded child dimension. When ResolveTarget returns null, the portal can't be lit or used in that level. Dimension data is registered as described in Dimensions. Portals are the server's: on the Obsidian client, which runs a both mod's ConfigureRegistry too, RegisterPortal registers nothing.

  • IsFrame accepts frame blocks. FrameBlock is what new exit portals and their platforms are built of.
  • PortalBlock fills the frame, and needs axis=x,z states.
  • Frames are 2–21 blocks wide and 3–21 high inside, with optional corners. MinWidth, MaxWidth, MinHeight and MaxHeight narrow that.
  • Igniter is the item used on the frame to light it. IgnitesFromFire lights frames when fire is placed, and await level.TryLightPortalAsync(portal, interiorPosition) lights one from code.
  • WaitTicks (80 by default), CreativeWaitTicks (1) and EntityWaitTicks (0) are how long an entity stands in the portal before it travels, as for the Nether portal.
  • CoordinateScale = (source, target) => ... maps coordinates. By default it's the source dimension type's CoordinateScale divided by the target's.
  • SearchRadius = target => ... is how far, 1–128 blocks (128 by default), to look for an exit portal before building one.

Portal types can share a portal block, the Nether portal's included. A portal block a type lights or builds is saved as that type's, so a Nether portal search skips a plugin's portals of the same block. While its type isn't registered, the block does nothing, and it works again when the plugin registers the type again. A mod can fill its portals with a block of its own instead (see Portal blocks).

The Nether portal is a built-in registration.

Unloading the plugin stops its portals working and leaves their blocks in place. Registering the same identifier after a reload brings them back.

Progress

Players' IPlayer.Statistics and IPlayer.Advancements save in the world's vanilla files, players/stats/<uuid>.json and players/advancements/<uuid>.json.

player.Statistics.Increment("minecraft:jump");
player.Statistics.Increment("minecraft:diamond", 3, "minecraft:picked_up");
var jumps = player.Statistics.Get("minecraft:jump");

await player.Advancements.GrantAsync("ruby:powered", "first_machine");
var powered = player.Advancements.IsDone("ruby:powered");
var obtained = player.Advancements.HasCriterion("ruby:powered", "first_machine");
player.Advancements.Revoke("ruby:powered", "first_machine");

Get(identifier, type = "minecraft:custom") returns zero when there's no value, and Increment(identifier, amount = 1, type = "minecraft:custom") adds to a registered statistic. The types are vanilla's mined, crafted, used, broken, picked_up, dropped, killed, killed_by and custom, in the minecraft namespace. The server records vanilla's statistics as players play: times in ticks, distances in centimetres and damage in tenths of a health point.

A mod can add statistics of its own (see Custom statistics).

Advancements are vanilla JSON in data/<ns>/advancement/<path>.json, read after vanilla's and before data packs'. Criteria, requirements, parents, display and rewards work as in vanilla. ObsidianMod's obsidianmod:grinder advancement is an example, with inventory_changed and an experience reward.

GrantAsync(identifier, criterion = null) grants one criterion or the whole advancement, and Revoke(identifier, criterion = null) takes it back. Both return whether anything changed. Completing an advancement gives its rewards (experience, loot and recipes), again after a revoke. /advancement grant|revoke <player> only <id> [criterion] uses the same API and the advancement permission. A plugin's saved progress stays while the plugin is unloaded.

Plugin triggers

// During ConfigureRegistry, on the server:
var powered = registry.RegisterAdvancementTrigger("ruby:powered",
    new AdvancementConditionsCodec<int>(json => json.GetProperty("minimum").GetInt32()));

// When a machine starts, evaluate each matching criterion's decoded conditions:
await powered.FireAsync(player, minimum => machine.Power >= minimum);

The criterion names "trigger": "ruby:powered" and "conditions": { "minimum": 10 }. FireAsync(IPlayer, Func<TInstance, bool>) tests each of that player's criteria for the trigger with its decoded conditions. Throw NotSupportedException or a JSON validation exception from the codec for conditions you don't support. A trigger handle stops working when its plugin unloads.

Vanilla's triggers so far are inventory_changed, recipe_unlocked, player_killed_entity, entity_killed_player, changed_dimension, location, consume_item, placed_block, item_used_on_block, tick, recipe_crafted, enchanted_item and slept_in_bed; impossible only advances through grants. Unsupported triggers and condition fields never match. Vanilla's full visibility rules, selective recipe unlocking, breeding attribution and function rewards aren't supported yet.

Saved data and attachments

Register types during ConfigureRegistry with the same codec shapes as item components:

var networks = registry.RegisterSavedData("example:networks", new ComponentCodec<List<int>>(
    values => new NbtArray<int>("", values.ToArray()),
    tag => ((NbtArray<int>)tag).GetArray().ToList()));

var membership = registry.RegisterAttachment("example:membership", new ComponentCodec<int>(
    value => new NbtTag<int>("", value),
    tag => ((NbtTag<int>)tag).Value),
    new ComponentNetworkCodec<int>((writer, value) => writer.WriteVarInt(value), reader => reader.ReadVarInt()),
    copyOnDeath: true);

var saved = level.GetSavedData(networks, () => new List<int>());
saved.Value.Add(42);
saved.MarkDirty();
player.SetAttachment(membership, 42);
var network = player.GetAttachment(membership);
chunk.RemoveAttachment(membership);

ILevel.GetSavedData(type, create, scope) returns the live SavedData<T> for a type, calling create when there's no file. The default scope, SavedDataScope.Level, is one level's; SavedDataScope.World shares one instance across a world's dimensions, and IServer.GetSavedData(type, create) uses it in the default world. After changing Value, call MarkDirty(): it takes a snapshot at once, and only snapshots are saved.

Level data is saved in <level>/data/<namespace>/<path>.dat, and world data in <world>/data/<namespace>/<path>.dat, in vanilla's gzipped NBT format. Identifiers are in the plugin's namespace. A file stays on disk while its plugin is away, and is read again when it reloads.

Entities (players included) and chunks are IAttachmentHolders; get a chunk with ILevel.GetChunkAsync. GetAttachment, TryGetAttachment, SetAttachment and RemoveAttachment are extensions in Obsidian.API.Data.

  • A get returns a copy: set the value again after changing it.
  • Setting or removing throws once the holder is being removed or saved for the last time (a chunk unloading, an entity going, a player leaving).
  • Attachments are saved under obsidian:attachments. An unloaded plugin's attachments stay saved until it returns.
  • A respawning player loses attachments registered without copyOnDeath; changing dimension keeps them all. Attachments holding items follow the inventory's rules instead (see Player extensions). AttachmentType.Changed reports changes.

A network codec syncs a type to Obsidian clients, which register the same type in their mod's ConfigureRegistry. Vanilla clients aren't sent attachments and can still join. On the client, IClientWorld reads them with TryGetPlayerAttachment(type, out value), TryGetEntityAttachment(entityId, type, out value) and TryGetChunkAttachment(chunkX, chunkZ, type, out value). Players receive their own data, the entities' they see and the chunks' they have.

Threads and reload. Use live saved objects on their level's tick. World-scoped objects can be reached from several levels ticking at once, so give them a lock of your own, as for any use outside a tick. Keep codecs short and free of side effects, and don't keep typed handles across reloads.

ObsidianMod's SavedState is an example: it registers independent network ids and membership attachments on players, entities and chunks, which survive the plugin unloading and come back when it reloads.

Chunk tickets

ILevel.AddChunkTicket(int chunkX, int chunkZ, int radius = 0, bool ticking = true) keeps chunks loaded and returns an IDisposable handle. Coordinates and radius are in chunks: radius 0 keeps one chunk, radius 1 a 3 by 3 square. Take one when a machine starts, and dispose it when it no longer needs the chunks:

var ticket = level.AddChunkTicket(chunkX, chunkZ);
// Later, when this machine stops keeping its chunk active:
ticket.Dispose();
  • Loading. The next chunk pass loads or generates the square. The handle doesn't mean it's ready: GetChunkAsync can still return null until generation finishes.
  • Ticking. With ticking: true, the square ticks as it would near a player: block entities, scheduled and random ticks, and entities. A one-chunk border also stays loaded, without ticking. Natural mob spawning still needs players. ticking: false only loads the square.
  • Limits. Radius is 0 to 8. Each level allows 256 handles and 1,024 chunks, borders included. A bad radius or coordinates throw ArgumentOutOfRangeException, and going over a limit throws InvalidOperationException.
  • Ownership. Taking and disposing tickets is safe from any thread and doesn't wait for loading. A ticket belongs to the plugin whose code took it, and unloading the plugin releases them all. Disposing twice is harmless.
  • Persistence. Tickets last for the plugin's load, not across a restart. Save a machine's chunk coordinates with RegisterSavedData and take tickets again on startup. Vanilla's /forceload isn't supported yet.

ObsidianMod's KeepChunks is an example: it keeps a machine's chunks loaded and ticking without players, and unloading the plugin releases even the handles it forgot.

Level tickers

ILevel.AddTicker(Func<ValueTask> tick) runs code once every tick of one level, like NeoForge's post LevelTickEvent, for what spans many block entities, such as a network of cables and machines that ticks once rather than once per member. It returns an IDisposable; dispose it to stop. A block entity can add its network's ticker from OnLoad the first time one joins in that level:

protected override void OnLoad()
{
    var network = Networks.For(this.Level!);  // the plugin's own per-level runtime
    network.Join(this);
    network.Ticker ??= this.Level!.AddTicker(network.TickAsync);
}

protected override void OnRemoved() => Networks.For(this.Level!).Leave(this);

protected override void OnChunkUnloaded() => Networks.For(this.Level!).Leave(this);

The example adds its ticker from a mod's block entity; any plugin code with a level, a command or an event handler say, adds one the same way.

  • When. On the level's tick, after the block entities tick, so it may use them as their own ticks do, without locks. Tickers run in the order they were added, whether or not any chunk ticks, so check that members are loaded rather than loading chunks. A network whose output power changed tells the blocks around it with ILevel.UpdateNeighbors (see Redstone).
  • Ownership. A ticker belongs to the plugin whose code added it, and unloading the plugin removes it. A reloaded plugin adds its tickers again from its block entities' OnLoad. A tick that throws is logged, and the ticker keeps running.
  • Neighbours. ILevel.GetLoadedBlockEntity(Vector) and ILevel.GetLoadedBlock(Vector) read only loaded, complete chunks, returning null otherwise, and never load anything. GetLoadedBlock is safe from any thread, but several reads aren't one consistent snapshot. GetBlockEntityAsync loads the chunk instead.

Outgoing packets

Each client has one ordered queue of outgoing packets. QueuePacketAsync (on IClient or IPlayer) adds a packet and returns at once. QueuePacketEventArgs handlers then see each packet in order, and may change it or Cancel() it before it's sent.

  • Handlers run after the code that queued the packet has moved on, so a handler can await anything, even a teleport, respawn or kill of the player whose packet it handles. Awaiting QueuePacketAsync doesn't mean the handlers ran.
  • A packet a handler queues or sends goes after the one it handles.
  • SendPacket skips the handlers, but never overtakes a queued packet.
  • A slow handler holds up only its own client's packets. A handler that throws is logged, and the packet is still sent.
  • A connection with more than 65,536 unsent packets is disconnected.

On this page