8000 Add configuration option for verbose stats item slot by applenick · Pull Request #923 · PGMDev/PGM · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add configuration option for verbose stats item slot #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/src/main/java/tc/oc/pgm/PGMConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public final class PGMConfig implements Config {
private final Duration statsShowAfter;
private final boolean statsShowBest;
private final boolean statsShowOwn;
private final int verboseItemSlot;

// sidebar.*
private final Component header;
Expand Down Expand Up @@ -189,6 +190,7 @@ public final class PGMConfig implements Config {
this.statsShowAfter = parseDuration(config.getString("stats.show-after", "6s"));
this.statsShowBest = parseBoolean(config.getString("stats.show-best", "true"));
this.statsShowOwn = parseBoolean(config.getString("stats.show-own", "true"));
this.verboseItemSlot = parseInteger(config.getString("stats.item-slot", "7"));

final String header = config.getString("sidebar.header");
this.header = header == null || header.isEmpty() ? null : parseComponent(header);
Expand Down Expand Up @@ -606,6 +608,11 @@ public boolean showOwnStats() {
return statsShowOwn;
}

@Override
public int getVerboseItemSlot() {
return verboseItemSlot;
}

@Override
public String getMotd() {
return motd;
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/tc/oc/pgm/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ public interface Config {
/** @return If stats on match end should show your own stats */
boolean showOwnStats();

/** @return The slot where the verbose item will be placed */
int getVerboseItemSlot();

/**
* Gets a format to override the server's "message of the day."
*
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/tc/oc/pgm/stats/StatsMatchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class StatsMatchModule implements MatchModule, Listener {
private final Duration showAfter = PGM.get().getConfiguration().showStatsAfter();
private final boolean bestStats = PGM.get().getConfiguration().showBestStats();
private final boolean ownStats = PGM.get().getConfiguration().showOwnStats();
private final int verboseItemSlot = PGM.get().getConfiguration().getVerboseItemSlot();

/** Common formats used by stats with decimals */
public static final DecimalFormat TWO_DECIMALS = new DecimalFormat("#.##");
Expand Down Expand Up @@ -343,7 +344,7 @@ public void giveVerboseStatsItem(MatchPlayer player, boolean forceOpen) {
}

StatsMainMenu menu = new StatsMainMenu(player, teams, this);
player.getInventory().setItem(7, menu.getItem());
player.getInventory().setItem(verboseItemSlot, menu.getItem());

if (forceOpen) {
menu.open();
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ stats:
show-after: 6s # How long to wait after the match ends to show stats?
show-best: true # Should show best players stats?
show-own: true # Should show each players own stats?
item-slot: 7 # In what slot should we place the verbose stats item?

# Overrides the header and footer of the side bar.
sidebar:
Expand Down
0