Skip to content

Commit

Permalink
Merge pull request #7 from jcdesimp/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
jcdesimp committed Jul 20, 2014
2 parents e5f4b77 + 587eead commit 7b113c6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/com/jcdesimp/landlord/Landlord.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ public void onEnable() {



//// CONFIG FILE MANAGEMENT ///


//// CONFIG FILE MANAGEMENT ////


Map<String,Object> oldConfig = getConfig().getValues(true);
Expand Down
30 changes: 19 additions & 11 deletions src/com/jcdesimp/landlord/LandlordCommandExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,19 @@ private boolean landlord_claim(CommandSender sender, String[] args) {
return true;

}
int orLimit = plugin.getConfig().getInt("limits.landLimit",10);
int limit = plugin.getConfig().getInt("limits.landLimit",10);

if(player.hasPermission("landlord.limit.extra5")){
limit+=limit+=plugin.getConfig().getInt("limits.extra5",0);
limit=orLimit+plugin.getConfig().getInt("limits.extra5",0);
} else if(player.hasPermission("landlord.limit.extra4")){
limit+=limit+=plugin.getConfig().getInt("limits.extra4",0);
limit=orLimit+plugin.getConfig().getInt("limits.extra4",0);
} else if(player.hasPermission("landlord.limit.extra3")){
limit+=limit+=plugin.getConfig().getInt("limits.extra3",0);
limit=orLimit+plugin.getConfig().getInt("limits.extra3",0);
} else if(player.hasPermission("landlord.limit.extra2")){
limit+=limit+=plugin.getConfig().getInt("limits.extra2",0);
limit=orLimit+plugin.getConfig().getInt("limits.extra2",0);
} else if(player.hasPermission("landlord.limit.extra")){
limit+=limit+=plugin.getConfig().getInt("limits.extra",0);
limit=orLimit+plugin.getConfig().getInt("limits.extra",0);
}

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

//Money Handling
if(plugin.hasVault()){
if(plugin.getvHandler().hasEconomy()){
Double amt = plugin.getConfig().getDouble("economy.buyPrice", 100.0);
if(amt > 0){
if(!plugin.getvHandler().chargeCash(player, amt)){
int numFree = plugin.getConfig().getInt("economy.freeLand", 0);
if (numFree > 0 && plugin.getDatabase().find(OwnedLand.class).where().eq("ownerName",player.getUniqueId().toString()).findRowCount() < numFree) {
//player.sendMessage(ChatColor.YELLOW+"You have been charged " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
} else if(!plugin.getvHandler().chargeCash(player, amt)){
player.sendMessage(ChatColor.RED+"It costs " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
return true;
} else {
Expand Down Expand Up @@ -403,7 +408,10 @@ private boolean landlord_unclaim(CommandSender sender, String[] args, String lab
if(plugin.getvHandler().hasEconomy()){
Double amt = plugin.getConfig().getDouble("economy.sellPrice", 100.0);
if(amt > 0){
if(plugin.getvHandler().giveCash(player, amt)){
int numFree = plugin.getConfig().getInt("economy.freeLand", 0);
if (numFree > 0 && plugin.getDatabase().find(OwnedLand.class).where().eq("ownerName",player.getUniqueId().toString()).findRowCount() <= numFree) {
//player.sendMessage(ChatColor.YELLOW+"You have been charged " + plugin.getvHandler().formatCash(amt) + " to purchase land.");
} else if(plugin.getvHandler().giveCash(player, amt)){
player.sendMessage(ChatColor.GREEN+"Land sold for " + plugin.getvHandler().formatCash(amt) + ".");
//return true;
}
Expand Down Expand Up @@ -823,11 +831,11 @@ private boolean landlord_list(CommandSender sender, String[] args, String label)
if(myLand.size()==0){
player.sendMessage(ChatColor.YELLOW+"You do not own any land!");
} else {
String header = ChatColor.DARK_GREEN+" | ( X, Z ) - World Name | \n";
String header = ChatColor.DARK_GREEN+" | Coords - Chunk Coords - World Name | \n";
ArrayList<String> landList = new ArrayList<String>();
//OwnedLand curr = myLand.get(0);
for (OwnedLand aMyLand : myLand) {
landList.add((ChatColor.GOLD + " (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
landList.add((ChatColor.GOLD + " ("+ aMyLand.getXBlock() +", "+ aMyLand.getZBlock() +") - (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
+ aMyLand.getWorldName()) + "\n")
;
}
Expand Down Expand Up @@ -900,11 +908,11 @@ private boolean landlord_listplayer(CommandSender sender, String[] args, String
if(myLand.size()==0){
sender.sendMessage(ChatColor.YELLOW+ owner +" does not own any land!");
} else {
String header = ChatColor.DARK_GREEN+" | ( X, Z ) - World Name | \n";
String header = ChatColor.DARK_GREEN+" | Coords - Chunk Coords - World Name | \n";
ArrayList<String> landList = new ArrayList<String>();
//OwnedLand curr = myLand.get(0);
for (OwnedLand aMyLand : myLand) {
landList.add((ChatColor.GOLD + " (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
landList.add((ChatColor.GOLD + " ("+ aMyLand.getXBlock() +", "+ aMyLand.getZBlock() +") - (" + aMyLand.getX() + ", " + aMyLand.getZ() + ") - "
+ aMyLand.getWorldName()) + "\n")
;
}
Expand Down
8 changes: 8 additions & 0 deletions src/com/jcdesimp/landlord/persistantData/OwnedLand.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ public int getZ() {
return z;
}

public int getXBlock() {
return getChunk().getBlock(0,0,0).getX();
}

public int getZBlock() {
return getChunk().getBlock(0,0,0).getZ();
}

public String getPermissions() {
return permissions;
}
Expand Down
3 changes: 3 additions & 0 deletions src/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
# economy:
# #Enable economy integration features
# enable: false
# #Amount of free land a player can own before being charged
# freeLand: 0
# #Cost of claiming land
# buyPrice: 100
# #Money given to player when unclaiming land
Expand Down Expand Up @@ -62,6 +64,7 @@ limits:
extra5: 50
economy:
enable: false
freeLand: 0
buyPrice: 100
sellPrice: 50
worldguard:
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Landlord
main: com.jcdesimp.landlord.Landlord
version: 1.1
version: 1.2
author: Jcdesimp
authors: []
website: http://dev.bukkit.org/bukkit-plugins/landlord/
Expand Down

0 comments on commit 7b113c6

Please sign in to comment.