Interface ZentrixBroadcast
public interface ZentrixBroadcast
Represents a read-only view of a broadcast configuration.
Broadcasts are periodic messages sent to players in specific game states. They support different formats including chat messages, titles, and action bars.
Example Usage
BroadcastService service = ZentrixAPI.get().getBroadcastService();
Optional<ZentrixBroadcast> broadcast = service.getBroadcast("tips");
broadcast.ifPresent(b -> {
System.out.println("Broadcast: " + b.getId());
System.out.println("Type: " + b.getType());
System.out.println("Interval: " + b.getInterval() + "s");
System.out.println("Enabled: " + b.isEnabled());
});
- Since:
- 1.1.0
-
Method Summary
Modifier and TypeMethodDescriptionGets the action bar message for an ACTIONBAR type broadcast.Gets the addon ID that registered this broadcast.Gets custom metadata fields for this broadcast.intGets the fade-in time for TITLE broadcasts in ticks.intGets the fade-out time for TITLE broadcasts in ticks.@NotNull StringgetId()Gets the unique identifier for this broadcast.intGets the interval between broadcasts in seconds.Gets the messages for a CHAT type broadcast.Gets the game states in which this broadcast is shown.intgetStay()Gets the stay time for TITLE broadcasts in ticks.Gets the subtitle text for a TITLE type broadcast.getTitle()Gets the title text for a TITLE type broadcast.@NotNull BroadcastTypegetType()Gets the type of this broadcast.booleanChecks if this broadcast was dynamically registered by an addon.booleanChecks if this broadcast is enabled.booleanshowsInState(@NotNull GameState state) Checks if this broadcast should be shown in the given state.
-
Method Details
-
getId
Gets the unique identifier for this broadcast.- Returns:
- The broadcast ID (never null)
-
isEnabled
boolean isEnabled()Checks if this broadcast is enabled.- Returns:
trueif the broadcast is enabled
-
getInterval
int getInterval()Gets the interval between broadcasts in seconds.- Returns:
- The interval in seconds
-
getShowInStates
Gets the game states in which this broadcast is shown.- Returns:
- An unmodifiable set of game states (never null, may be empty)
-
showsInState
Checks if this broadcast should be shown in the given state.- Parameters:
state- The game state to check- Returns:
trueif the broadcast is shown in this state
-
getType
Gets the type of this broadcast.- Returns:
- The broadcast type (never null)
-
getMessages
Gets the messages for a CHAT type broadcast.For CHAT broadcasts, messages are rotated or randomly selected.
- Returns:
- An unmodifiable list of messages (never null, may be empty for non-CHAT types)
-
getTitle
Gets the title text for a TITLE type broadcast.- Returns:
- Optional containing the title, or empty if not a TITLE type
-
getSubtitle
Gets the subtitle text for a TITLE type broadcast.- Returns:
- Optional containing the subtitle, or empty if not set
-
getFadeIn
int getFadeIn()Gets the fade-in time for TITLE broadcasts in ticks.- Returns:
- The fade-in time (default 10)
-
getStay
int getStay()Gets the stay time for TITLE broadcasts in ticks.- Returns:
- The stay time (default 70)
-
getFadeOut
int getFadeOut()Gets the fade-out time for TITLE broadcasts in ticks.- Returns:
- The fade-out time (default 20)
-
getActionBar
Gets the action bar message for an ACTIONBAR type broadcast.- Returns:
- Optional containing the action bar message, or empty if not an ACTIONBAR type
-
getAddonId
Gets the addon ID that registered this broadcast.- Returns:
- Optional containing the addon ID, or empty if not addon-registered
-
isDynamicallyRegistered
boolean isDynamicallyRegistered()Checks if this broadcast was dynamically registered by an addon.- Returns:
trueif dynamically registered
-
getCustomFields
Gets custom metadata fields for this broadcast.- Returns:
- An unmodifiable map of custom fields (never null, may be empty)
-