Skip to content

Commit

Permalink
[Fix] Order of Registration to PluginData values
Browse files Browse the repository at this point in the history
Old addValue method added the values in an arbitrary label order,
Order of adding makes more sense and gives developers more control.
  • Loading branch information
AuroraLS3 committed Sep 23, 2018
1 parent 836bf28 commit e72b895
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
package com.djrapitops.plan.data.element;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

Expand All @@ -25,18 +27,18 @@
*/
public class InspectContainer {

protected TreeMap<String, String> values;
protected List<String> values;
protected TreeMap<String, String> html;
protected TreeMap<String, TableContainer> tables;

public InspectContainer() {
values = new TreeMap<>();
values = new ArrayList<>();
html = new TreeMap<>();
tables = new TreeMap<>();
}

public final void addValue(String label, Serializable value) {
values.put(label, value.toString());
values.add(label + ": " + value.toString());
}

public final void addHtml(String key, String html) {
Expand All @@ -52,8 +54,8 @@ public final String parseHtml() {

if (!values.isEmpty()) {
parsed.append("<div class=\"body\">");
for (Map.Entry<String, String> entry : values.entrySet()) {
parsed.append("<p>").append(entry.getKey()).append(": ").append(entry.getValue()).append("</p>");
for (String value : values) {
parsed.append("<p>").append(value).append("</p>");
}
parsed.append("</div>");
}
Expand Down

0 comments on commit e72b895

Please sign in to comment.