PacketAPI

Singleton facade that delegates all PacketHub operations to the version-specific PacketHub implementation loaded at runtime.

Properties

Link copied to clipboard

Access to connection-related packet operations.

Link copied to clipboard

Access to entity-related packet operations.

Link copied to clipboard

Access to environment-related packet operations.

Link copied to clipboard

Access to interaction-related packet operations.

Link copied to clipboard

Access to inventory-related packet operations.

Link copied to clipboard

Access to miscellaneous packet operations.

Link copied to clipboard
val vfx: VfxHub

Access to visual effect packet operations.

Link copied to clipboard

Access to view and perspective packet operations.

Functions

Link copied to clipboard
open override fun createFakeEntityBuilder(player: Player, type: EntityType, location: Location): FakeEntityBuilder

Creates a new FakeEntityBuilder for faking an entity to the player.

Link copied to clipboard

Creates a new PacketListener instance backed by the global Netty pipeline hooks.

Link copied to clipboard
open override fun fakeEquipment(player: Player, entityId: Int, slot: EquipmentSlot, item: ItemStack)

Sends a fake equipment packet to the player for the specified entity slot.

Link copied to clipboard
open override fun fakeExperienceBar(player: Player, bar: Float, level: Int, experience: Int)

Sends a fake experience bar update to the player via a packet.

Link copied to clipboard
open override fun fakeExplosion(player: Player, location: Location, power: Float)

Sends a fake explosion effect to the player at the given location.

Link copied to clipboard
open override fun fakeFurnaceProgress(player: Player, cookProgress: Int, fuelProgress: Int)

Fakes the progress bars (cook time, fuel) in a furnace GUI for the player.

Link copied to clipboard
open override fun fakeItemSlot(player: Player, windowId: Int, slot: Int, item: ItemStack)

Fakes an item in a specific inventory slot for the player.

Link copied to clipboard
open override fun fakeLightning(player: Player, location: Location)

Sends a fake lightning strike effect to the player at the given location.

Link copied to clipboard
open override fun fakePlayerName(player: Player, target: Player, name: String)

Fakes the display name of a player in the tab list or above their head.

Link copied to clipboard
open override fun fakeStatistic(player: Player, statistic: Statistic, value: Int)

Sends a fake statistic update to the player via a packet.

Link copied to clipboard
open override fun forceHeldSlot(player: Player, slot: Int)

Forces the player's held item slot to the specified index via a packet.

Link copied to clipboard
open override fun getCoroutineDispatcher(player: Player): CoroutineDispatcher

Gets a CoroutineDispatcher that executes tasks on the player's Netty event loop.

Link copied to clipboard
open override fun getNetworkSettings(player: Player): NetworkSettings

Gets the network settings (e.g. protocol version, latency) for a player.

Link copied to clipboard
open override fun hideCredits(player: Player)

Hides the end credits screen for the player via a packet.

Link copied to clipboard
open override fun hideEntity(player: Player, entityId: Int)

Hides an entity from the player via a packet.

Link copied to clipboard
fun init(plugin: Plugin)

Resolves and loads the version-specific PacketHub implementation for the running server.

Link copied to clipboard
open override fun injectPlayer(player: Player)

Injects a player into the Netty pipeline to begin packet interception.

Link copied to clipboard
open override fun localSound(player: Player, sound: Sound, location: Location, volume: Float = 1.0f, pitch: Float = 1.0f)

Plays a sound at a specific location for the player only, without affecting other players.

Link copied to clipboard
open override fun lockInventorySlot(player: Player, slot: Int, item: ItemStack?)

Locks an inventory slot for the player by sending a fake item packet.

Link copied to clipboard
open override fun placeFakeBlock(player: Player, location: Location, material: Material)

Sends a fake block placement packet to the player at the given location.

Link copied to clipboard
open override fun removeFakeBlock(player: Player, location: Location)

Sends a fake block removal packet to the player at the given location, restoring the appearance of the original block.

Link copied to clipboard
open override fun removePlayer(player: Player)

Removes a player from the Netty pipeline, stopping packet interception.

Link copied to clipboard
open override fun resetCamera(player: Player)

Resets the player's camera back to their own perspective.

Link copied to clipboard
open override fun resetWorldBorder(player: Player)

Resets the player's world border to the server's actual world border.

Link copied to clipboard
open override fun sendActionBar(player: Player, message: String)

Sends an action bar message to the player via a packet.

Link copied to clipboard
open override fun sendCamera(player: Player, entityId: Int)

Sets the player's camera to the specified entity.

Link copied to clipboard
open override fun sendFakeBlocks(player: Player, builder: FakeBlockBuilder.() -> Unit)

Sends fake block changes to the player using a FakeBlockBuilder.

Link copied to clipboard
open override fun sendMetadata(player: Player, entityId: Int, data: MetadataBuilder.() -> Unit)

Sends a raw metadata update for an entity to the player.

Link copied to clipboard
open override fun sendOpenSign(player: Player, location: Location, front: Boolean)

Opens a sign editor for the player at the given location.

Link copied to clipboard
open override fun sendPacket(player: Player, packet: Any)

Sends a raw NMS packet object to the player.

Link copied to clipboard
open override fun sendParticles(player: Player, type: Particle, location: Location, amount: Int, offset: Vector, extra: Double, data: Any?)

Sends a particle effect to the player via a packet.

Link copied to clipboard
open override fun sendRawPacket(player: Player, channel: String, buf: ByteBuf)

Sends a raw packet via a custom plugin channel.

Link copied to clipboard
open override fun sendSound(player: Player, type: Sound, volume: Float, pitch: Float, relative: Boolean, offset: Vector)

Sends a named sound effect to the player via a packet.

Link copied to clipboard
open override fun sendTitle(player: Player, title: String, subtitle: String, fadeIn: Int, stay: Int, fadeOut: Int)

Sends a title and subtitle to the player via packets.

Link copied to clipboard
open override fun sendWorldBorder(player: Player, builder: WorldBorderBuilder.() -> Unit)

Sends a world border update packet to the player.

Link copied to clipboard
open override fun setBlockCrack(player: Player, location: Location, stage: Int)

Sends a block crack (mining progress) animation to the player.

Link copied to clipboard
open override fun setBowAnimation(player: Player, entityId: Int)

Sends a bow/crossbow charging animation packet for an entity to the player.

Link copied to clipboard
open override fun setCameraEntity(player: Player, entityId: Int)

Sets the player's camera to spectate the specified entity.

Link copied to clipboard
open override fun setEatingAnimation(player: Player, entityId: Int)

Sends an eating animation packet for an entity to the player.

Link copied to clipboard
open override fun setEntityGlowing(player: Player, entityId: Int, glowing: Boolean)

Sets the glowing visual effect on an entity for the player via a metadata packet.

Link copied to clipboard
open override fun setEntityMotion(player: Player, entityId: Int, velocity: Vector)

Sets the velocity/motion of an entity for the player via a packet.

Link copied to clipboard
open override fun setEntityOnFire(player: Player, entityId: Int, onFire: Boolean)

Sets the on-fire visual state of an entity for the player via a metadata packet.

Link copied to clipboard
open override fun setEntityScale(player: Player, entityId: Int, scale: Float)

Sets the display scale of an entity for the player via a metadata packet.

Link copied to clipboard
open override fun setEntityUpsideDown(player: Player, entityId: Int, upsideDown: Boolean)

Sets whether an entity appears upside-down for the player via a metadata packet.

Link copied to clipboard
open override fun setFakeBiome(player: Player, biomeKey: String)

Sends a fake biome override to the player for their current chunk.

Link copied to clipboard
open override fun setFakeSkyColor(player: Player, color: Int)

Sends a fake sky/fog color to the player (via biome hack or similar).

Link copied to clipboard
open override fun setFakeTime(player: Player, time: Long, locked: Boolean = false)

Sends a fake time update to the player.

Link copied to clipboard
open override fun setFakeWeather(player: Player, rain: Boolean, thunder: Boolean)

Sends a fake weather state to the player.

Link copied to clipboard
open override fun setFakeWorldBorder(player: Player, builder: FakeWorldBorderBuilder.() -> Unit)

Sends a fake world border configuration to the player.

Link copied to clipboard
open override fun setGuardPose(player: Player, entityId: Int)

Sends a shield/sword guard pose packet for an entity to the player.

Link copied to clipboard
open override fun setItemCooldown(player: Player, item: Material, ticks: Int)

Sets a fake item cooldown for the player.

Link copied to clipboard
open override fun setSleepAnimation(player: Player, entityId: Int, location: Location)

Sends a sleep animation packet for an entity at the given location to the player.

Link copied to clipboard
open override fun setWeatherLevel(player: Player, rainLevel: Float, thunderLevel: Float)

Sets the rain and thunder intensity levels for the player via packets.

Link copied to clipboard
open override fun showCredits(player: Player)

Shows the end credits screen to the player via a packet.

Link copied to clipboard
open override fun showEntity(player: Player, entityId: Int)

Shows a previously hidden entity to the player.

Link copied to clipboard
open override fun showFakeDeathScreen(player: Player, message: String)

Shows a fake death screen to the player via a packet.

Link copied to clipboard
open override fun transformEntityType(player: Player, entityId: Int, type: EntityType)

Sends a fake entity type transformation to the player, making the entity appear as a different type without changing it server-side.

Link copied to clipboard
open override fun updateInventoryTitle(player: Player, title: String)

Updates the title of the player's currently open inventory via a packet.