#46 is harder than I thought
This commit is contained in:
parent
0e54ce1fed
commit
85a1defb6a
3 changed files with 3 additions and 19 deletions
|
@ -110,12 +110,6 @@ public class ChatProcessing {
|
|||
// URLs + Rainbow text
|
||||
formatters.add(new ChatFormatterBuilder().setRegex(URL_PATTERN).setFormat(ChatFormatter.Format.Underlined)
|
||||
.setOpenlink("$1").build());
|
||||
/*
|
||||
* formattedmessage = formattedmessage .replace( item, String.format(
|
||||
* "\",\"color\":\"%s\"},{\"text\":\"%s\",\"color\":\"%s\",\"underlined\":\"true\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Open URL\",\"color\":\"blue\"}]}}},{\"text\":\""
|
||||
* , colormode, url, colormode, url));
|
||||
*/
|
||||
|
||||
if (PluginMain.GetPlayers().size() > 0) {
|
||||
StringBuilder namesb = new StringBuilder();
|
||||
namesb.append("(?i)(");
|
||||
|
|
|
@ -35,7 +35,6 @@ public final class ChatFormatter {
|
|||
* This method assumes that there is always a global formatter
|
||||
*/
|
||||
ArrayList<FormattedSection> sections = new ArrayList<FormattedSection>();
|
||||
List<Integer> removecharpositions = new ArrayList<Integer>();
|
||||
for (ChatFormatter formatter : formatters) {
|
||||
Matcher matcher = formatter.regex.matcher(str);
|
||||
while (matcher.find()) {
|
||||
|
@ -48,12 +47,6 @@ public final class ChatFormatter {
|
|||
DebugCommand.SendDebugMessage("First group: " + groups.get(0));
|
||||
FormattedSection section = new FormattedSection(formatter, matcher.start(), matcher.end() - 1, groups);
|
||||
sections.add(section);
|
||||
if (formatter.removecharcount != 0) {
|
||||
removecharpositions.add(section.Start + formatter.removecharcount - 1);
|
||||
removecharpositions.add(section.End - formatter.removecharcount - 1);
|
||||
}
|
||||
if (formatter.removecharpos != -1)
|
||||
removecharpositions.add(section.Start + (int) formatter.removecharpos);
|
||||
}
|
||||
}
|
||||
sections.sort((s1, s2) -> {
|
||||
|
@ -62,7 +55,6 @@ public final class ChatFormatter {
|
|||
else
|
||||
return Integer.compare(s1.Start, s2.Start);
|
||||
});
|
||||
removecharpositions.sort(null);
|
||||
boolean cont = true;
|
||||
boolean found = false;
|
||||
for (int i = 1; cont;) {
|
||||
|
@ -83,7 +75,7 @@ public final class ChatFormatter {
|
|||
}
|
||||
FormattedSection section = new FormattedSection(sections.get(i - 1).Formatters, sections.get(i).Start,
|
||||
origend, sections.get(i - 1).Matches);
|
||||
section.Formatters.addAll(sections.get(i).Formatters);
|
||||
section.Formatters.addAll(sections.get(i).Formatters); // TODO: Process remove positions here
|
||||
section.Matches.addAll(sections.get(i).Matches);
|
||||
sections.add(i, section);
|
||||
nextindex++;
|
||||
|
@ -133,7 +125,6 @@ public final class ChatFormatter {
|
|||
}
|
||||
}
|
||||
int nextremcharpospos = 0;
|
||||
DebugCommand.SendDebugMessage("RemoveCharPositions size: " + removecharpositions.size());
|
||||
for (int i = 0; i < sections.size(); i++) {
|
||||
FormattedSection section = sections.get(i);
|
||||
DebugCommand.SendDebugMessage("Applying section: " + section);
|
||||
|
@ -147,7 +138,7 @@ public final class ChatFormatter {
|
|||
start++;
|
||||
nextremcharpospos++;
|
||||
if (removecharpositions.size() > nextremcharpospos)
|
||||
nextremcharpos = removecharpositions.get(nextremcharpospos); //TODO: Section.RemoveCharCountStart/End
|
||||
nextremcharpos = removecharpositions.get(nextremcharpospos); // TODO: Section.RemoveCharCountStart/End
|
||||
}
|
||||
if (nextremcharpos == section.End) {
|
||||
end--;
|
||||
|
|
|
@ -26,7 +26,6 @@ class FormattedSection {
|
|||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder("Section(").append(Start).append(", ").append(End).append(", formatters: ")
|
||||
.append(Formatters.toString()).append(", matches: ").append(Matches.toString()).append(")")
|
||||
.toString();
|
||||
.append(Formatters.toString()).append(", matches: ").append(Matches.toString()).append(")").toString();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue