Package dev.crafty.core.util
Class Lang
java.lang.Object
dev.crafty.core.util.Lang
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
colorizeList
(List<String> str) static List
<net.kyori.adventure.text.Component> colorizeListWithPlaceholders
(org.bukkit.entity.Player viewer, List<net.kyori.adventure.text.Component> components) Helper to do the same on a list of Components (like lore lines).static net.kyori.adventure.text.Component
colorizeWithPlaceholders
(org.bukkit.entity.Player viewer, net.kyori.adventure.text.Component component) Apply PlaceholderAPI replacements on the plain text of the given component, then parse the result as MiniMessage, and apply optional style fixes.static String
quotePlaceholderValues
(String expr, org.bukkit.entity.Player viewer) Used in expressionsstatic String
replacePlaceholders
(String message, org.bukkit.entity.Player player) Replaces placeholders in the given message using the PlaceholderAPI context.static void
replaceText
(org.bukkit.inventory.ItemStack item, Map<String, String> mappings)
-
Constructor Details
-
Lang
public Lang()
-
-
Method Details
-
colorize
-
colorizeList
-
colorizeWithPlaceholders
public static net.kyori.adventure.text.Component colorizeWithPlaceholders(org.bukkit.entity.Player viewer, net.kyori.adventure.text.Component component) Apply PlaceholderAPI replacements on the plain text of the given component, then parse the result as MiniMessage, and apply optional style fixes.- Parameters:
viewer
- The player for PlaceholderAPI contextcomponent
- The input component to process- Returns:
- A styled Component with placeholders and MiniMessage parsed
-
quotePlaceholderValues
Used in expressions -
colorizeListWithPlaceholders
public static List<net.kyori.adventure.text.Component> colorizeListWithPlaceholders(org.bukkit.entity.Player viewer, List<net.kyori.adventure.text.Component> components) Helper to do the same on a list of Components (like lore lines). -
replaceText
-
replacePlaceholders
Replaces placeholders in the given message using the PlaceholderAPI context.- Parameters:
message
- The input string containing placeholders to be replaced.player
- The player context for placeholder replacement. If null, global placeholders are used.- Returns:
- The message with placeholders replaced. If no PlaceholderBridge is available, the original message is returned.
-