diff --git a/pom.xml b/pom.xml
index 8c25b0a..48eaa0b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
Me.EtienneDx
RealEstate
- 0.0.1-SNAPSHOT
+ 0.1.1-SNAPSHOT
RealEstate
A spigot plugin for selling, renting and leasing GriefPrevention claims
@@ -74,6 +74,11 @@
aikar
https://repo.aikar.co/content/groups/aikar/
+
+
+ ess-repo
+ https://ci.ender.zone/plugin/repository/everything/
+
@@ -99,5 +104,11 @@
acf-bukkit
0.5.0-SNAPSHOT
+
+ net.ess3
+ EssentialsX
+ 2.16.1
+ provided
+
\ No newline at end of file
diff --git a/src/me/EtienneDx/RealEstate/Config.java b/src/me/EtienneDx/RealEstate/Config.java
index 148edf9..5e9e8d3 100644
--- a/src/me/EtienneDx/RealEstate/Config.java
+++ b/src/me/EtienneDx/RealEstate/Config.java
@@ -35,12 +35,15 @@ public class Config
public boolean cfgEnableAutoRenew;
public boolean cfgEnableRentPeriod;
+ public boolean cfgDestroyRentSigns;
+ public boolean cfgDestroyLeaseSigns;
public boolean cfgTransferClaimBlocks;
public boolean cfgMessageOwner;
public boolean cfgMessageBuyer;
public boolean cfgBroadcastSell;
+ public boolean cfgMailOffline;
public double cfgPriceSellPerBlock;
public double cfgPriceRentPerBlock;
@@ -93,11 +96,14 @@ public class Config
this.cfgEnableAutoRenew = config.getBoolean("RealEstate.Rules.AutomaticRenew", true);
this.cfgEnableRentPeriod = config.getBoolean("RealEstate.Rules.RentPeriods", true);
+ this.cfgDestroyRentSigns = config.getBoolean("RealEstate.Rules.DestroySigns.Rent", false);
+ this.cfgDestroyLeaseSigns = config.getBoolean("RealEstate.Rules.DestroySigns.Lease", false);
this.cfgTransferClaimBlocks = config.getBoolean("RealEstate.Rules.TransferClaimBlocks", true);
this.cfgMessageOwner = config.getBoolean("RealEstate.Messaging.MessageOwner", true);
this.cfgMessageBuyer = config.getBoolean("RealEstate.Messaging.MessageBuyer", true);
+ this.cfgMailOffline = config.getBoolean("RealEstate.Messaging.MailOffline", true);
this.cfgBroadcastSell = config.getBoolean("RealEstate.Messaging.BroadcastSell", true);
this.cfgPriceSellPerBlock = config.getDouble("RealEstate.Default.PricesPerBlock.Sell", 5.0);
@@ -136,11 +142,14 @@ public class Config
outConfig.set("RealEstate.Rules.AutomaticRenew", this.cfgEnableAutoRenew);
outConfig.set("RealEstate.Rules.RentPeriods", this.cfgEnableRentPeriod);
+ outConfig.set("RealEstate.Rules.DestroySigns.Rent", this.cfgDestroyRentSigns);
+ outConfig.set("RealEstate.Rules.DestroySigns.Lease", this.cfgDestroyLeaseSigns);
outConfig.set("RealEstate.Rules.TransferClaimBlocks", this.cfgTransferClaimBlocks);
outConfig.set("RealEstate.Messaging.MessageOwner", this.cfgMessageOwner);
outConfig.set("RealEstate.Messaging.MessageBuyer", this.cfgMessageBuyer);
+ outConfig.set("RealEstate.Messaging.MailOffline", this.cfgMailOffline);
outConfig.set("RealEstate.Messaging.BroadcastSell", this.cfgBroadcastSell);
outConfig.set("RealEstate.Default.PricePerBlock.Sell", this.cfgPriceSellPerBlock);
diff --git a/src/me/EtienneDx/RealEstate/RECommand.java b/src/me/EtienneDx/RealEstate/RECommand.java
index 2ceec0d..3aa3d52 100644
--- a/src/me/EtienneDx/RealEstate/RECommand.java
+++ b/src/me/EtienneDx/RealEstate/RECommand.java
@@ -9,6 +9,8 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import com.earth2me.essentials.User;
+
import co.aikar.commands.BaseCommand;
import co.aikar.commands.CommandHelp;
import co.aikar.commands.annotation.CommandAlias;
@@ -141,15 +143,23 @@ public class RECommand extends BaseCommand
"The proposition has been successfully created!");
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
+ Location loc = player.getLocation();
+ String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ? "claim" : "subclaim";
if(otherP.isOnline())
{
- Location loc = player.getLocation();
- String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ? "claim" : "subclaim";
((Player)otherP).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
ChatColor.AQUA + " has created an offer to exit the rent/lease contract for the " + claimType + " at " +
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
+ loc.getBlockZ() + "]" + ChatColor.AQUA + " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(other);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
+ ChatColor.AQUA + " has created an offer to exit the rent/lease contract for the " + claimType + " at " +
+ ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
+ + loc.getBlockZ() + "]" + ChatColor.AQUA + " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
+ }
}
@Subcommand("accept")
@@ -183,6 +193,14 @@ public class RECommand extends BaseCommand
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
", Z: " + loc.getBlockZ() + "]. It is no longer rented or leased.");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(other);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
+ ChatColor.AQUA + " has accepted your offer to exit the rent/lease contract for the " + claimType + " at " +
+ ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
+ ", Z: " + loc.getBlockZ() + "]. It is no longer rented or leased.");
+ }
bt.exitOffer = null;
claim.dropPermission(bt.buyer.toString());
bt.buyer = null;
@@ -223,6 +241,14 @@ public class RECommand extends BaseCommand
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
", Z: " + loc.getBlockZ() + "]");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(other);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
+ ChatColor.AQUA + " has refused your offer to exit the rent/lease contract for the " + claimType + " at " +
+ ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
+ ", Z: " + loc.getBlockZ() + "]");
+ }
}
}
@@ -248,6 +274,14 @@ public class RECommand extends BaseCommand
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
+ loc.getBlockZ() + "]");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(other);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
+ ChatColor.AQUA + " has cancelled his offer to exit the rent/lease contract for the " + claimType + " at " +
+ ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
+ + loc.getBlockZ() + "]");
+ }
}
else
{
diff --git a/src/me/EtienneDx/RealEstate/RealEstate.java b/src/me/EtienneDx/RealEstate/RealEstate.java
index 589b644..c95ca81 100644
--- a/src/me/EtienneDx/RealEstate/RealEstate.java
+++ b/src/me/EtienneDx/RealEstate/RealEstate.java
@@ -10,6 +10,8 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
+import com.earth2me.essentials.Essentials;
+
import co.aikar.commands.BukkitCommandManager;
import co.aikar.commands.ConditionFailedException;
import me.EtienneDx.RealEstate.Transactions.BoughtTransaction;
@@ -33,6 +35,7 @@ public class RealEstate extends JavaPlugin
public static boolean vaultPresent = false;
public static Economy econ = null;
public static Permission perms = null;
+ public static Essentials ess = null;
public static RealEstate instance = null;
@@ -70,6 +73,10 @@ public class RealEstate extends JavaPlugin
return;
}
}
+ if((ess = (Essentials)getServer().getPluginManager().getPlugin("Essentials")) != null)
+ {
+ this.log.info("Found Essentials, using version " + ess.getDescription().getVersion());
+ }
this.config = new Config();
this.config.loadConfig();// loads config or default
this.config.saveConfig();// save eventual default
diff --git a/src/me/EtienneDx/RealEstate/Transactions/BoughtTransaction.java b/src/me/EtienneDx/RealEstate/Transactions/BoughtTransaction.java
index 93e30eb..caf076b 100644
--- a/src/me/EtienneDx/RealEstate/Transactions/BoughtTransaction.java
+++ b/src/me/EtienneDx/RealEstate/Transactions/BoughtTransaction.java
@@ -4,14 +4,17 @@ import java.util.Map;
import java.util.UUID;
import org.bukkit.Location;
+import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
+import me.EtienneDx.RealEstate.RealEstate;
import me.ryanhamshire.GriefPrevention.Claim;
public abstract class BoughtTransaction extends ClaimTransaction
{
public UUID buyer = null;
public ExitOffer exitOffer = null;
+ public boolean destroyedSign = false;
public BoughtTransaction(Map map)
{
@@ -20,6 +23,8 @@ public abstract class BoughtTransaction extends ClaimTransaction
buyer = UUID.fromString((String)map.get("buyer"));
if(map.get("exitOffer") != null)
exitOffer = (ExitOffer) map.get("exitOffer");
+ if(map.get("destroyedSign") != null)// may be the case on upgrading from 0.0.1-SNAPSHOT
+ destroyedSign = (boolean) map.get("destroyedSign");
}
public BoughtTransaction(Claim claim, Player player, double price, Location sign)
@@ -35,10 +40,22 @@ public abstract class BoughtTransaction extends ClaimTransaction
map.put("buyer", buyer.toString());
if(exitOffer != null)
map.put("exitOffer", exitOffer);
+ map.put("destroyedSign", destroyedSign);
return map;
}
+ public void destroySign()
+ {
+ if((this instanceof ClaimRent &&RealEstate.instance.config.cfgDestroyRentSigns) ||
+ (this instanceof ClaimLease &&RealEstate.instance.config.cfgDestroyLeaseSigns))
+ {
+ if(!destroyedSign && getHolder().getState() instanceof Sign)
+ getHolder().breakNaturally();
+ destroyedSign = true;
+ }
+ }
+
public UUID getBuyer()
{
return buyer;
diff --git a/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java b/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java
index 9a7332e..c8c3195 100644
--- a/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java
+++ b/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java
@@ -13,6 +13,8 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
+import com.earth2me.essentials.User;
+
import me.EtienneDx.RealEstate.RealEstate;
import me.EtienneDx.RealEstate.Utils;
import me.ryanhamshire.GriefPrevention.Claim;
@@ -59,7 +61,11 @@ public class ClaimLease extends BoughtTransaction
{
if(buyer == null)// not yet leased
{
- if(sign.getBlock().getState() instanceof Sign)
+ if(destroyedSign)
+ {
+ RealEstate.transactionsStore.cancelTransaction(this);
+ }
+ else if(sign.getBlock().getState() instanceof Sign)
{
Sign s = (Sign)sign.getBlock().getState();
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
@@ -69,10 +75,6 @@ public class ClaimLease extends BoughtTransaction
s.setLine(3, Utils.getTime(frequency, null, false));
s.update(true);
}
- else
- {
- RealEstate.transactionsStore.cancelTransaction(this);
- }
}
else
{
@@ -113,6 +115,15 @@ public class ClaimLease extends BoughtTransaction
ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.buyer);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
+ "Paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
+ ", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
+ ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
+ }
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
{
@@ -123,6 +134,16 @@ public class ClaimLease extends BoughtTransaction
ChatColor.AQUA + " at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
+ ChatColor.AQUA + " has paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
+ sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
+ sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + " at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
+ ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
+ }
}
else
{
@@ -134,6 +155,15 @@ public class ClaimLease extends BoughtTransaction
ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
ChatColor.AQUA + ", the " + claimType + " is now yours");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.buyer);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
+ "Paid final lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
+ ", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
+ ChatColor.AQUA + ", the " + claimType + " is now yours");
+ }
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
{
@@ -144,6 +174,16 @@ public class ClaimLease extends BoughtTransaction
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
ChatColor.AQUA + ", the " + claimType + " is now his property");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
+ ChatColor.AQUA + " has paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
+ sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
+ sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
+ ChatColor.AQUA + ", the " + claimType + " is now his property");
+ }
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
Utils.transferClaim(claim, buyer, owner);
@@ -159,6 +199,14 @@ public class ClaimLease extends BoughtTransaction
sign.getBlockX() + ", Y: " +
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", the transaction has been cancelled.");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.buyer);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.RED +
+ "Couldn't pay the lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " +
+ sign.getBlockX() + ", Y: " +
+ sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", the transaction has been cancelled.");
+ }
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
{
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
@@ -167,6 +215,15 @@ public class ClaimLease extends BoughtTransaction
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
ChatColor.AQUA + ", the transaction has been cancelled");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
+ ChatColor.AQUA + " couldn't pay lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
+ sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
+ sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + ", the transaction has been cancelled");
+ }
RealEstate.transactionsStore.cancelTransaction(this);
}
// no need to re update, since there's no sign
@@ -258,17 +315,27 @@ public class ClaimLease extends BoughtTransaction
{
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
" has just paid for your lease for the " + claimType + " at " +
- "[" + sign.getWorld().getName() + ", " +
- "X: " + sign.getBlockX() + ", " +
- "Y: " + sign.getBlockY() + ", " +
- "Z: " + sign.getBlockZ() + "] " +
+ ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
+ + sign.getBlockZ() + "]" + ChatColor.AQUA +
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ", " +
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
+ " has just paid for your lease for the " + claimType + " at " +
+ ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
+ + sign.getBlockZ() + "]" + ChatColor.AQUA +
+ " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ", " +
+ ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
+ }
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully paid lease for this " + claimType +
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ", " +
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
+
+ destroySign();
}
}
diff --git a/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java b/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java
index eab0c98..5eab8c9 100644
--- a/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java
+++ b/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java
@@ -13,6 +13,8 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
+import com.earth2me.essentials.User;
+
import me.EtienneDx.RealEstate.RealEstate;
import me.EtienneDx.RealEstate.Utils;
import me.ryanhamshire.GriefPrevention.Claim;
@@ -65,7 +67,11 @@ public class ClaimRent extends BoughtTransaction
{
if(buyer == null)
{
- if(sign.getBlock().getState() instanceof Sign)
+ if(destroyedSign)
+ {
+ RealEstate.transactionsStore.cancelTransaction(this);
+ }
+ else if(sign.getBlock().getState() instanceof Sign)
{
Sign s = (Sign) sign.getBlock().getState();
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
@@ -75,10 +81,6 @@ public class ClaimRent extends BoughtTransaction
s.setLine(3, (maxPeriod > 1 ? maxPeriod + "x " : "") + Utils.getTime(duration, null, false));
s.update(true);
}
- else// if no one is renting it, we can delete it (no sign indicating it's rentable)
- {
- RealEstate.transactionsStore.cancelTransaction(this);
- }
}
else
{
@@ -147,6 +149,14 @@ public class ClaimRent extends BoughtTransaction
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
ChatColor.AQUA + "for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.buyer);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
+ "Paid rent for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
+ ", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + "for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
+ }
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
{
@@ -156,6 +166,17 @@ public class ClaimRent extends BoughtTransaction
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + buyerPlayer.getName() +
+ " has paid rent for the " + claimType + " at " + ChatColor.BLUE + "[" +
+ sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
+ sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
+ ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
+ }
+
+
}
else if (autoRenew)
{
@@ -166,6 +187,14 @@ public class ClaimRent extends BoughtTransaction
sign.getBlockX() + ", Y: " +
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", your access has been revoked.");
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.buyer);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.RED +
+ "Couldn't pay the rent for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " +
+ sign.getBlockX() + ", Y: " +
+ sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", your access has been revoked.");
+ }
unRent(false);
return;
}
@@ -262,15 +291,24 @@ public class ClaimRent extends BoughtTransaction
{
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
" has just rented your " + claimType + " at " +
- "[" + sign.getWorld().getName() + ", " +
- "X: " + sign.getBlockX() + ", " +
- "Y: " + sign.getBlockY() + ", " +
- "Z: " + sign.getBlockZ() + "] " +
+ ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
+ + sign.getBlockZ() + "]" + ChatColor.AQUA +
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(this.owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
+ " has just rented your " + claimType + " at " +
+ ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
+ + sign.getBlockZ() + "]" + ChatColor.AQUA +
+ " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
+ }
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully rented this " + claimType +
" for " + ChatColor.GREEN + price + RealEstate.econ.currencyNamePlural());
+
+ destroySign();
}
}
diff --git a/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java b/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java
index a662923..bcf3f3a 100644
--- a/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java
+++ b/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java
@@ -2,6 +2,8 @@ package me.EtienneDx.RealEstate.Transactions;
import org.bukkit.entity.Player;
+import com.earth2me.essentials.User;
+
import me.EtienneDx.RealEstate.RealEstate;
import me.EtienneDx.RealEstate.Utils;
import me.ryanhamshire.GriefPrevention.Claim;
@@ -110,13 +112,24 @@ public class ClaimSell extends ClaimTransaction
if(oldOwner.isOnline())
{
((Player) oldOwner).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + player.getDisplayName() +
- " has purchased your " + claimType + " at " +
+ " has purchased your " + claimType + " at " + ChatColor.BLUE +
"[" + player.getLocation().getWorld().getName() + ", " +
"X: " + player.getLocation().getBlockX() + ", " +
"Y: " + player.getLocation().getBlockY() + ", " +
- "Z: " + player.getLocation().getBlockZ() + "] for " +
+ "Z: " + player.getLocation().getBlockZ() + "] " + ChatColor.AQUA + "for " + ChatColor.GREEN +
price + " " + RealEstate.econ.currencyNamePlural());
}
+ else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
+ {
+ User u = RealEstate.ess.getUser(owner);
+ u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + player.getDisplayName() +
+ " has purchased your " + claimType + " at " + ChatColor.BLUE +
+ "[" + player.getLocation().getWorld().getName() + ", " +
+ "X: " + player.getLocation().getBlockX() + ", " +
+ "Y: " + player.getLocation().getBlockY() + ", " +
+ "Z: " + player.getLocation().getBlockZ() + "] " + ChatColor.AQUA + "for " + ChatColor.GREEN +
+ price + " " + RealEstate.econ.currencyNamePlural());;
+ }
}
}
else