mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add experimental json support in formats
This commit is contained in:
1 parent
7124585602
commit
0c724b330c
2 files changed
+17
No files matched your search
@@ -26,6 +26,10 @@ public class AdventureManager {
|
||||
switch (carbonChat.getLanguage().getString("formatting.type", "minimessage").toLowerCase()) {
|
||||
case "minedown":
|
||||
return processMineDown(input, placeholders);
|
||||
case "mojang":
|
||||
case "mojangson":
|
||||
case "json":
|
||||
return processMojang(input, placeholders);
|
||||
case "minimessage-markdown":
|
||||
return MiniMessage.markdown().parse(input, placeholders);
|
||||
case "minimessage":
|
||||
@@ -34,6 +38,17 @@ public class AdventureManager {
|
||||
}
|
||||
}
|
||||
|
||||
private Component processMojang(String input, String... placeholders) {
|
||||
for (int i = 0; i < placeholders.length; i += 2) {
|
||||
String placeholder = placeholders[i];
|
||||
String replacement = placeholders[i+1];
|
||||
|
||||
input = input.replace("<" + placeholder + ">", replacement);
|
||||
}
|
||||
|
||||
return getAudiences().gsonSerializer().deserialize(input);
|
||||
}
|
||||
|
||||
private Component processMineDown(String input, String... placeholders) {
|
||||
return MineDown.parse(input, placeholders);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user