Package com.winterhavenmc.library.messagebuilder
package com.winterhavenmc.library.messagebuilder
The core package of MessageBuilderLib, a library designed to simplify
the dynamic construction and macro-based substitution of messages in Bukkit plugins.
This will retrieve the message template for
At its core, this library provides a fluent builder API that allows plugin developers to compose rich, type-aware messages that include contextual values, such as player names, world locations, item metadata, and more.
Key Concepts
MessageBuilder
– The primary entry point into the library, providing the fluent API used to construct and send messages.QueryHandler
– A customizable source for message templates and item definitions, often backed by YAML files.MacroObjectMap
– A runtime container of objects used to resolve macros into final string values.Macro
– Plugin defined Enum that correlates to Placeholders in messages (e.g.,{PLAYER_NAME}
,{LOCATION}
) that are dynamically replaced with values drawn from objects supplied at runtime.
Design Highlights
- Supports localization and per-player language settings
- Allows multiple macros to be resolved from a single object via adapters
- Built-in support for standard Bukkit types like
Player
,Location
,ItemStack
, etc. - Extensible via custom
MacroProcessor
,Resolver
, orAdapter
implementations (planned for a future version)
Typical Usage
Messages are composed fluently using theMessageBuilder
API:
messageBuilder.compose(sender, MessageId.WELCOME)
.setMacro(Macro.PLAYER, player)
.setMacro(Macro.WORLD, world)
.send();
WELCOME
, substitute relevant
macro values, and send the result to the message recipient derived from the sender
parameter.- See Also:
-
ClassesClassDescriptionA class that allows clients of the library to access values in the constants section of the language fileA class that implements a builder pattern for messages to be sent to a player or console.