-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial beta release for 1.19, refactor a lot of stuff
- Loading branch information
Showing
60 changed files
with
2,643 additions
and
1,961 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ko_fi: Patbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
# Using Simplified Text Format/TextParser | ||
[*You can read about format here!*](/user/text-format) | ||
|
||
Usage of TextParser is simple and really customisable. You just need to import `eu.pb4.placeholders.TextParser` | ||
and call static `parse` method for admin provided configs or `parseSafe` for player provided ones. | ||
Usage of TextParser is simple and really customisable. You just need to import `eu.pb4.placeholders.api.TextParserUtils` | ||
and call static `formatText` method for admin provided configs or `formatTextSafe` for player provided ones. | ||
They both take only one String argument and output a Text object. | ||
|
||
Example | ||
``` | ||
String inputString = "<red>Hello <rb>World</rb>!" | ||
Text output = TextParser.parse(inputString); // Text output = TextParser.parseSafe(inputString); | ||
Text output = TextParserUtils.parseText(inputString); | ||
``` | ||
|
||
## Parsing with only selected ones | ||
If you want to only use selected tags, you can simply get map of all with `TextParser.getRegisteredTags()` | ||
or `TextParser.getRegisteredSafeTags()`. Then you can copy these to your own Map with String keys | ||
and `TextParser.TextFormatterHandler` values. | ||
Then you just use them with `TextParser.parse(String, Map<String, TextFormatterHandler>)`. | ||
|
||
Example | ||
``` | ||
String inputString = "<red>Hello <blue>World</blue>!" | ||
Map<String, TextParser.TextFormatterHandler> tags = Map.of("red", TextParser.getRegisteredTags().get("red"), | ||
"blue", TextParser.getRegisteredTags().get("yellow") // renames works too! | ||
); | ||
Text output = TextParser.parse(inputString, tags); | ||
``` | ||
If you want to only use selected tags, you can simply get map of all with `TextParserV1.DEFAULT.getTags()`. | ||
Then you just use them with `TextParserUtils.parseText(String, TextParserV1.TagParserGetter)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.