Overview
TheProcessHandler class is Runway’s core utility for processing text components and items with MiniMessage formatting, placeholders, and custom styling. It handles the conversion of strings and components with support for PlaceholderAPI, MiniPlaceholders, and custom placeholders defined in your configuration.
Package: me.mrafonso.runway.util
Getting an Instance
Runway does not expose a public API to access theProcessHandler directly. If you need to use Runway’s processing capabilities in your own plugin, you should create your own instance:
Runway uses ProcessHandler internally for packet processing. The examples below show how the class works, but most users won’t need to instantiate it directly.
Constructor
The ConfigManager instance used to access configuration and placeholder settings
Methods
processComponent (String)
Processes a string into a Component with MiniMessage formatting, placeholders, and styling applied.The string to process. Can contain MiniMessage tags, placeholders, and special prefixes.Special Prefixes:
[mm]- Indicates MiniMessage formatting (required ifrequire-prefix.minimessageis enabled)[p]- Indicates placeholder processing (required ifrequire-prefix.placeholdersis enabled)
The player context for placeholder resolution. Required for player-specific placeholders from PlaceholderAPI or MiniPlaceholders.
The processed Component with all formatting and placeholders applied. Returns
Component.empty() if input is null.Example
processComponent (Component)
Processes an existing Component by serializing it and applying all formatting rules.The Component to process. Will be serialized to MiniMessage format and reprocessed.
The player context for placeholder resolution.
The reprocessed Component with all formatting applied.
Example
processComponent (List)
Processes a list of Components, applying formatting to each one.The list of Components to process. Commonly used for item lore.
The player context for placeholder resolution.
A new list containing all processed Components. Returns empty list if input is null.
Example
processItem
Processes an ItemStack by applying formatting to its display name and lore.The PacketEvents ItemStack to process. Both display name and lore will have formatting applied.
The player context for placeholder resolution in item text.
The processed ItemStack with formatted display name and lore. Returns null if input is null.
This method uses PacketEvents’
ItemStack type, not Bukkit’s. The conversion is handled internally using SpigotConversionUtil.Example
processItems
Processes a list of ItemStacks, applying formatting to each one.The list of PacketEvents ItemStacks to process.
The player context for placeholder resolution.
A new list containing all processed ItemStacks. Returns empty list if input is null.
Example
reloadPlaceholders
Reloads custom placeholders from the placeholders configuration file. This method should be called after modifying placeholders.yml.This method is automatically called when Runway reloads. You typically don’t need to call this manually unless you’re modifying placeholders programmatically.
Example
Configuration Options
TheProcessHandler behavior is controlled by several configuration options in config.yml:
- require-prefix.minimessage (default:
true) - Whether[mm]prefix is required for MiniMessage formatting - require-prefix.placeholders (default:
true) - Whether[p]prefix is required for placeholder processing - placeholder-hook.placeholderapi (default:
false) - Enable PlaceholderAPI integration - placeholder-hook.miniplaceholders (default:
false) - Enable MiniPlaceholders integration - ignore-legacy (default:
false) - Whether to ignore legacy color codes (§) - disable-italics (default:
true) - Automatically disable italics for processed text
Full Example
Here’s a complete example showing how to use ProcessHandler in your plugin:See Also
- ConfigManager - Access Runway’s configuration
- MiniMessage Documentation - Learn about MiniMessage formatting