Interface PacketHandler
- All Superinterfaces:
AbstractBiomeRenderer
An interface for handling packet manipulation related to biome injection.
It is recommended to use the
BiomeUpdater for updating
chunks after appending a biome for immediate changes to a player.
An external packet handling library (either ProtocolLib or PacketEvents) is required for this interface.
- Since:
- 0.0.6
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe number of sections in each dimension.static interfaceFactory contract for constructing PacketHandler instances.static enumEnum constant for supported packet manipulation libraries.static enumDeprecated, for removal: This API element is subject to removal in a future version.static enumEnum constant for priority levels related to Wyck packet handling. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final WireProvider<PacketHandler.Factory> The wire-resolved factory that constructs concrete PacketHandler instances. -
Method Summary
Modifier and TypeMethodDescriptionappendBiome(VirtualBiome biome) Appends a custom biome to the packet handler's list of biomes to inject.default PacketHandlerappendBiome(VirtualBiome... biomes) Appends multiple custom biomes to the packet handler's list of biomes to inject.Clears all phony custom biomes from the packet handler's list of biomes to inject.default PacketHandlerdismissBiome(ResourceKey biomeKey) Removes a custom biome from the packet handler's list of biomes to inject by its ResourceKey.default PacketHandlerdismissBiome(VirtualBiome biome) Removes a custom biome from the packet handler's list of biomes to inject.booleanhasBiome(ResourceKey biomeKey) Checks if a custom biome is in the packet handler's list of biomes to inject by its ResourceKey.booleanhasBiome(VirtualBiome biome) Checks if a custom biome is in the packet handler's list of biomes to inject.static PacketHandlerCreates a PacketHandler using ProtocolLib as the underlying packet manipulation library.static PacketHandlerof(Plugin provider, PacketHandler.Injector injector) Creates a PacketHandler using the specified packet manipulation library.static PacketHandlerof(Plugin provider, PacketHandler.Injector injector, PacketHandler.Priority priority) Creates a PacketHandler using the specified packet manipulation library.static PacketHandlerof(Plugin provider, PacketHandler.Manipulator manipulator) Deprecated, for removal: This API element is subject to removal in a future version.static PacketHandlerof(Plugin provider, PacketHandler.Manipulator manipulator, PacketHandler.Priority priority) Creates a PacketHandler using the specified packet manipulation library.register()Registers the necessary packet listeners to handle biome injection.booleanremoveBiome(ResourceKey biomeKey) Removes a custom biome from the packet handler's list of biomes to inject by its ResourceKey.booleanremoveBiome(VirtualBiome biome) Removes a custom biome from the packet handler's list of biomes to inject.Unregisters the packet listeners handling biome injection.
-
Field Details
-
WIRE
The wire-resolved factory that constructs concrete PacketHandler instances. The implementation lives in the commons module; this points to its canonical class name.
-
-
Method Details
-
of
Creates a PacketHandler using ProtocolLib as the underlying packet manipulation library. The packet listener priority defaults to NORMAL.- Parameters:
provider- The plugin providing this PacketHandler- Returns:
- A new PacketHandler instance
- Throws:
MissingPacketManipulatorLibraryException- if ProtocolLib is not installed- Since:
- 0.0.6
-
of
Creates a PacketHandler using the specified packet manipulation library. The packet listener priority defaults to NORMAL.- Parameters:
provider- The plugin providing this PacketHandlerinjector- The packet manipulation library to use- Returns:
- A new PacketHandler instance
- Throws:
MissingPacketManipulatorLibraryException- if the specified manipulator library is not installed- Since:
- 2.1.0
-
of
@AsOf("0.0.19") @Deprecated(since="2.1.0", forRemoval=true) static PacketHandler of(Plugin provider, PacketHandler.Manipulator manipulator) Deprecated, for removal: This API element is subject to removal in a future version.Creates a PacketHandler using the specified packet manipulation library. The packet listener priority defaults to NORMAL.- Parameters:
provider- The plugin providing this PacketHandlermanipulator- The packet manipulation library to use- Returns:
- A new PacketHandler instance
- Throws:
MissingPacketManipulatorLibraryException- if the specified manipulator library is not installed- Since:
- 0.0.19
-
of
@AsOf("2.1.0") static PacketHandler of(Plugin provider, PacketHandler.Injector injector, PacketHandler.Priority priority) Creates a PacketHandler using the specified packet manipulation library.- Parameters:
provider- The plugin providing this PacketHandlerinjector- The packet manipulation library to usepriority- The priority of the packet listener- Returns:
- A new PacketHandler instance
- Throws:
MissingPacketManipulatorLibraryException- if the specified injector library is not installed- Since:
- 2.1.0
-
of
@AsOf("0.0.19") static PacketHandler of(Plugin provider, PacketHandler.Manipulator manipulator, PacketHandler.Priority priority) Creates a PacketHandler using the specified packet manipulation library.- Parameters:
provider- The plugin providing this PacketHandlermanipulator- The packet manipulation library to usepriority- The priority of the packet listener- Returns:
- A new PacketHandler instance
- Throws:
MissingPacketManipulatorLibraryException- if the specified injector library is not installed- Since:
- 0.0.19
-
register
Registers the necessary packet listeners to handle biome injection. Calling this in your plugin's onLoad/onEnable is recommended assuming your plugin soft-depends on PacketEvents and/or ProtocolLib.- Returns:
- the registered PacketHandler instance
-
unregister
Unregisters the packet listeners handling biome injection. Calling this in your plugin's onDisable is recommended.- Returns:
- the unregistered PacketHandler instance
-
appendBiome
Appends a custom biome to the packet handler's list of biomes to inject.- Parameters:
biome- The phony custom biome to append- Returns:
- the PacketHandler instance for chaining
-
appendBiome
Appends multiple custom biomes to the packet handler's list of biomes to inject.- Parameters:
biomes- The phony custom biomes to append- Returns:
- the PacketHandler instance for chaining
-
removeBiome
Removes a custom biome from the packet handler's list of biomes to inject.- Parameters:
biome- The phony custom biome to remove- Returns:
- true if the biome was removed, false if it was not found
-
dismissBiome
Removes a custom biome from the packet handler's list of biomes to inject.- Parameters:
biome- The phony custom biome to remove- Returns:
- the PacketHandler instance for chaining
-
removeBiome
Removes a custom biome from the packet handler's list of biomes to inject by its ResourceKey.- Parameters:
biomeKey- The ResourceKey of the biome to remove- Returns:
- true if the biome was removed, false if it was not found
-
dismissBiome
Removes a custom biome from the packet handler's list of biomes to inject by its ResourceKey.- Parameters:
biomeKey- The ResourceKey of the biome to remove- Returns:
- the PacketHandler instance for chaining
-
hasBiome
Checks if a custom biome is in the packet handler's list of biomes to inject.- Parameters:
biome- The phony custom biome to check- Returns:
- true if the biome is present, false otherwise
-
hasBiome
Checks if a custom biome is in the packet handler's list of biomes to inject by its ResourceKey.- Parameters:
biomeKey- The ResourceKey of the biome to check- Returns:
- true if the biome is present, false otherwise
-
clearBiomes
Clears all phony custom biomes from the packet handler's list of biomes to inject.- Returns:
- the PacketHandler instance for chaining
-
PacketHandler.Injectorinstead.