Class ExtensionMessages
java.lang.Object
com.booksaw.betterTeams.extension.ExtensionMessages
-
Constructor Summary
ConstructorsConstructorDescriptionExtensionMessages(@NotNull BetterTeamsExtension extension, @NotNull String fileName) -
Method Summary
Modifier and TypeMethodDescriptionvoid@NotNull StringGets a raw string from config with color codes translated@NotNull StringGets a message with placeholders replacedint@NotNull String@NotNull StringgetWithPrefix(@NotNull String path) @NotNull StringgetWithPrefix(@NotNull String path, @NotNull Object... replacements) Gets a message with the prefix and placeholders replacedbooleanChecks if a message key exists in the configurationvoidreload()voidReloads messages from a different file@NotNull CommandResponseCreates a CommandResponse with custom success state Includes the prefix@NotNull CommandResponseCreates a CommandResponse with custom success state and placeholders Includes the prefixvoidsend(@NotNull Collection<? extends org.bukkit.command.CommandSender> recipients, @NotNull String path) Sends a message directly to multiple CommandSenders with prefixvoidsend(@NotNull Collection<? extends org.bukkit.command.CommandSender> recipients, @NotNull String path, @NotNull Object... replacements) Sends a message directly to multiple CommandSenders with prefix and placeholdersvoidSends a message directly to a CommandSender with prefixvoidsend(@NotNull org.bukkit.command.CommandSender sender, @NotNull String path, @NotNull Object... replacements) Sends a message directly to a CommandSender with prefix and placeholdersvoidSends a raw message (no prefix) directly to a CommandSendervoidsendRaw(@NotNull org.bukkit.command.CommandSender sender, @NotNull String path, @NotNull Object... replacements) Sends a raw message (no prefix) directly to a CommandSender with placeholders@NotNull StaticMessageCreates a StaticMessage for use in BetterTeams commands Includes the prefix@NotNull StaticMessageCreates a StaticMessage with placeholders replaced Includes the prefix@NotNull StaticMessagetoStaticRaw(@NotNull String path) Creates a StaticMessage without prefix@NotNull StaticMessagetoStaticRaw(@NotNull String path, @NotNull Object... replacements) Creates a StaticMessage without prefix but with placeholders
-
Constructor Details
-
ExtensionMessages
public ExtensionMessages(@NotNull @NotNull BetterTeamsExtension extension, @NotNull @NotNull String fileName)
-
-
Method Details
-
reload
Reloads messages from a different file- Parameters:
fileName- The new file name (without .yml extension)
-
reload
public void reload() -
get
Gets a raw string from config with color codes translated- Parameters:
path- The path in messages file- Returns:
- The formatted message, or an empty string if not found
-
get
@NotNull public @NotNull String get(@NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Gets a message with placeholders replaced -
getPrefix
-
getWithPrefix
-
getWithPrefix
@NotNull public @NotNull String getWithPrefix(@NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Gets a message with the prefix and placeholders replaced -
toStatic
Creates a StaticMessage for use in BetterTeams commands Includes the prefix- Parameters:
path- The message path- Returns:
- A StaticMessage instance
-
toStatic
@NotNull public @NotNull StaticMessage toStatic(@NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Creates a StaticMessage with placeholders replaced Includes the prefix- Parameters:
path- The message pathreplacements- Pairs of key-value replacements- Returns:
- A StaticMessage instance
-
toStaticRaw
Creates a StaticMessage without prefix -
toStaticRaw
@NotNull public @NotNull StaticMessage toStaticRaw(@NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Creates a StaticMessage without prefix but with placeholders -
response
Creates a CommandResponse with custom success state Includes the prefix- Parameters:
success- Whether the command was successfulpath- The message path- Returns:
- A CommandResponse instance
-
response
@NotNull public @NotNull CommandResponse response(boolean success, @NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Creates a CommandResponse with custom success state and placeholders Includes the prefix- Parameters:
success- Whether the command was successfulpath- The message pathreplacements- Pairs of key-value replacements- Returns:
- A CommandResponse instance
-
send
public void send(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String path) Sends a message directly to a CommandSender with prefix- Parameters:
sender- The recipientpath- The message path
-
send
public void send(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Sends a message directly to a CommandSender with prefix and placeholders- Parameters:
sender- The recipientpath- The message pathreplacements- Pairs of key-value replacements
-
send
public void send(@NotNull @NotNull Collection<? extends org.bukkit.command.CommandSender> recipients, @NotNull @NotNull String path) Sends a message directly to multiple CommandSenders with prefix- Parameters:
recipients- The recipientspath- The message path
-
send
public void send(@NotNull @NotNull Collection<? extends org.bukkit.command.CommandSender> recipients, @NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Sends a message directly to multiple CommandSenders with prefix and placeholders- Parameters:
recipients- The recipientspath- The message pathreplacements- Pairs of key-value replacements
-
sendRaw
public void sendRaw(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String path) Sends a raw message (no prefix) directly to a CommandSender- Parameters:
sender- The recipientpath- The message path
-
sendRaw
public void sendRaw(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String path, @NotNull @NotNull Object... replacements) Sends a raw message (no prefix) directly to a CommandSender with placeholders- Parameters:
sender- The recipientpath- The message pathreplacements- Pairs of key-value replacements
-
has
Checks if a message key exists in the configuration -
clearCache
public void clearCache() -
getCacheSize
public int getCacheSize() -
builder
-
getMessageService
-
getExtension
-
getFileName
-