Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiniMessage as standard for V4 #391

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@RequiredArgsConstructor
public class TranslationManager implements com.rexcantor64.triton.api.language.TranslationManager {

private static final String MINIMESSAGE_TYPE_TAG = "[minimsg]";
private static final String LEGACY_TYPE_TAG = "[legacy]";
private static final String JSON_TYPE_TAG = "[triton_json]";

private final Triton<?, ?> triton;
Expand Down Expand Up @@ -269,12 +269,12 @@ private synchronized void setupMiniMessage() {

private @NotNull Component handleTranslationType(@NotNull String message, @NotNull Language language) {
// TODO make minimsg the default (?)
if (message.startsWith(MINIMESSAGE_TYPE_TAG)) {
return getMiniMessageInstanceForLanguage(language).deserialize(message.substring(MINIMESSAGE_TYPE_TAG.length()));
if (message.startsWith(LEGACY_TYPE_TAG)) {
return LegacyComponentSerializer.legacyAmpersand().deserialize(message.substring(LEGACY_TYPE_TAG.length()));
} else if (message.startsWith(JSON_TYPE_TAG)) {
return GsonComponentSerializer.gson().deserialize(message.substring(JSON_TYPE_TAG.length()));
} else {
return LegacyComponentSerializer.legacyAmpersand().deserialize(message);
return getMiniMessageInstanceForLanguage(language).deserialize(message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public class ComponentUtils {

public final static char SECTION_CHAR = '§';
public final static char SECTION_CHAR = '\u00A7';

/**
* Deserialize a JSON string representing a {@link Component}.
Expand Down