Add a config setting for player head img url

- Added config setting Display_options.Player_head_img_url

Affects issues:
- Close #2243
This commit is contained in:
Risto Lahtela 2022-02-02 11:14:15 +02:00
parent 922c99872c
commit be18734186
6 changed files with 9 additions and 7 deletions

View File

@ -25,6 +25,7 @@ import com.djrapitops.plan.delivery.rendering.html.Contributors;
import com.djrapitops.plan.delivery.rendering.html.Html; import com.djrapitops.plan.delivery.rendering.html.Html;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.DisplaySettings;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.settings.theme.ThemeVal; import com.djrapitops.plan.settings.theme.ThemeVal;
@ -101,6 +102,7 @@ public class PlayerPage implements Page {
String playerName = player.getValue(PlayerKeys.NAME).orElse(playerUUID.toString()); String playerName = player.getValue(PlayerKeys.NAME).orElse(playerUUID.toString());
placeholders.put("playerName", playerName); placeholders.put("playerName", playerName);
placeholders.put("playerUUID", playerUUID); placeholders.put("playerUUID", playerUUID);
placeholders.put("playerHeadUrl", config.get(DisplaySettings.PLAYER_HEAD_IMG_URL));
placeholders.put("timeZone", config.getTimeZoneOffsetHours()); placeholders.put("timeZone", config.getTimeZoneOffsetHours());
placeholders.put("gmPieColors", theme.getValue(ThemeVal.GRAPH_GM_PIE)); placeholders.put("gmPieColors", theme.getValue(ThemeVal.GRAPH_GM_PIE));

View File

@ -17,11 +17,7 @@
package com.djrapitops.plan.settings.config.paths; package com.djrapitops.plan.settings.config.paths;
import com.djrapitops.plan.settings.config.ConfigNode; import com.djrapitops.plan.settings.config.ConfigNode;
import com.djrapitops.plan.settings.config.paths.key.BooleanSetting; import com.djrapitops.plan.settings.config.paths.key.*;
import com.djrapitops.plan.settings.config.paths.key.DoubleSetting;
import com.djrapitops.plan.settings.config.paths.key.IntegerSetting;
import com.djrapitops.plan.settings.config.paths.key.Setting;
import com.djrapitops.plan.settings.config.paths.key.StringSetting;
/** /**
* {@link Setting} values that are in "Display_options" section. * {@link Setting} values that are in "Display_options" section.
@ -31,6 +27,7 @@ import com.djrapitops.plan.settings.config.paths.key.StringSetting;
public class DisplaySettings { public class DisplaySettings {
public static final Setting<String> THEME = new StringSetting("Display_options.Theme"); public static final Setting<String> THEME = new StringSetting("Display_options.Theme");
public static final Setting<String> PLAYER_HEAD_IMG_URL = new StringSetting("Display_options.Player_head_image_url");
public static final Setting<Integer> SESSIONS_PER_PAGE = new IntegerSetting("Display_options.Sessions.Show_on_page"); public static final Setting<Integer> SESSIONS_PER_PAGE = new IntegerSetting("Display_options.Sessions.Show_on_page");
public static final Setting<Boolean> ORDER_WORLD_PIE_BY_PERCENTAGE = new BooleanSetting("Display_options.Sessions.Order_world_pies_by_percentage"); public static final Setting<Boolean> ORDER_WORLD_PIE_BY_PERCENTAGE = new BooleanSetting("Display_options.Sessions.Order_world_pies_by_percentage");
public static final Setting<Integer> PLAYERS_PER_SERVER_PAGE = new IntegerSetting("Display_options.Players_table.Show_on_server_page"); public static final Setting<Integer> PLAYERS_PER_SERVER_PAGE = new IntegerSetting("Display_options.Players_table.Show_on_server_page");

View File

@ -94,6 +94,7 @@ public class DBSystem implements SubSystem {
} catch (DBInitException e) { } catch (DBInitException e) {
Throwable cause = e.getCause(); Throwable cause = e.getCause();
String message = cause == null ? e.getMessage() : cause.getMessage(); String message = cause == null ? e.getMessage() : cause.getMessage();
if (message == null) e.printStackTrace();
throw new EnableException(db.getType().getName() + " init failure: " + message, cause); throw new EnableException(db.getType().getName() + " init failure: " + message, cause);
} }
} }

View File

@ -127,6 +127,7 @@ Display_options:
# More information about Themes: # More information about Themes:
# https://github.com/plan-player-analytics/Plan/wiki/Themes # https://github.com/plan-player-analytics/Plan/wiki/Themes
Theme: default Theme: default
Player_head_image_url: "https://cravatar.eu/helmavatar/${playerName}/120.png"
Sessions: Sessions:
Show_on_page: 50 Show_on_page: 50
# By Default World playtime pie is ordered alphabetically. # By Default World playtime pie is ordered alphabetically.

View File

@ -132,6 +132,7 @@ Display_options:
# More information about Themes: # More information about Themes:
# https://github.com/plan-player-analytics/Plan/wiki/Themes # https://github.com/plan-player-analytics/Plan/wiki/Themes
Theme: default Theme: default
Player_head_image_url: "https://cravatar.eu/helmavatar/${playerName}/120.png"
Sessions: Sessions:
Show_on_page: 50 Show_on_page: 50
# By Default World playtime pie is ordered alphabetically. # By Default World playtime pie is ordered alphabetically.

View File

@ -144,8 +144,8 @@
id="data_kick_count"></span></p> id="data_kick_count"></span></p>
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"> <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<img class="rounded mx-auto d-block" <img class="rounded mx-auto d-block" src="${playerHeadUrl}"
src="https://cravatar.eu/helmavatar/${playerName}/120.png"> style="width: 120px;">
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"> <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span <p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span