Merge pull request #30 from FabianGal45/master
Added "UseDecimalCurrency" to the config.yml & changed the rent sign
This commit is contained in:
commit
d7fa646356
@ -37,6 +37,8 @@ public class Config extends AnnotationConfig
|
|||||||
public String cfgReplaceRent = "FOR RENT";
|
public String cfgReplaceRent = "FOR RENT";
|
||||||
@ConfigField(name="RealEstate.Keywords.Replace.Lease", comment = "What is displayed on signs for preoperties to lease")
|
@ConfigField(name="RealEstate.Keywords.Replace.Lease", comment = "What is displayed on signs for preoperties to lease")
|
||||||
public String cfgReplaceLease = "FOR LEASE";
|
public String cfgReplaceLease = "FOR LEASE";
|
||||||
|
@ConfigField(name="RealEstate.Keywords.Replace.Ongoing.Rent", comment = "What is displayed on the first line of the sign once someone rents a claim.")
|
||||||
|
public String cfgReplaceOngoingRent = "[Rented]";
|
||||||
|
|
||||||
@ConfigField(name="RealEstate.Rules.Sell", comment = "Is selling claims enabled?")
|
@ConfigField(name="RealEstate.Rules.Sell", comment = "Is selling claims enabled?")
|
||||||
public boolean cfgEnableSell = true;
|
public boolean cfgEnableSell = true;
|
||||||
@ -61,6 +63,8 @@ public class Config extends AnnotationConfig
|
|||||||
public boolean cfgUseCurrencySymbol = false;
|
public boolean cfgUseCurrencySymbol = false;
|
||||||
@ConfigField(name="RealEstate.Rules.CurrencySymbol", comment = "In case UseCurrencySymbol is true, what symbol should be used?")
|
@ConfigField(name="RealEstate.Rules.CurrencySymbol", comment = "In case UseCurrencySymbol is true, what symbol should be used?")
|
||||||
public String cfgCurrencySymbol = "$";
|
public String cfgCurrencySymbol = "$";
|
||||||
|
@ConfigField(name="RealEstate.Rules.UseDecimalCurrency", comment = "Allow players to use decimal currency e.g. $10.15")
|
||||||
|
public boolean cfgUseDecimalCurrency = true;
|
||||||
|
|
||||||
@ConfigField(name="RealEstate.Messaging.MessageOwner", comment = "Should the owner get messaged once one of his claim is rented/leased/bought and on end of contracts?")
|
@ConfigField(name="RealEstate.Messaging.MessageOwner", comment = "Should the owner get messaged once one of his claim is rented/leased/bought and on end of contracts?")
|
||||||
public boolean cfgMessageOwner = true;
|
public boolean cfgMessageOwner = true;
|
||||||
|
|||||||
@ -114,6 +114,13 @@ public class REListener implements Listener
|
|||||||
event.getBlock().breakNaturally();
|
event.getBlock().breakNaturally();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if((price%1)!=0 && !RealEstate.instance.config.cfgUseDecimalCurrency) //if the price has a decimal number AND Decimal currency is disabled
|
||||||
|
{
|
||||||
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price cannot have a decimal number!");
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getBlock().breakNaturally();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(claim.isAdminClaim())
|
if(claim.isAdminClaim())
|
||||||
{
|
{
|
||||||
@ -175,6 +182,13 @@ public class REListener implements Listener
|
|||||||
event.getBlock().breakNaturally();
|
event.getBlock().breakNaturally();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if((price%1)!=0 && !RealEstate.instance.config.cfgUseDecimalCurrency) //if the price has a decimal number AND Decimal currency is disabled
|
||||||
|
{
|
||||||
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price cannot have a decimal number!");
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getBlock().breakNaturally();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(event.getLine(2).isEmpty())
|
if(event.getLine(2).isEmpty())
|
||||||
{
|
{
|
||||||
@ -279,6 +293,13 @@ public class REListener implements Listener
|
|||||||
event.getBlock().breakNaturally();
|
event.getBlock().breakNaturally();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if((price%1)!=0 && !RealEstate.instance.config.cfgUseDecimalCurrency) //if the price has a decimal number AND Decimal currency is disabled
|
||||||
|
{
|
||||||
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price cannot have a decimal number!");
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getBlock().breakNaturally();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(event.getLine(2).isEmpty())
|
if(event.getLine(2).isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,13 +70,27 @@ public class ClaimLease extends BoughtTransaction
|
|||||||
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
|
//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)
|
if(RealEstate.instance.config.cfgUseCurrencySymbol)
|
||||||
|
{
|
||||||
|
if(RealEstate.instance.config.cfgUseDecimalCurrency == false)
|
||||||
|
{
|
||||||
|
s.setLine(2, paymentsLeft + "x " + RealEstate.instance.config.cfgCurrencySymbol + " " + (int)Math.round(price));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
s.setLine(2, paymentsLeft + "x " + RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
s.setLine(2, paymentsLeft + "x " + RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(RealEstate.instance.config.cfgUseDecimalCurrency == false)
|
||||||
|
{
|
||||||
|
s.setLine(2, paymentsLeft + "x " + (int)Math.round(price) + " " + RealEstate.econ.currencyNamePlural());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s.setLine(2, paymentsLeft + "x " + price + " " + RealEstate.econ.currencyNamePlural());
|
s.setLine(2, paymentsLeft + "x " + price + " " + RealEstate.econ.currencyNamePlural());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s.setLine(3, Utils.getTime(frequency, null, false));
|
s.setLine(3, Utils.getTime(frequency, null, false));
|
||||||
s.update(true);
|
s.update(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,13 +75,28 @@ public class ClaimRent extends BoughtTransaction
|
|||||||
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceRent);
|
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceRent);
|
||||||
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
|
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
|
||||||
if(RealEstate.instance.config.cfgUseCurrencySymbol)
|
if(RealEstate.instance.config.cfgUseCurrencySymbol)
|
||||||
|
{
|
||||||
|
if(RealEstate.instance.config.cfgUseDecimalCurrency == false)
|
||||||
|
{
|
||||||
|
s.setLine(2, RealEstate.instance.config.cfgCurrencySymbol + " " + (int)Math.round(price));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
s.setLine(2, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
s.setLine(2, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(RealEstate.instance.config.cfgUseDecimalCurrency == false)
|
||||||
|
{
|
||||||
|
s.setLine(2, (int)Math.round(price) + " " + RealEstate.econ.currencyNamePlural());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s.setLine(2, price + " " + RealEstate.econ.currencyNamePlural());
|
s.setLine(2, price + " " + RealEstate.econ.currencyNamePlural());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s.setLine(3, (maxPeriod > 1 ? maxPeriod + "x " : "") + Utils.getTime(duration, null, false));
|
s.setLine(3, (maxPeriod > 1 ? maxPeriod + "x " : "") + Utils.getTime(duration, null, false));
|
||||||
s.update(true);
|
s.update(true);
|
||||||
}
|
}
|
||||||
@ -107,8 +122,8 @@ public class ClaimRent extends BoughtTransaction
|
|||||||
else if(sign.getBlock().getState() instanceof Sign)
|
else if(sign.getBlock().getState() instanceof Sign)
|
||||||
{
|
{
|
||||||
Sign s = (Sign) sign.getBlock().getState();
|
Sign s = (Sign) sign.getBlock().getState();
|
||||||
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
|
s.setLine(0, ChatColor.GOLD + RealEstate.instance.config.cfgReplaceOngoingRent); //Changed the header to "[Rented]" so that it won't waste space on the next line and allow the name of the player to show underneath.
|
||||||
s.setLine(1, Utils.getSignString("Rented by " + Bukkit.getOfflinePlayer(buyer).getName()));
|
s.setLine(1, Utils.getSignString(Bukkit.getOfflinePlayer(buyer).getName()));//remove "Rented by"
|
||||||
s.setLine(2, "Time remaining : ");
|
s.setLine(2, "Time remaining : ");
|
||||||
|
|
||||||
int daysLeft = duration - days - 1;// we need to remove the current day
|
int daysLeft = duration - days - 1;// we need to remove the current day
|
||||||
|
|||||||
@ -41,13 +41,27 @@ public class ClaimSell extends ClaimTransaction
|
|||||||
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceSell);
|
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceSell);
|
||||||
s.setLine(2, owner != null ? Utils.getSignString(Bukkit.getOfflinePlayer(owner).getName()) : "SERVER");
|
s.setLine(2, owner != null ? Utils.getSignString(Bukkit.getOfflinePlayer(owner).getName()) : "SERVER");
|
||||||
if(RealEstate.instance.config.cfgUseCurrencySymbol)
|
if(RealEstate.instance.config.cfgUseCurrencySymbol)
|
||||||
|
{
|
||||||
|
if(RealEstate.instance.config.cfgUseDecimalCurrency == false)
|
||||||
|
{
|
||||||
|
s.setLine(3, RealEstate.instance.config.cfgCurrencySymbol + " " + (int)Math.round(price));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
s.setLine(3, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
s.setLine(3, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(RealEstate.instance.config.cfgUseDecimalCurrency == false)
|
||||||
|
{
|
||||||
|
s.setLine(3, (int)Math.round(price) + " " + RealEstate.econ.currencyNamePlural());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s.setLine(3, price + " " + RealEstate.econ.currencyNamePlural());
|
s.setLine(3, price + " " + RealEstate.econ.currencyNamePlural());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s.update(true);
|
s.update(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user