mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-27 22:10:30 +01:00
New Icon classes since all FA icons are not in the same family.
This commit is contained in:
parent
7b95cbb1d3
commit
a9958253d4
@ -7,6 +7,7 @@ package com.djrapitops.plan.data.element;
|
||||
import com.djrapitops.plan.data.store.mutators.formatting.Formatter;
|
||||
import com.djrapitops.plan.utilities.FormatUtils;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@ -39,7 +40,10 @@ public class TableContainer {
|
||||
}
|
||||
|
||||
public TableContainer(boolean players, String... header) {
|
||||
this.header = FormatUtils.mergeArrays(new String[]{Html.FONT_AWESOME_ICON.parse("user") + " Player"}, header);
|
||||
this.header = FormatUtils.mergeArrays(
|
||||
new String[]{Icon.called("user").build() + " Player"},
|
||||
header
|
||||
);
|
||||
this.formatters = new Formatter[this.header.length];
|
||||
values = new ArrayList<>();
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.djrapitops.plan.data.plugin;
|
||||
import com.djrapitops.plan.data.element.AnalysisContainer;
|
||||
import com.djrapitops.plan.data.element.InspectContainer;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -23,7 +25,7 @@ public abstract class PluginData {
|
||||
private final ContainerSize size;
|
||||
private final String sourcePlugin;
|
||||
|
||||
private String pluginIcon;
|
||||
private Icon pluginIcon;
|
||||
private String iconColor;
|
||||
|
||||
private String helpText;
|
||||
@ -39,12 +41,24 @@ public abstract class PluginData {
|
||||
|
||||
public abstract AnalysisContainer getServerData(Collection<UUID> uuids, AnalysisContainer fillThis) throws Exception;
|
||||
|
||||
protected final void setPluginIcon(String pluginIcon) {
|
||||
protected final void setPluginIcon(Icon pluginIcon) {
|
||||
this.pluginIcon = pluginIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@code setPluginIcon(Icon)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
protected final void setPluginIcon(String pluginIcon) {
|
||||
this.pluginIcon = Icon.called(pluginIcon != null ? pluginIcon : "cube").build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@code setPluginIcon(Icon)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
protected final void setIconColor(String iconColor) {
|
||||
this.iconColor = iconColor;
|
||||
pluginIcon.setColor(Color.matchString(iconColor));
|
||||
}
|
||||
|
||||
public final String getHelpText() {
|
||||
@ -52,7 +66,7 @@ public abstract class PluginData {
|
||||
}
|
||||
|
||||
public final String parsePluginIcon() {
|
||||
return pluginIcon != null ? Html.FA_COLORED_ICON.parse((iconColor != null ? iconColor : "black"), pluginIcon) : Html.FONT_AWESOME_ICON.parse("cube");
|
||||
return (pluginIcon != null ? pluginIcon : Icon.called("cube").build()).toHtml();
|
||||
}
|
||||
|
||||
public final ContainerSize getSize() {
|
||||
@ -82,12 +96,24 @@ public abstract class PluginData {
|
||||
return Objects.hashCode(size, sourcePlugin, pluginIcon);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@code getWithIcon(String, Icon)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public final String getWithIcon(String text, String icon) {
|
||||
return getWithIcon(text, icon, "");
|
||||
return getWithIcon(text, Icon.called(icon).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@code getWithIcon(String, Icon)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public final String getWithIcon(String text, String icon, String color) {
|
||||
return Html.FA_COLORED_ICON.parse(color, icon) + " " + text;
|
||||
return getWithIcon(text, Icon.called(icon).of(Color.matchString(color)).build());
|
||||
}
|
||||
|
||||
public final String getWithIcon(String text, Icon icon) {
|
||||
return icon.toHtml() + " " + text;
|
||||
}
|
||||
|
||||
public final void setAnalysisData(com.djrapitops.plan.data.store.containers.AnalysisContainer analysisData) {
|
||||
|
@ -4,7 +4,7 @@ import com.djrapitops.plan.api.exceptions.WebUserAuthException;
|
||||
import com.djrapitops.plan.system.webserver.auth.FailReason;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
||||
import com.djrapitops.plan.utilities.FormatUtils;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
@ -18,7 +18,7 @@ public class PromptAuthorizationResponse extends ErrorResponse {
|
||||
+ "<br>If you have forgotten your password, ask a staff member to delete your old user and re-register.";
|
||||
|
||||
private PromptAuthorizationResponse() {
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("lock") + " 401 Unauthorized");
|
||||
super.setTitle(Icon.called("lock").build() + " 401 Unauthorized");
|
||||
}
|
||||
|
||||
public static PromptAuthorizationResponse getBasicAuthResponse() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.djrapitops.plan.system.webserver.response.errors;
|
||||
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Family;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
@ -9,12 +10,12 @@ import com.djrapitops.plan.utilities.html.Html;
|
||||
public class ForbiddenResponse extends ErrorResponse {
|
||||
public ForbiddenResponse() {
|
||||
super.setHeader("HTTP/1.1 403 Forbidden");
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("hand-stop-o") + " 403 Forbidden - Access Denied");
|
||||
super.setTitle(Icon.called("hand-paper").of(Family.REGULAR) + " 403 Forbidden - Access Denied");
|
||||
}
|
||||
|
||||
public ForbiddenResponse(String msg) {
|
||||
super.setHeader("HTTP/1.1 403 Forbidden");
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("hand-stop-o") + " 403 Forbidden - Access Denied");
|
||||
super.setTitle(Icon.called("hand-paper").of(Family.REGULAR) + " 403 Forbidden - Access Denied");
|
||||
super.setParagraph(msg);
|
||||
super.replacePlaceholders();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.djrapitops.plan.system.webserver.response.errors;
|
||||
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
@ -11,7 +12,7 @@ public class InternalErrorResponse extends ErrorResponse {
|
||||
public InternalErrorResponse(String cause, Throwable e) {
|
||||
super.setHeader("HTTP/1.1 500 Internal Error");
|
||||
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("bug") + " 500 Internal Error occurred");
|
||||
super.setTitle(Icon.called("bug") + " 500 Internal Error occurred");
|
||||
|
||||
StringBuilder paragraph = new StringBuilder();
|
||||
paragraph.append("Please report this issue here: ");
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.djrapitops.plan.system.webserver.response.errors;
|
||||
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
@ -10,14 +10,14 @@ public class NotFoundResponse extends ErrorResponse {
|
||||
|
||||
public NotFoundResponse() {
|
||||
super.setHeader("HTTP/1.1 404 Not Found");
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("map-signs") + " 404 Not Found");
|
||||
super.setTitle(Icon.called("map-signs") + " 404 Not Found");
|
||||
super.setParagraph("Page does not exist.");
|
||||
super.replacePlaceholders();
|
||||
}
|
||||
|
||||
public NotFoundResponse(String msg) {
|
||||
super.setHeader("HTTP/1.1 404 Not Found");
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("map-signs") + " 404 Not Found");
|
||||
super.setTitle(Icon.called("map-signs") + " 404 Not Found");
|
||||
super.setParagraph(msg);
|
||||
super.replacePlaceholders();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import com.djrapitops.plan.system.info.server.ServerProperties;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.djrapitops.plugin.api.Benchmark;
|
||||
import com.djrapitops.plugin.api.utility.log.ErrorLogger;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
@ -39,7 +40,7 @@ public class DebugPageResponse extends ErrorResponse {
|
||||
|
||||
public DebugPageResponse() {
|
||||
super.setHeader("HTTP/1.1 200 OK");
|
||||
super.setTitle(Html.FONT_AWESOME_ICON.parse("bug") + " Debug Information");
|
||||
super.setTitle(Icon.called("bug") + " Debug Information");
|
||||
super.setParagraph(buildParagraph());
|
||||
replacePlaceholders();
|
||||
}
|
||||
|
@ -28,7 +28,15 @@ public enum Html {
|
||||
COLOR_E("<span class=\"yellow\">"),
|
||||
COLOR_F("<span class=\"white\">"),
|
||||
|
||||
/**
|
||||
* @deprecated Use com.djrapitops.plan.utilities.html.icon.Icon instead
|
||||
*/
|
||||
@Deprecated
|
||||
FONT_AWESOME_ICON("<i class=\"fa fa-${0}\"></i>"),
|
||||
/**
|
||||
* @deprecated Use com.djrapitops.plan.utilities.html.icon.Icon instead
|
||||
*/
|
||||
@Deprecated
|
||||
FA_COLORED_ICON("<i class=\"col-${0} fa fa-${1}\"></i>"),
|
||||
GREEN_THUMB("<i class=\"fa fa-thumbs-up g\"></i>"),
|
||||
YELLOW_FLAG("<i class=\"fa fa-flag o\"></i>"),
|
||||
@ -67,38 +75,6 @@ public enum Html {
|
||||
TABLE_START_2("<table class=\"table table-striped\"><thead><tr><th>${0}</th><th>${1}</th></tr></thead><tbody>"),
|
||||
TABLE_START_3("<table class=\"table table-striped\"><thead><tr><th>${0}</th><th>${1}</th><th>${2}</th></tr></thead><tbody>"),
|
||||
TABLE_START_4("<table class=\"table table-striped\"><thead><tr><th>${0}</th><th>${1}</th><th>${2}</th><th>${3}</th></tr></thead><tbody>"),
|
||||
TABLE_SESSIONS(DIV_W_CLASS_STYLE.parse("box-footer scrollbar", "padding: 2px;",
|
||||
TABLE_START_4.parse("Player", "Started", "Length", "World - Time") + "${3}" + TABLE_END.parse())
|
||||
),
|
||||
TABLE_PLAYERS_FOOTER("<table class=\"table table-bordered table-striped table-hover player-table dataTable\"><thead><tr>" +
|
||||
"<th><i class=\"fa fa-user\"></i> Name</th>" +
|
||||
"<th><i class=\"fa fa-check\"></i> Activity Index</th>" +
|
||||
"<th><i class=\"fa fa-clock-o\"></i> Playtime</th>" +
|
||||
"<th><i class=\"far fa-calendar-plus\"></i> Sessions</th>" +
|
||||
"<th><i class=\"fa fa-user-plus\"></i> Registered</th>" +
|
||||
"<th><i class=\"far fa-calendar-check\"></i> Last Seen</th>" +
|
||||
"<th><i class=\"fa fa-globe\"></i> Geolocation</th></thead>" +
|
||||
"<tfoot><tr><th><i class=\"fa fa-user\"></i> Name</th>" +
|
||||
"<th><i class=\"fa fa-check\"></i> Activity Index</th>" +
|
||||
"<th><i class=\"fa fa-clock-o\"></i> Playtime</th>" +
|
||||
"<th><i class=\"far fa-calendar-plus\"></i> Sessions</th>" +
|
||||
"<th><i class=\"fa fa-user-plus\"></i> Registered</th>" +
|
||||
"<th><i class=\"far fa-calendar-check\"></i> Last Seen</th>" +
|
||||
"<th><i class=\"fa fa-globe\"></i> Geolocation</th>" +
|
||||
"</tr></tfoot><tbody>${0}</tbody></table>"),
|
||||
TABLE_PLAYERS("<table class=\"table table-bordered table-striped table-hover player-table dataTable\"><thead><tr>" +
|
||||
"<th><i class=\"fa fa-user\"></i> Name</th>" +
|
||||
"<th><i class=\"fa fa-check\"></i> Activity Index</th>" +
|
||||
"<th><i class=\"fa fa-clock-o\"></i> Playtime</th>" +
|
||||
"<th><i class=\"far fa-calendar-plus\"></i> Sessions</th>" +
|
||||
"<th><i class=\"fa fa-user-plus\"></i> Registered</th>" +
|
||||
"<th><i class=\"far fa-calendar-check\"></i> Last Seen</th>" +
|
||||
"<th><i class=\"fa fa-globe\"></i> Geolocation</th></thead>" +
|
||||
"<tbody>${0}</tbody></table>"),
|
||||
TABLE_SESSIONS_START(TABLE_START_3.parse("Session Started", "Session Ended", "Session Length")),
|
||||
TABLE_KILLS_START(TABLE_START_3.parse(FONT_AWESOME_ICON.parse("clock-o") + " Time", "Killed", "With")),
|
||||
TABLE_FACTIONS_START(TABLE_START_4.parse(FONT_AWESOME_ICON.parse("flag") + " Faction", FONT_AWESOME_ICON.parse("bolt") + " Power", FONT_AWESOME_ICON.parse("map-o") + " Land", FONT_AWESOME_ICON.parse("user") + " Leader")),
|
||||
TABLE_TOWNS_START(TABLE_START_4.parse(FONT_AWESOME_ICON.parse("bank") + " Town", FONT_AWESOME_ICON.parse("users") + " Residents", FONT_AWESOME_ICON.parse("map-o") + " Land", FONT_AWESOME_ICON.parse("user") + " Mayor")),
|
||||
TABLELINE_2("<tr><td><b>${0}</b></td><td>${1}</td></tr>"),
|
||||
TABLELINE_3("<tr><td><b>${0}</b></td><td>${1}</td><td>${2}</td></tr>"),
|
||||
TABLELINE_4("<tr><td><b>${0}</b></td><td>${1}</td><td>${2}</td><td>${3}</td></tr>"),
|
||||
|
@ -10,6 +10,9 @@ import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.info.server.ServerProperties;
|
||||
import com.djrapitops.plan.utilities.html.graphs.line.OnlineActivityGraph;
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icons;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
@ -166,16 +169,24 @@ public class HtmlStructure {
|
||||
|
||||
StringBuilder html = new StringBuilder("<p>");
|
||||
if (offline) {
|
||||
html.append(Html.FA_COLORED_ICON.parse("red", "circle")).append(" ").append(online);
|
||||
html.append(Icon.called("circle").of(Color.RED))
|
||||
.append(" Offline");
|
||||
} else {
|
||||
html.append(Html.FA_COLORED_ICON.parse("green", "circle")).append(" Online (").append(online).append(")");
|
||||
html.append(Icon.called("circle").of(Color.GREEN))
|
||||
.append(" Online (")
|
||||
.append(online)
|
||||
.append(")");
|
||||
}
|
||||
html.append("</p>");
|
||||
if (op) {
|
||||
html.append("<p>").append(Html.FA_COLORED_ICON.parse("blue", "superpowers")).append(" Operator</p>");
|
||||
html.append("<p>")
|
||||
.append(Icons.OPERATOR)
|
||||
.append(" Operator</p>");
|
||||
}
|
||||
if (banned) {
|
||||
html.append("<p>").append(Html.FA_COLORED_ICON.parse("red", "gavel")).append(" Banned");
|
||||
html.append("<p>")
|
||||
.append(Icons.BANNED)
|
||||
.append(" Banned");
|
||||
}
|
||||
return html.toString();
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package com.djrapitops.plan.utilities.html.icon;
|
||||
|
||||
public enum Color {
|
||||
RED("col-red"),
|
||||
PINK("col-pink"),
|
||||
PURPLE("col-purple"),
|
||||
DEEP_PURPLE("col-deep-purple"),
|
||||
INDIGO("col-indigo"),
|
||||
BLUE("col-blue"),
|
||||
LIGHT_BLUE("col-light-blue"),
|
||||
CYAN("col-cyan"),
|
||||
TEAL("col-teal"),
|
||||
GREEN("col-green"),
|
||||
LIGHT_GREEN("col-light-green"),
|
||||
LIME("col-lime"),
|
||||
YELLOW("col-yellow"),
|
||||
AMBER("col-amber"),
|
||||
ORANGE("col-orange"),
|
||||
DEEP_ORANGE("col-deep-orange"),
|
||||
BROWN("col-brown"),
|
||||
GREY("col-grey"),
|
||||
BLUE_GREY("col-blue-grey"),
|
||||
BLACK("col-black"),
|
||||
NONE("");
|
||||
|
||||
private final String htmlClass;
|
||||
|
||||
Color(String htmlClass) {
|
||||
this.htmlClass = htmlClass;
|
||||
}
|
||||
|
||||
public static Color matchString(String name) {
|
||||
String lowerCaseName = name.toLowerCase();
|
||||
for (Color color : values()) {
|
||||
if (color.htmlClass.contains(lowerCaseName)) {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
return Color.BLACK;
|
||||
}
|
||||
|
||||
public String getHtmlClass() {
|
||||
return htmlClass;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.djrapitops.plan.utilities.html.icon;
|
||||
|
||||
public enum Family {
|
||||
SOLID("<i class=\"", " fa fa-", "\"></i>"),
|
||||
REGULAR("<i class=\"", " far fa-", "\"></i>"),
|
||||
BRAND("<i class=\"", " fab fa-", "\"></i>"),
|
||||
LINE("<i class=\"", " material-icons\">", "</i>");
|
||||
|
||||
private final String prefix;
|
||||
private final String middle;
|
||||
private final String suffix;
|
||||
|
||||
Family(String prefix, String middle, String suffix) {
|
||||
this.prefix = prefix;
|
||||
this.middle = middle;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public String appendAround(String color, String name) {
|
||||
return prefix + color + middle + name + suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.djrapitops.plan.utilities.html.icon;
|
||||
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
public class Icon {
|
||||
|
||||
private Family type;
|
||||
private String name;
|
||||
private Color color;
|
||||
|
||||
private Icon() {
|
||||
type = Family.SOLID;
|
||||
color = Color.NONE;
|
||||
}
|
||||
|
||||
public Icon(Family type, String name, Color color) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public static Builder called(String name) {
|
||||
return new Builder().called(name);
|
||||
}
|
||||
|
||||
public static Builder of(Family type) {
|
||||
return new Builder().of(type);
|
||||
}
|
||||
|
||||
public static Builder of(Color color) {
|
||||
return new Builder().of(color);
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String toHtml() {
|
||||
return type.appendAround(color.getHtmlClass(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toHtml();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private final Icon icon;
|
||||
|
||||
Builder() {
|
||||
this.icon = new Icon();
|
||||
}
|
||||
|
||||
public Builder called(String name) {
|
||||
icon.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder of(Color color) {
|
||||
icon.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder of(Family type) {
|
||||
icon.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Icon build() {
|
||||
Verify.nullCheck(icon.name, () -> new IllegalStateException("'name' was not defined yet!"));
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return build().toHtml();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.djrapitops.plan.utilities.html.icon;
|
||||
|
||||
/**
|
||||
* Class that contains commonly used {@link Icon}s.
|
||||
*
|
||||
* @see Icon
|
||||
*/
|
||||
public class Icons {
|
||||
|
||||
public static final Icon PLAYTIME = Icon.called("clock").of(Color.GREEN).of(Family.REGULAR).build();
|
||||
public static final Icon SESSION_LENGTH = Icon.called("clock").of(Color.TEAL).of(Family.REGULAR).build();
|
||||
public static final Icon AFK_LENGTH = Icon.called("clock").of(Color.GREY).of(Family.REGULAR).build();
|
||||
public static final Icon PLAYER_KILLS = Icon.called("crosshairs").of(Color.RED).build();
|
||||
public static final Icon MOB_KILLS = Icon.called("crosshairs").of(Color.GREEN).build();
|
||||
public static final Icon DEATHS = Icon.called("frown").of(Color.RED).of(Family.REGULAR).build();
|
||||
public static final Icon SESSION_COUNT = Icon.called("calendar-check").of(Color.TEAL).of(Family.REGULAR).build();
|
||||
public static final Icon OPERATOR = Icon.called("superpowers").of(Color.BLUE).of(Family.BRAND).build();
|
||||
public static final Icon BANNED = Icon.called("gavel").of(Color.RED).build();
|
||||
public static final Icon SERVER = Icon.called("server").of(Color.GREEN).build();
|
||||
|
||||
private Icons() {
|
||||
/* Static variable class */
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,9 @@
|
||||
*/
|
||||
package com.djrapitops.plan.utilities.html.structure;
|
||||
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -20,18 +23,32 @@ public class AccordionElementContentBuilder {
|
||||
this.html = new StringBuilder();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AccordionElementContentBuilder addRowBold(String color, String icon, String text, Serializable value) {
|
||||
html.append("<p><i class=\"col-")
|
||||
.append(color).append(" fa fa-").append(icon)
|
||||
.append("\"></i> ").append(text);
|
||||
return addRowBold(Icon.called(icon).of(Color.matchString(color)), text, value);
|
||||
}
|
||||
|
||||
public AccordionElementContentBuilder addRowBold(Icon.Builder iconBuilder, String text, Serializable value) {
|
||||
return addRowBold(iconBuilder.build(), text, value);
|
||||
}
|
||||
|
||||
public AccordionElementContentBuilder addRowBold(Icon icon, String text, Serializable value) {
|
||||
html.append("<p>").append(icon).append(" ").append(text);
|
||||
html.append("<span class=\"pull-right\"><b>").append(value).append("</b></span></p>");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AccordionElementContentBuilder addRow(String color, String icon, String text, Serializable value) {
|
||||
html.append("<p><i class=\"col-")
|
||||
.append(color).append(" fa fa-").append(icon)
|
||||
.append("\"></i> ").append(text);
|
||||
return addRow(Icon.called(icon).of(Color.matchString(color)), text, value);
|
||||
}
|
||||
|
||||
public AccordionElementContentBuilder addRow(Icon.Builder iconBuilder, String text, Serializable value) {
|
||||
return addRow(iconBuilder.build(), text, value);
|
||||
}
|
||||
|
||||
public AccordionElementContentBuilder addRow(Icon icon, String text, Serializable value) {
|
||||
html.append("<p>").append(icon).append(" ").append(text);
|
||||
html.append("<span class=\"pull-right\">").append(value).append("</span></p>");
|
||||
return this;
|
||||
}
|
||||
|
@ -31,12 +31,15 @@ public class RecentLoginList {
|
||||
}
|
||||
|
||||
public String toHtml() {
|
||||
StringBuilder html = new StringBuilder();
|
||||
|
||||
List<RecentLogin> recentLogins = getMostRecentLogins();
|
||||
|
||||
Formatter<DateHolder> formatter = Formatters.year();
|
||||
Formatter<DateHolder> formatter = Formatters.second();
|
||||
|
||||
if (recentLogins.isEmpty()) {
|
||||
return "<li>No Recent Logins</li>";
|
||||
}
|
||||
|
||||
StringBuilder html = new StringBuilder();
|
||||
int i = 0;
|
||||
for (RecentLogin recentLogin : recentLogins) {
|
||||
if (i >= 20) {
|
||||
|
@ -16,6 +16,9 @@ import com.djrapitops.plan.data.time.WorldTimes;
|
||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
||||
import com.djrapitops.plan.system.settings.theme.ThemeVal;
|
||||
import com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icons;
|
||||
import com.djrapitops.plugin.utilities.Format;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -99,19 +102,19 @@ public class ServerAccordion extends AbstractAccordion {
|
||||
String title = serverName + "<span class=\"pull-right\">" + play + "</span>";
|
||||
|
||||
String leftSide = new AccordionElementContentBuilder()
|
||||
.addRowBold("blue", "superpowers", "Operator", operator ? "Yes" : "No")
|
||||
.addRowBold("red", "gavel", "Banned", banned ? "Yes" : "No")
|
||||
.addRowBold("light-green", "user-plus", "Registered", Formatters.year().apply(() -> registered))
|
||||
.addRowBold(Icons.OPERATOR, "Operator", operator ? "Yes" : "No")
|
||||
.addRowBold(Icons.BANNED, "Banned", banned ? "Yes" : "No")
|
||||
.addRowBold(Icon.called("user-plus").of(Color.LIGHT_GREEN), "Registered", Formatters.year().apply(() -> registered))
|
||||
.addBreak()
|
||||
.addRowBold("teal", "calendar-check-o", "Sessions", sessionCount)
|
||||
.addRowBold("green", "clock-o", "Server Playtime", play)
|
||||
.addRowBold("grey", "clock-o", "Time AFK", afk)
|
||||
.addRowBold("teal", "clock-o", "Longest Session", longest)
|
||||
.addRowBold("teal", "clock-o", "Session Median", median)
|
||||
.addRowBold(Icons.SESSION_COUNT, "Sessions", sessionCount)
|
||||
.addRowBold(Icons.PLAYTIME, "Server Playtime", play)
|
||||
.addRowBold(Icons.AFK_LENGTH, "Time AFK", afk)
|
||||
.addRowBold(Icons.SESSION_LENGTH, "Longest Session", longest)
|
||||
.addRowBold(Icons.SESSION_LENGTH, "Session Median", median)
|
||||
.addBreak()
|
||||
.addRowBold("red", "crosshairs", "Player Kills", playerKills)
|
||||
.addRowBold("green", "crosshairs", "Mob Kills", mobKills)
|
||||
.addRowBold("red", "frown-o", "Deaths", deaths)
|
||||
.addRowBold(Icons.PLAYER_KILLS, "Player Kills", playerKills)
|
||||
.addRowBold(Icons.MOB_KILLS, "Mob Kills", mobKills)
|
||||
.addRowBold(Icons.DEATHS, "Deaths", deaths)
|
||||
.toHtml();
|
||||
|
||||
String rightSide = "<div id=\"" + worldId + "\" class=\"dashboard-donut-chart\"></div>" +
|
||||
|
@ -13,6 +13,7 @@ import com.djrapitops.plan.system.settings.theme.ThemeVal;
|
||||
import com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||
import com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icons;
|
||||
import com.djrapitops.plan.utilities.html.tables.KillsTable;
|
||||
|
||||
import java.util.*;
|
||||
@ -114,14 +115,14 @@ public class SessionAccordion extends AbstractAccordion {
|
||||
String worldHtmlID = "worldPieSession" + htmlID;
|
||||
|
||||
String leftSide = new AccordionElementContentBuilder()
|
||||
.addRowBold("teal", "clock-o", "Session Ended", sessionEnd)
|
||||
.addRowBold("green", "clock-o", "Session Length", length)
|
||||
.addRowBold("grey", "clock-o", "AFK", afk)
|
||||
.addRowBold("green", "server", "Server", serverName)
|
||||
.addRowBold(Icons.SESSION_LENGTH, "Session Ended", sessionEnd)
|
||||
.addRowBold(Icons.PLAYTIME, "Session Length", length)
|
||||
.addRowBold(Icons.AFK_LENGTH, "AFK", afk)
|
||||
.addRowBold(Icons.SERVER, "Server", serverName)
|
||||
.addBreak()
|
||||
.addRowBold("red", "crosshairs", "Player Kills", playerKillCount)
|
||||
.addRowBold("green", "crosshairs", "Mob Kills", mobKillCount)
|
||||
.addRowBold("red", "frown-o", "Deaths", deaths)
|
||||
.addRowBold(Icons.PLAYER_KILLS, "Player Kills", playerKillCount)
|
||||
.addRowBold(Icons.MOB_KILLS, "Mob Kills", mobKillCount)
|
||||
.addRowBold(Icons.DEATHS, "Deaths", deaths)
|
||||
.toHtml();
|
||||
|
||||
String rightSide = "<div id=\"" + worldHtmlID + "\" class=\"dashboard-donut-chart\"></div>" +
|
||||
@ -185,14 +186,14 @@ public class SessionAccordion extends AbstractAccordion {
|
||||
String worldHtmlID = "worldPieSession" + htmlID;
|
||||
|
||||
String leftSide = new AccordionElementContentBuilder()
|
||||
.addRowBold("teal", "clock-o", "Session Ended", sessionEnd)
|
||||
.addRowBold("green", "clock-o", "Session Length", length)
|
||||
.addRowBold("grey", "clock-o", "AFK", afk)
|
||||
.addRowBold("grey", "server", "Server", serverName)
|
||||
.addRowBold(Icons.SESSION_LENGTH, "Session Ended", sessionEnd)
|
||||
.addRowBold(Icons.PLAYTIME, "Session Length", length)
|
||||
.addRowBold(Icons.AFK_LENGTH, "AFK", afk)
|
||||
.addRowBold(Icons.SERVER, "Server", serverName)
|
||||
.addBreak()
|
||||
.addRowBold("red", "crosshairs", "Player Kills", playerKillCount)
|
||||
.addRowBold("green", "crosshairs", "Mob Kills", mobKillCount)
|
||||
.addRowBold("red", "frown-o", "Deaths", deaths)
|
||||
.addRowBold(Icons.PLAYER_KILLS, "Player Kills", playerKillCount)
|
||||
.addRowBold(Icons.MOB_KILLS, "Mob Kills", mobKillCount)
|
||||
.addRowBold(Icons.DEATHS, "Deaths", deaths)
|
||||
.toHtml();
|
||||
|
||||
String rightSide = "<div id=\"" + worldHtmlID + "\" class=\"dashboard-donut-chart\"></div>" +
|
||||
|
@ -4,8 +4,8 @@ import com.djrapitops.plan.data.element.TableContainer;
|
||||
import com.djrapitops.plan.data.store.containers.DataContainer;
|
||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
||||
import com.djrapitops.plan.utilities.comparators.MapComparator;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -22,7 +22,7 @@ public class CommandUseTable extends TableContainer {
|
||||
}
|
||||
|
||||
public CommandUseTable(Map<String, Integer> commandUse) {
|
||||
super(Html.FONT_AWESOME_ICON.parse("terminal") + " Command", Html.FONT_AWESOME_ICON.parse("list-ol") + "Times Used");
|
||||
super(Icon.called("terminal") + " Command", Icon.called("list-ol") + "Times Used");
|
||||
|
||||
setColor("lime");
|
||||
if (commandUse.isEmpty()) {
|
||||
|
@ -9,6 +9,8 @@ import com.djrapitops.plan.data.store.objects.DateHolder;
|
||||
import com.djrapitops.plan.system.cache.DataCache;
|
||||
import com.djrapitops.plan.utilities.comparators.PlayerKillComparator;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Family;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -19,7 +21,7 @@ import java.util.List;
|
||||
public class KillsTable extends TableContainer {
|
||||
|
||||
public KillsTable(List<PlayerKill> playerKills) {
|
||||
super(Html.FONT_AWESOME_ICON.parse("clock-o") + " Time", "Killed", "With");
|
||||
super(Icon.called("clock").of(Family.REGULAR) + " Time", "Killed", "With");
|
||||
|
||||
if (playerKills.isEmpty()) {
|
||||
addRow("No Kills");
|
||||
|
@ -23,7 +23,7 @@ import java.util.UUID;
|
||||
public class NicknameTable extends TableContainer {
|
||||
|
||||
public NicknameTable(List<Nickname> nicknames, Map<UUID, String> serverNames) {
|
||||
super("Nickname", "Server");
|
||||
super("Nickname", "Server", "Last Seen");
|
||||
|
||||
if (nicknames.isEmpty()) {
|
||||
addRow("No Nicknames");
|
||||
@ -33,7 +33,7 @@ public class NicknameTable extends TableContainer {
|
||||
}
|
||||
|
||||
private void addValues(List<Nickname> nicknames, Map<UUID, String> serverNames) {
|
||||
Formatter<DateHolder> formatter = Formatters.day();
|
||||
Formatter<DateHolder> formatter = Formatters.year();
|
||||
for (Nickname nickname : nicknames) {
|
||||
UUID serverUUID = nickname.getServerUUID();
|
||||
String serverName = serverNames.getOrDefault(serverUUID, "Unknown");
|
||||
|
@ -12,6 +12,8 @@ import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.utilities.comparators.PlayerContainerLastPlayedComparator;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Family;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -27,13 +29,13 @@ public class PlayersTable extends TableContainer {
|
||||
|
||||
private PlayersTable(List<PlayerContainer> players, int maxPlayers) {
|
||||
super(
|
||||
Html.FONT_AWESOME_ICON.parse("user") + " Name",
|
||||
Html.FONT_AWESOME_ICON.parse("check") + " Activity Index",
|
||||
Html.FONT_AWESOME_ICON.parse("clock-o") + " Playtime",
|
||||
Html.FONT_AWESOME_ICON.parse("calendar-plus-o") + " Sessions",
|
||||
Html.FONT_AWESOME_ICON.parse("user-plus") + " Registered",
|
||||
Html.FONT_AWESOME_ICON.parse("calendar-check-o") + " Last Seen",
|
||||
Html.FONT_AWESOME_ICON.parse("globe") + " Geolocation"
|
||||
Icon.called("user") + " Name",
|
||||
Icon.called("check") + " Activity Index",
|
||||
Icon.called("clock").of(Family.REGULAR) + " Playtime",
|
||||
Icon.called("calendar-plus").of(Family.REGULAR) + " Sessions",
|
||||
Icon.called("user-plus") + " Registered",
|
||||
Icon.called("calendar-check").of(Family.REGULAR) + " Last Seen",
|
||||
Icon.called("globe") + " Geolocation"
|
||||
);
|
||||
this.players = players;
|
||||
this.maxPlayers = maxPlayers;
|
||||
|
Loading…
Reference in New Issue
Block a user