Update main/chatparser.js
This commit is contained in:
parent
33abe82193
commit
9c905f83ee
1 changed files with 6 additions and 5 deletions
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Language File Version: 1.21.1
|
||||
*
|
||||
* ChatParser Version: 1.47
|
||||
* ChatParser Version: 1.48
|
||||
*
|
||||
* Update:
|
||||
* - Fix Color and format
|
||||
|
@ -99,6 +99,7 @@ function parseMinecraftColor(color) {
|
|||
function parseMinecraftFormat(format) {
|
||||
let result = '';
|
||||
if (!format) return { format: '', have: false };
|
||||
for (const key in format) { if(format[key] === 0) { result += ansiMap['reset']; break; } };
|
||||
if (format.bold === 1) result += ansiMap['bold'];
|
||||
if (format.italic === 1) result += ansiMap['italic'];
|
||||
if (format.underlined === 1) result += ansiMap['underlined'];
|
||||
|
@ -555,9 +556,9 @@ function parseMinecraftMessage(component) {
|
|||
if (NowFormat.have || prevFormat.have) {
|
||||
if (NowFormat.have) {
|
||||
text += NowFormat.format
|
||||
shouldReset = true;
|
||||
shouldReset = true;
|
||||
} else if (prevFormat.have) {
|
||||
prevFormat.format;
|
||||
text += prevFormat.format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +581,7 @@ function parseMinecraftMessage(component) {
|
|||
if (comp.fallback && !lang[comp.translate]) fallbackMsg = true;
|
||||
|
||||
if (comp.with && !fallbackMsg) {
|
||||
const withArgs = comp.with.map(arg => extractText(arg, NowColor.have ? NowColor : prevColor, NowFormat.have ? NowFormat : prevFormat) + `${VaildText(comp) ? NowFormat.have ? NowFormat.format : "" : ""}${VaildText(comp) ? NowColor.have ? NowColor.color : "" : ""}`);
|
||||
const withArgs = comp.with.map(arg => extractText(arg, NowColor.have ? NowColor : prevColor, NowFormat.have ? NowFormat : prevFormat) + `${VaildText(comp) ? NowColor.have ? NowColor.color : prevColor.color : ""}${VaildText(comp) ? NowFormat.have ? NowFormat.format : prevFormat.format : ""}`);
|
||||
let usedReplacements = 0;
|
||||
translateString = translateString.replace(/thing__placeholder__/g, 'default_thing__placeholder__');
|
||||
|
||||
|
@ -635,7 +636,7 @@ function parseMinecraftMessage(component) {
|
|||
if (comp.extra) {
|
||||
if (!Array.isArray(comp.extra)) comp.extra = [comp.extra]
|
||||
comp.extra.forEach(subComp => {
|
||||
text += extractText(subComp, NowColor.have ? NowColor : prevColor, NowFormat.have ? NowFormat : prevFormat) + `${VaildText(comp) ? NowFormat.have ? NowFormat.format : "" : ""}${VaildText(comp) ? NowColor.have ? NowColor.color : "" : ""}`;
|
||||
text += extractText(subComp, NowColor.have ? NowColor : prevColor, NowFormat.have ? NowFormat : prevFormat) + `${VaildText(comp) ? NowColor.have ? NowColor.color : prevColor.color : ""}${VaildText(comp) ? NowFormat.have ? NowFormat.format : prevFormat.format : ""}`;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue