Skip to content
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

Fixes #46 ability to change kMFT values #55

Merged
merged 1 commit into from
Nov 17, 2024
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
14 changes: 5 additions & 9 deletions src/main/java/world/bentobox/bank/PhManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@
*/
public class PhManager {
private static final BigInteger THOUSAND = BigInteger.valueOf(1000);
private static final TreeMap<BigInteger, String> LEVELS;
static {
LEVELS = new TreeMap<>();

LEVELS.put(THOUSAND, "k");
LEVELS.put(THOUSAND.pow(2), "M");
LEVELS.put(THOUSAND.pow(3), "G");
LEVELS.put(THOUSAND.pow(4), "T");
}
private static final TreeMap<BigInteger, String> LEVELS = new TreeMap<>();

private final BentoBox plugin;
private final BankManager bankManager;
Expand All @@ -49,6 +41,10 @@ public PhManager(Bank addon, BankManager bankManager) {
this.addon = addon;
this.plugin = addon.getPlugin();
this.bankManager = bankManager;
LEVELS.put(THOUSAND, addon.getSettings().getKilo());
LEVELS.put(THOUSAND.pow(2), addon.getSettings().getMega());
LEVELS.put(THOUSAND.pow(3), addon.getSettings().getGiga());
LEVELS.put(THOUSAND.pow(4), addon.getSettings().getTera());
}

protected boolean registerPlaceholders(GameModeAddon gm) {
Expand Down
65 changes: 65 additions & 0 deletions src/main/java/world/bentobox/bank/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public class Settings implements ConfigObject {
@ConfigComment("from the bank?")
private boolean sendBankAlert = true;

@ConfigComment("Shorthand units")
@ConfigEntry(path = "units.kilo")
private String kilo = "k";
@ConfigEntry(path = "units.mega")
private String mega = "M";
@ConfigEntry(path = "units.giga")
private String giga = "G";
@ConfigEntry(path = "units.tera")
private String tera = "T";

/**
* @return the gameModes
Expand Down Expand Up @@ -187,4 +196,60 @@ public int getCooldown() {
public void setCooldown(int cooldown) {
this.cooldown = cooldown;
}

/**
* @return the kilo
*/
public String getKilo() {
return kilo;
}

/**
* @param kilo the kilo to set
*/
public void setKilo(String kilo) {
this.kilo = kilo;
}

/**
* @return the mega
*/
public String getMega() {
return mega;
}

/**
* @param mega the mega to set
*/
public void setMega(String mega) {
this.mega = mega;
}

/**
* @return the giga
*/
public String getGiga() {
return giga;
}

/**
* @param giga the giga to set
*/
public void setGiga(String giga) {
this.giga = giga;
}

/**
* @return the tera
*/
public String getTera() {
return tera;
}

/**
* @param tera the tera to set
*/
public void setTera(String tera) {
this.tera = tera;
}
}
6 changes: 6 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ bank:
# Cooldown time for user withdrawl and deposit commands. This should be set long enought
# so that database writes can be made in time. Default is 60 seconds.
cooldown: 60
units:
# Shorthand units
kilo: k
mega: M
giga: G
tera: T

Loading