Skip to content

Commit 632eaeb

Browse files
committed
Added config option for "free land"
1 parent 055063f commit 632eaeb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/com/jcdesimp/landlord/LandlordCommandExecutor.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,15 @@ private boolean landlord_claim(CommandSender sender, String[] args) {
310310
}
311311
} //
312312

313+
//Money Handling
313314
if(plugin.hasVault()){
314315
if(plugin.getvHandler().hasEconomy()){
315316
Double amt = plugin.getConfig().getDouble("economy.buyPrice", 100.0);
316317
if(amt > 0){
317-
if(!plugin.getvHandler().chargeCash(player, amt)){
318+
int numFree = plugin.getConfig().getInt("economy.freeLand", 0);
319+
if (numFree > 0 && plugin.getDatabase().find(OwnedLand.class).where().eq("ownerName",player.getUniqueId().toString()).findRowCount() < numFree) {
320+
//player.sendMessage(ChatColor.YELLOW+"You have been charged " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
321+
} else if(!plugin.getvHandler().chargeCash(player, amt)){
318322
player.sendMessage(ChatColor.RED+"It costs " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
319323
return true;
320324
} else {
@@ -404,7 +408,10 @@ private boolean landlord_unclaim(CommandSender sender, String[] args, String lab
404408
if(plugin.getvHandler().hasEconomy()){
405409
Double amt = plugin.getConfig().getDouble("economy.sellPrice", 100.0);
406410
if(amt > 0){
407-
if(plugin.getvHandler().giveCash(player, amt)){
411+
int numFree = plugin.getConfig().getInt("economy.freeLand", 0);
412+
if (numFree > 0 && plugin.getDatabase().find(OwnedLand.class).where().eq("ownerName",player.getUniqueId().toString()).findRowCount() <= numFree) {
413+
//player.sendMessage(ChatColor.YELLOW+"You have been charged " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
414+
} else if(plugin.getvHandler().giveCash(player, amt)){
408415
player.sendMessage(ChatColor.GREEN+"Land sold for " + plugin.getvHandler().formatCash(amt) + ".");
409416
//return true;
410417
}

src/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# economy:
2828
# #Enable economy integration features
2929
# enable: false
30+
# #Amount of free land a player can own before being charged
31+
# freeLand: 0
3032
# #Cost of claiming land
3133
# buyPrice: 100
3234
# #Money given to player when unclaiming land
@@ -62,6 +64,7 @@ limits:
6264
extra5: 50
6365
economy:
6466
enable: false
67+
freeLand: 0
6568
buyPrice: 100
6669
sellPrice: 50
6770
worldguard:

0 commit comments

Comments
 (0)