Skip to content

Commit 7b113c6

Browse files
committed
Merge pull request #7 from jcdesimp/release
Release
2 parents e5f4b77 + 587eead commit 7b113c6

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

src/com/jcdesimp/landlord/Landlord.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ public void onEnable() {
5656

5757

5858

59-
//// CONFIG FILE MANAGEMENT ///
60-
61-
59+
//// CONFIG FILE MANAGEMENT ////
6260

6361

6462
Map<String,Object> oldConfig = getConfig().getValues(true);

src/com/jcdesimp/landlord/LandlordCommandExecutor.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,19 @@ private boolean landlord_claim(CommandSender sender, String[] args) {
288288
return true;
289289

290290
}
291+
int orLimit = plugin.getConfig().getInt("limits.landLimit",10);
291292
int limit = plugin.getConfig().getInt("limits.landLimit",10);
292293

293294
if(player.hasPermission("landlord.limit.extra5")){
294-
limit+=limit+=plugin.getConfig().getInt("limits.extra5",0);
295+
limit=orLimit+plugin.getConfig().getInt("limits.extra5",0);
295296
} else if(player.hasPermission("landlord.limit.extra4")){
296-
limit+=limit+=plugin.getConfig().getInt("limits.extra4",0);
297+
limit=orLimit+plugin.getConfig().getInt("limits.extra4",0);
297298
} else if(player.hasPermission("landlord.limit.extra3")){
298-
limit+=limit+=plugin.getConfig().getInt("limits.extra3",0);
299+
limit=orLimit+plugin.getConfig().getInt("limits.extra3",0);
299300
} else if(player.hasPermission("landlord.limit.extra2")){
300-
limit+=limit+=plugin.getConfig().getInt("limits.extra2",0);
301+
limit=orLimit+plugin.getConfig().getInt("limits.extra2",0);
301302
} else if(player.hasPermission("landlord.limit.extra")){
302-
limit+=limit+=plugin.getConfig().getInt("limits.extra",0);
303+
limit=orLimit+plugin.getConfig().getInt("limits.extra",0);
303304
}
304305

305306
if(limit >= 0 && !player.hasPermission("landlord.limit.override")){
@@ -309,11 +310,15 @@ private boolean landlord_claim(CommandSender sender, String[] args) {
309310
}
310311
} //
311312

313+
//Money Handling
312314
if(plugin.hasVault()){
313315
if(plugin.getvHandler().hasEconomy()){
314316
Double amt = plugin.getConfig().getDouble("economy.buyPrice", 100.0);
315317
if(amt > 0){
316-
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)){
317322
player.sendMessage(ChatColor.RED+"It costs " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
318323
return true;
319324
} else {
@@ -403,7 +408,10 @@ private boolean landlord_unclaim(CommandSender sender, String[] args, String lab
403408
if(plugin.getvHandler().hasEconomy()){
404409
Double amt = plugin.getConfig().getDouble("economy.sellPrice", 100.0);
405410
if(amt > 0){
406-
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)){
407415
player.sendMessage(ChatColor.GREEN+"Land sold for " + plugin.getvHandler().formatCash(amt) + ".");
408416
//return true;
409417
}
@@ -823,11 +831,11 @@ private boolean landlord_list(CommandSender sender, String[] args, String label)
823831
if(myLand.size()==0){
824832
player.sendMessage(ChatColor.YELLOW+"You do not own any land!");
825833
} else {
826-
String header = ChatColor.DARK_GREEN+" | ( X, Z ) - World Name | \n";
834+
String header = ChatColor.DARK_GREEN+" | Coords - Chunk Coords - World Name | \n";
827835
ArrayList<String> landList = new ArrayList<String>();
828836
//OwnedLand curr = myLand.get(0);
829837
for (OwnedLand aMyLand : myLand) {
830-
landList.add((ChatColor.GOLD + " (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
838+
landList.add((ChatColor.GOLD + " ("+ aMyLand.getXBlock() +", "+ aMyLand.getZBlock() +") - (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
831839
+ aMyLand.getWorldName()) + "\n")
832840
;
833841
}
@@ -900,11 +908,11 @@ private boolean landlord_listplayer(CommandSender sender, String[] args, String
900908
if(myLand.size()==0){
901909
sender.sendMessage(ChatColor.YELLOW+ owner +" does not own any land!");
902910
} else {
903-
String header = ChatColor.DARK_GREEN+" | ( X, Z ) - World Name | \n";
911+
String header = ChatColor.DARK_GREEN+" | Coords - Chunk Coords - World Name | \n";
904912
ArrayList<String> landList = new ArrayList<String>();
905913
//OwnedLand curr = myLand.get(0);
906914
for (OwnedLand aMyLand : myLand) {
907-
landList.add((ChatColor.GOLD + " (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
915+
landList.add((ChatColor.GOLD + " ("+ aMyLand.getXBlock() +", "+ aMyLand.getZBlock() +") - (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
908916
+ aMyLand.getWorldName()) + "\n")
909917
;
910918
}

src/com/jcdesimp/landlord/persistantData/OwnedLand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ public int getZ() {
162162
return z;
163163
}
164164

165+
public int getXBlock() {
166+
return getChunk().getBlock(0,0,0).getX();
167+
}
168+
169+
public int getZBlock() {
170+
return getChunk().getBlock(0,0,0).getZ();
171+
}
172+
165173
public String getPermissions() {
166174
return permissions;
167175
}

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:

src/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Landlord
22
main: com.jcdesimp.landlord.Landlord
3-
version: 1.1
3+
version: 1.2
44
author: Jcdesimp
55
authors: []
66
website: http://dev.bukkit.org/bukkit-plugins/landlord/

0 commit comments

Comments
 (0)