Skip to content

Commit

Permalink
Merge pull request #7 from EtienneDx/feature-currency-symbol
Browse files Browse the repository at this point in the history
Added currency symbol as a config option
  • Loading branch information
EtienneDx authored May 16, 2019
2 parents d3b38ba + a30d449 commit aa41388
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/me/EtienneDx/RealEstate/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class Config

public boolean cfgTransferClaimBlocks;

public boolean cfgUseCurrencySymbol;
public String cfgCurrencySymbol;

public boolean cfgMessageOwner;
public boolean cfgMessageBuyer;
public boolean cfgBroadcastSell;
Expand Down Expand Up @@ -101,6 +104,9 @@ public void loadConfig(YamlConfiguration config)

this.cfgTransferClaimBlocks = config.getBoolean("RealEstate.Rules.TransferClaimBlocks", true);

this.cfgUseCurrencySymbol = config.getBoolean("RealEstate.Rules.UseCurrencySymbol", false);
this.cfgCurrencySymbol = config.getString("RealEstate.Rules.CurrencySymbol", "$");

this.cfgMessageOwner = config.getBoolean("RealEstate.Messaging.MessageOwner", true);
this.cfgMessageBuyer = config.getBoolean("RealEstate.Messaging.MessageBuyer", true);
this.cfgMailOffline = config.getBoolean("RealEstate.Messaging.MailOffline", true);
Expand Down Expand Up @@ -147,6 +153,9 @@ public void saveConfig()

outConfig.set("RealEstate.Rules.TransferClaimBlocks", this.cfgTransferClaimBlocks);

outConfig.set("RealEstate.Rules.UseCurrencySymbol", this.cfgUseCurrencySymbol);
outConfig.set("RealEstate.Rules.CurrencySymbol", this.cfgCurrencySymbol);

outConfig.set("RealEstate.Messaging.MessageOwner", this.cfgMessageOwner);
outConfig.set("RealEstate.Messaging.MessageBuyer", this.cfgMessageBuyer);
outConfig.set("RealEstate.Messaging.MailOffline", this.cfgMailOffline);
Expand Down
10 changes: 9 additions & 1 deletion src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ else if(sign.getBlock().getState() instanceof Sign)
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceLease);
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
s.setLine(2, paymentsLeft + "x " + price + " " + RealEstate.econ.currencyNamePlural());
//s.setLine(2, paymentsLeft + "x " + price + " " + RealEstate.econ.currencyNamePlural());
if(RealEstate.instance.config.cfgUseCurrencySymbol)
{
s.setLine(2, paymentsLeft + "x " + RealEstate.instance.config.cfgCurrencySymbol + " " + price);
}
else
{
s.setLine(2, paymentsLeft + "x " + price + " " + RealEstate.econ.currencyNamePlural());
}
s.setLine(3, Utils.getTime(frequency, null, false));
s.update(true);
}
Expand Down
9 changes: 8 additions & 1 deletion src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ else if(sign.getBlock().getState() instanceof Sign)
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceRent);
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
s.setLine(2, price + " " + RealEstate.econ.currencyNamePlural());
if(RealEstate.instance.config.cfgUseCurrencySymbol)
{
s.setLine(2, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
}
else
{
s.setLine(2, price + " " + RealEstate.econ.currencyNamePlural());
}
s.setLine(3, (maxPeriod > 1 ? maxPeriod + "x " : "") + Utils.getTime(duration, null, false));
s.update(true);
}
Expand Down
9 changes: 8 additions & 1 deletion src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ public void update()
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceSell);
s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
s.setLine(3, price + " " + RealEstate.econ.currencyNamePlural());
if(RealEstate.instance.config.cfgUseCurrencySymbol)
{
s.setLine(3, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
}
else
{
s.setLine(3, price + " " + RealEstate.econ.currencyNamePlural());
}
s.update(true);
}
else
Expand Down

0 comments on commit aa41388

Please sign in to comment.