Created
July 26, 2020 20:37
-
-
Save Kovak/079fb6d84f86c59eaca43418102b06d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private static ITextComponent parseText(String text){ | |
String parsing = text; | |
ITextComponent component = new StringTextComponent(""); | |
while (!parsing.isEmpty()){ | |
if (parsing.contains("{") && parsing.contains("}")){ | |
int index = parsing.indexOf("{"); | |
int endIndex = parsing.indexOf("}"); | |
component.appendText(parsing.substring(0, index)); | |
String textProviderRequest = parsing.substring(index, endIndex); | |
//handle request | |
parsing = parsing.substring(endIndex); | |
} else { | |
component.appendText(parsing); | |
parsing = ""; | |
} | |
} | |
return component; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment