Package com.djrapitops.plan.component
Interface ComponentService
- All Known Implementing Classes:
ComponentSvc
public interface ComponentService
A utility api class for dealing with rich and less-rich Minecraft message formats.
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault Component
fromAdventureLegacy
(String adventureLegacy) Converts the given input into aComponent
.fromAdventureLegacy
(String adventureLegacy, char character) Converts the given input into aComponent
.fromAutoDetermine
(String unknown) Converts the given input into aComponent
.default Component
fromBungeeLegacy
(String bungeeLegacy) Converts the given input into aComponent
.fromBungeeLegacy
(String bungeeLegacy, char character) Converts the given input into aComponent
.Converts the given input into aComponent
.default Component
fromLegacy
(String legacy) Converts the given input into aComponent
.fromLegacy
(String legacy, char character) Converts the given input into aComponent
.fromMiniMessage
(String miniMessage) Converts the given input into aComponent
.static ComponentService
Obtain the instance of ComponentService.default String
translateLegacy
(String input) Translates ampersands into section signs for color codes.translateLegacy
(String input, char inputCharacter, char outputCharacter) Translates ampersands into section signs for color codes.
-
Method Details
-
getInstance
Obtain the instance of ComponentService.- Returns:
- ComponentService implementation.
- Throws:
NoClassDefFoundError
- If Plan is not installed and this class can not be found or if older Plan version is installed.IllegalStateException
- If Plan is installed, but not enabled.
-
translateLegacy
Translates ampersands into section signs for color codes. Defaults toComponent.AMPERSAND
toComponent.SECTION
. Example:&ctext
to§ctext
.- Parameters:
input
- the input color string with color codes using ampersands (&
)- Returns:
- the same input string with ampersands (
&
) for color codes replaced with section signs (§
) - See Also:
-
translateLegacy
Translates ampersands into section signs for color codes. Example:&ctext
to§ctext
.- Parameters:
input
- the input color string with color codes using ampersands (&
)inputCharacter
- the input character for translation, usually&
.outputCharacter
- the output character for translation, usually§
.- Returns:
- the same input string with input characters for color codes replaced with output characters
- See Also:
-
fromAutoDetermine
Converts the given input into aComponent
. Converts an unknown format legacy/minimessage string into a component by attempting to guess the input format.- Parameters:
unknown
- the unknown format input string- Returns:
- a
Component
-
fromLegacy
Converts the given input into aComponent
. Input example§ctext
.- Parameters:
legacy
- the input legacy- Returns:
- a
Component
- See Also:
-
fromLegacy
Converts the given input into aComponent
. Input example§ctext
.- Parameters:
legacy
- the input legacycharacter
- the character to use as the color prefix, usually§
.- Returns:
- a
Component
- See Also:
-
fromAdventureLegacy
Converts the given input into aComponent
. Input example:&#rrggbbtext
.- Parameters:
adventureLegacy
- the input adventure legacy- Returns:
- a
Component
- See Also:
-
fromAdventureLegacy
Converts the given input into aComponent
. Input example:&#rrggbbtext
.- Parameters:
adventureLegacy
- the input adventure legacycharacter
- the character to use as the color prefix, usually&
.- Returns:
- a
Component
- See Also:
-
fromBungeeLegacy
Converts the given input into aComponent
. Input example:§x§r§r§g§g§b§btext
.- Parameters:
bungeeLegacy
- the input bungee legacy- Returns:
- a
Component
-
fromBungeeLegacy
Converts the given input into aComponent
. Input example:§x§r§r§g§g§b§btext
.- Parameters:
bungeeLegacy
- the input bungee legacycharacter
- the character to use as the color prefix, usually§
.- Returns:
- a
Component
- See Also:
-
fromMiniMessage
Converts the given input into aComponent
. Input example:<red>text</red>
.- Parameters:
miniMessage
- the input minimessage- Returns:
- a
Component
-
fromJson
Converts the given input into aComponent
. Input example:{text:"text",color:"red"}
(standard Minecraft json).- Parameters:
json
- the input json- Returns:
- a
Component
-