Added mail support and optionnal sign removal
This commit is contained in:
parent
53597d7e9d
commit
f603b07ff7
13
pom.xml
13
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Me.EtienneDx</groupId>
|
||||
<artifactId>RealEstate</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>0.1.1-SNAPSHOT</version>
|
||||
<name>RealEstate</name>
|
||||
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
|
||||
<build>
|
||||
@ -74,6 +74,11 @@
|
||||
<id>aikar</id>
|
||||
<url>https://repo.aikar.co/content/groups/aikar/</url>
|
||||
</repository>
|
||||
<!-- EssentialsX repo -->
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -99,5 +104,11 @@
|
||||
<artifactId>acf-bukkit</artifactId>
|
||||
<version>0.5.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
<version>2.16.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
if(otherP.isOnline())
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ? "claim" : "subclaim";
|
||||
if(otherP.isOnline())
|
||||
{
|
||||
((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")
|
||||
@ -182,6 +192,14 @@ public class RECommand extends BaseCommand
|
||||
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.");
|
||||
}
|
||||
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());
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<String, Object> 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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -143,6 +173,16 @@ public class ClaimLease extends BoughtTransaction
|
||||
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");
|
||||
}
|
||||
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);
|
||||
|
||||
@ -158,6 +198,14 @@ public class ClaimLease extends BoughtTransaction
|
||||
"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.");
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -166,6 +214,15 @@ public class ClaimLease extends BoughtTransaction
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
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);
|
||||
}
|
||||
@ -258,10 +315,18 @@ 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");
|
||||
}
|
||||
@ -269,6 +334,8 @@ public class ClaimLease extends BoughtTransaction
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -165,6 +186,14 @@ public class ClaimRent extends BoughtTransaction
|
||||
"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.");
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user