Created the exitoffer command

This commit is contained in:
EtienneDx 2019-04-28 15:24:16 +02:00
parent 8e04b56a6b
commit 9578ebb9f0
9 changed files with 280 additions and 52 deletions

View File

@ -0,0 +1,46 @@
package me.EtienneDx.RealEstate;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import me.ryanhamshire.GriefPrevention.Claim;
public abstract class BoughtTransaction extends ClaimTransaction
{
UUID buyer = null;
ExitOffer exitOffer = null;
public BoughtTransaction(Map<String, Object> map)
{
super(map);
if(map.get("buyer") != null)
buyer = UUID.fromString((String)map.get("buyer"));
if(map.get("exitOffer") != null)
exitOffer = (ExitOffer) map.get("exitOffer");
}
public BoughtTransaction(Claim claim, Player player, double price, Location sign)
{
super(claim, player, price, sign);
}
@Override
public Map<String, Object> serialize()
{
Map<String, Object> map = super.serialize();
if(buyer != null)
map.put("buyer", buyer.toString());
if(exitOffer != null)
map.put("exitOffer", exitOffer);
return map;
}
public UUID getBuyer()
{
return buyer;
}
}

View File

@ -7,8 +7,6 @@ import java.time.LocalTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
@ -20,12 +18,11 @@ import me.ryanhamshire.GriefPrevention.ClaimPermission;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import net.md_5.bungee.api.ChatColor;
public class ClaimLease extends ClaimTransaction
public class ClaimLease extends BoughtTransaction
{
LocalDateTime lastPayment = null;
int frequency;
int paymentsLeft;
UUID buyer = null;
public ClaimLease(Map<String, Object> map)
{
@ -34,8 +31,6 @@ public class ClaimLease extends ClaimTransaction
lastPayment = LocalDateTime.parse((String) map.get("lastPayment"), DateTimeFormatter.ISO_DATE_TIME);
frequency = (int)map.get("frequency");
paymentsLeft = (int)map.get("paymentsLeft");
if(map.get("buyer") != null)
buyer = UUID.fromString((String)map.get("buyer"));
}
public ClaimLease(Claim claim, Player player, double price, Location sign, int frequency, int paymentsLeft)
@ -53,8 +48,6 @@ public class ClaimLease extends ClaimTransaction
map.put("lastPayment", lastPayment.format(DateTimeFormatter.ISO_DATE_TIME));
map.put("frequency", frequency);
map.put("paymentsLeft", paymentsLeft);
if(buyer != null)
map.put("buyer", buyer.toString());
return map;
}
@ -74,6 +67,10 @@ public class ClaimLease extends ClaimTransaction
s.setLine(3, Utils.getTime(frequency, null, false));
s.update(true);
}
else
{
RealEstate.transactionsStore.cancelTransaction(this);
}
}
else
{

View File

@ -7,8 +7,6 @@ import java.time.LocalTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
@ -20,11 +18,10 @@ import me.ryanhamshire.GriefPrevention.ClaimPermission;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import net.md_5.bungee.api.ChatColor;
public class ClaimRent extends ClaimTransaction
public class ClaimRent extends BoughtTransaction
{
LocalDateTime startDate = null;
int duration;
UUID rentedBy = null;
boolean autoRenew = false;
public ClaimRent(Map<String, Object> map)
@ -33,8 +30,6 @@ public class ClaimRent extends ClaimTransaction
if(map.get("startDate") != null)
startDate = LocalDateTime.parse((String) map.get("startDate"), DateTimeFormatter.ISO_DATE_TIME);
duration = (int)map.get("duration");
if(map.get("rentedBy") != null)
rentedBy = UUID.fromString((String)map.get("rentedBy"));
autoRenew = (boolean) map.get("autoRenew");
}
@ -51,8 +46,6 @@ public class ClaimRent extends ClaimTransaction
if(startDate != null)
map.put("startDate", startDate.format(DateTimeFormatter.ISO_DATE_TIME));
map.put("duration", duration);
if(rentedBy != null)
map.put("rentedBy", rentedBy.toString());
map.put("autoRenew", autoRenew);
return map;
@ -64,7 +57,7 @@ public class ClaimRent extends ClaimTransaction
if(sign.getBlock().getState() instanceof Sign)
{
Sign s = (Sign) sign.getBlock().getState();
if(rentedBy == null)
if(buyer == null)
{
s.setLine(0, RealEstate.instance.dataStore.cfgSignsHeader);
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.dataStore.cfgReplaceRent);
@ -94,7 +87,7 @@ public class ClaimRent extends ClaimTransaction
else
{
s.setLine(0, RealEstate.instance.dataStore.cfgSignsHeader);
s.setLine(1, ("Rented by " + Bukkit.getOfflinePlayer(rentedBy).getName()).substring(0, 16));
s.setLine(1, ("Rented by " + Bukkit.getOfflinePlayer(buyer).getName()).substring(0, 16));
s.setLine(2, "Time remaining : ");
int daysLeft = duration - days - 1;// we need to remove the current day
@ -106,7 +99,7 @@ public class ClaimRent extends ClaimTransaction
}
}
else
else if(buyer == null)// if no one is renting it, we can delete it (no sign indicating it's rentable)
{
RealEstate.transactionsStore.cancelTransaction(this);
}
@ -115,34 +108,34 @@ public class ClaimRent extends ClaimTransaction
private void unRent(boolean msgBuyer)
{
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
claim.dropPermission(rentedBy.toString());
if(msgBuyer && Bukkit.getOfflinePlayer(rentedBy).isOnline() && RealEstate.instance.dataStore.cfgMessageBuyer)
claim.dropPermission(buyer.toString());
if(msgBuyer && Bukkit.getOfflinePlayer(buyer).isOnline() && RealEstate.instance.dataStore.cfgMessageBuyer)
{
Bukkit.getPlayer(rentedBy).sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
Bukkit.getPlayer(buyer).sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
"The rent for the " + (claim.parent == null ? "claim" : "subclaim") + " at " + ChatColor.BLUE + "[" +
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.AQUA + " is now over, your access has been revoked.");
}
rentedBy = null;
buyer = null;
RealEstate.transactionsStore.saveData();
update();
}
private void payRent()
{
if(rentedBy == null) return;
if(buyer == null) return;
OfflinePlayer buyer = Bukkit.getOfflinePlayer(rentedBy);
OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(this.buyer);
OfflinePlayer seller = Bukkit.getOfflinePlayer(owner);
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim";
if(Utils.makePayment(owner, rentedBy, price, false, false))
if(Utils.makePayment(owner, this.buyer, price, false, false))
{
startDate = LocalDateTime.now();
if(buyer.isOnline() && RealEstate.instance.dataStore.cfgMessageBuyer)
if(buyerPlayer.isOnline() && RealEstate.instance.dataStore.cfgMessageBuyer)
{
((Player)buyer).sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
((Player)buyerPlayer).sendMessage(RealEstate.instance.dataStore.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());
@ -150,7 +143,7 @@ public class ClaimRent extends ClaimTransaction
if(seller.isOnline() && RealEstate.instance.dataStore.cfgMessageOwner)
{
((Player)seller).sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA + buyer.getName() +
((Player)seller).sendMessage(RealEstate.instance.dataStore.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() + "]" +
@ -159,9 +152,9 @@ public class ClaimRent extends ClaimTransaction
}
else
{
if(buyer.isOnline() && RealEstate.instance.dataStore.cfgMessageBuyer)
if(buyerPlayer.isOnline() && RealEstate.instance.dataStore.cfgMessageBuyer)
{
((Player)buyer).sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
((Player)buyerPlayer).sendMessage(RealEstate.instance.dataStore.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.");
@ -175,7 +168,7 @@ public class ClaimRent extends ClaimTransaction
@Override
public boolean tryCancelTransaction(Player p)
{
if(rentedBy != null)
if(buyer != null)
{
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
if(p != null)
@ -220,13 +213,13 @@ public class ClaimRent extends ClaimTransaction
claimType + "s!");
return;
}
if(player.getUniqueId().equals(rentedBy))
if(player.getUniqueId().equals(buyer))
{
player.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "You are already renting this " +
claimType + "!");
return;
}
if(rentedBy != null)
if(buyer != null)
{
player.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "Someone already rents this " +
claimType + "!");
@ -235,10 +228,10 @@ public class ClaimRent extends ClaimTransaction
if(Utils.makePayment(owner, player.getUniqueId(), price, false, true))// if payment succeed
{
rentedBy = player.getUniqueId();
buyer = player.getUniqueId();
startDate = LocalDateTime.now();
autoRenew = false;
claim.setPermission(rentedBy.toString(), ClaimPermission.Build);
claim.setPermission(buyer.toString(), ClaimPermission.Build);
update();
RealEstate.transactionsStore.saveData();
@ -278,15 +271,12 @@ public class ClaimRent extends ClaimTransaction
String claimType = claim.parent == null ? "claim" : "subclaim";
msg = ChatColor.BLUE + "-----= " + ChatColor.WHITE + "[" + ChatColor.GOLD + "RealEstate Rent Info" + ChatColor.WHITE + "]" +
ChatColor.BLUE + " =-----\n";
if(rentedBy == null)
if(buyer == null)
{
msg += ChatColor.AQUA + "This " + claimType + " is for rent for " +
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + " for a duration of " +
ChatColor.GREEN + Utils.getTime(duration, null, true) + "\n";
if(rentedBy.equals(player.getUniqueId()) && RealEstate.instance.dataStore.cfgEnableAutoRenew)
{
msg += ChatColor.AQUA + "Automatic renew is currently " + ChatColor.LIGHT_PURPLE + (autoRenew ? "enable" : "disable") + "\n";
}
if(claimType.equalsIgnoreCase("claim"))
{
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();
@ -310,9 +300,13 @@ public class ClaimRent extends ClaimTransaction
Duration timeRemaining = Duration.ofHours(24).minus(hours);
msg += ChatColor.AQUA + "This " + claimType + " is currently rented by " +
ChatColor.GREEN + Bukkit.getOfflinePlayer(rentedBy).getName() + ChatColor.AQUA + " for " +
ChatColor.GREEN + Bukkit.getOfflinePlayer(buyer).getName() + ChatColor.AQUA + " for " +
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + " for another " +
ChatColor.GREEN + Utils.getTime(daysLeft, timeRemaining, true) + "\n";
if((owner.equals(player.getUniqueId()) || buyer.equals(player.getUniqueId())) && RealEstate.instance.dataStore.cfgEnableAutoRenew)
{
msg += ChatColor.AQUA + "Automatic renew is currently " + ChatColor.LIGHT_PURPLE + (autoRenew ? "enable" : "disable") + "\n";
}
if(claimType.equalsIgnoreCase("claim"))
{
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();

View File

@ -0,0 +1,34 @@
package me.EtienneDx.RealEstate;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
public class ExitOffer implements ConfigurationSerializable
{
UUID offerBy;
double price;
public ExitOffer(UUID offerBy, double price)
{
this.offerBy = offerBy;
this.price = price;
}
public ExitOffer(Map<String, Object> map)
{
offerBy = UUID.fromString((String)map.get("offerBy"));
price = (double)map.get("price");
}
@Override
public Map<String, Object> serialize()
{
HashMap<String, Object> map = new HashMap<>();
map.put("offerBy", offerBy.toString());
map.put("price", price);
return map;
}
}

View File

@ -1,8 +1,10 @@
package me.EtienneDx.RealEstate;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Sign;
@ -331,10 +333,12 @@ public class REListener implements Listener, CommandExecutor
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if(event.getHand().equals(EquipmentSlot.HAND) && event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && event.getClickedBlock().getState() instanceof Sign)
if(event.getHand().equals(EquipmentSlot.HAND) && event.getAction().equals(Action.RIGHT_CLICK_BLOCK) &&
event.getClickedBlock().getState() instanceof Sign)
{
Sign sign = (Sign)event.getClickedBlock().getState();
if(ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase(ChatColor.stripColor(RealEstate.instance.dataStore.cfgSignsHeader)))// it is a real estate sign
// it is a real estate sign
if(ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase(ChatColor.stripColor(RealEstate.instance.dataStore.cfgSignsHeader)))
{
Player player = event.getPlayer();
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(event.getClickedBlock().getLocation(), false, null);
@ -421,7 +425,10 @@ public class REListener implements Listener, CommandExecutor
return true;
}
if(!(sender instanceof Player))
return false;
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "Only players can use this command!");
return true;
}
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(((Player)sender).getLocation(), false, null);
if(claim == null)
{
@ -436,7 +443,7 @@ public class REListener implements Listener, CommandExecutor
return true;
}
ClaimRent cr = (ClaimRent)tr;
if(!((Player)sender).getUniqueId().equals(cr.rentedBy) && !((Player)sender).getUniqueId().equals(cr.owner))
if(!((Player)sender).getUniqueId().equals(cr.buyer) && !((Player)sender).getUniqueId().equals(cr.owner))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"You are not the person renting this " + claimType + "!");
@ -450,7 +457,7 @@ public class REListener implements Listener, CommandExecutor
}
else if(args.length > 2 || (!args[1].equalsIgnoreCase("enable") && !args[1].equalsIgnoreCase("disable")))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "Usage : /" + label + " renewRent [enable|disable]!");
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "Usage : /" + label + " renewrent [enable|disable]!");
return true;
}
cr.autoRenew = args[1].equalsIgnoreCase("enable");
@ -459,10 +466,159 @@ public class REListener implements Listener, CommandExecutor
ChatColor.GREEN + (cr.autoRenew ? "enabled" : "disabled") + ChatColor.AQUA + " for this " + claimType + "!");
return true;
}
else if(args[0].equalsIgnoreCase("exitoffer"))
{
if(!(sender instanceof Player))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "Only players can use this command!");
return true;
}
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(((Player)sender).getLocation(), false, null);
if(claim == null)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "You are not standing inside of a claim!");
return true;
}
String claimType = claim.parent == null ? "claim" : "subclaim";
Transaction tr = RealEstate.transactionsStore.getTransaction(claim);
if(!(tr instanceof BoughtTransaction))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "This claim is not for rent or lease!");
return true;
}
BoughtTransaction bt = (BoughtTransaction)tr;
if(!((Player)sender).getUniqueId().equals(bt.getBuyer()) && !((Player)sender).getUniqueId().equals(tr.getOwner()))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"You are not the person renting or leasing this " + claimType + "!");
return true;
}
if(args.length == 1 || args[1].equalsIgnoreCase("info"))
{
if(bt.exitOffer == null)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA + "There is currently no exit offer for this claim!");
}
else if(bt.exitOffer.offerBy.equals(((Player)sender).getUniqueId()))
{
String msg = RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA + "You offered to exit the contract for " +
ChatColor.GREEN + bt.exitOffer.price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA +
", but your offer hasn't been accepted or denied yet...\n";
msg += ChatColor.AQUA + "To cancel your offer, just type " + ChatColor.LIGHT_PURPLE + "/" + label + " exitoffer cancel";
sender.sendMessage(msg);
}
else// it is the other person
{
String msg = RealEstate.instance.dataStore.chatPrefix + ChatColor.GREEN + Bukkit.getOfflinePlayer(bt.exitOffer.offerBy).getName() +
ChatColor.AQUA + " offered to exit the contract for " +
ChatColor.GREEN + bt.exitOffer.price + " " + RealEstate.econ.currencyNamePlural() + "\n";
msg += ChatColor.AQUA + "To accept the offer, just type " + ChatColor.LIGHT_PURPLE + "/" + label + " exitoffer accept\n";
msg += ChatColor.AQUA + "To refuse the offer, just type " + ChatColor.LIGHT_PURPLE + "/" + label + " exitoffer refuse\n";
sender.sendMessage(msg);
}
return true;
}
else if(!Arrays.asList("cancel", "accept", "refuse", "create").contains(args[1].toLowerCase()))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED + "Usage : /" + label +
" exitoffer [cancel|accept|refuse|info|create]");
return true;
}
if(args[1].equalsIgnoreCase("create"))
{
if(bt.exitOffer != null)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"There is already an exit proposition for this transaction!");
return true;
}
if(args.length != 3)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"Usage : /" + label + " exitoffer create <price>");
return true;
}
double price;
try
{
price = Double.parseDouble(args[2]);
}
catch(Exception e)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"The price isn't a valid number!");
return true;
}
if(price < 0)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"The price must be a positive number!");
return true;
}
bt.exitOffer = new ExitOffer(((Player)sender).getUniqueId(), price);
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
"The proposition has been successfully created!");
}
else
{
if(bt.exitOffer == null)
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"There has been no exit propositions for this transaction!");
return true;
}
if(args[1].equalsIgnoreCase("cancel"))
{
if(bt.exitOffer.offerBy.equals(((Player)sender).getUniqueId()))
{
bt.exitOffer = null;
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
"This exit offer has been cancelled");
}
else
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"Only the player who created this exit proposition may cancel it");
}
}
else if(args[1].equalsIgnoreCase("accept") || args[1].equalsIgnoreCase("refuse"))
{
if(bt.exitOffer.offerBy.equals(((Player)sender).getUniqueId()))
{
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.RED +
"You can't accept or refuse an offer you made!");
}
else
{
if(args[1].equalsIgnoreCase("refuse"))// easy part
{
bt.exitOffer = null;
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
"This exit offer has been refused");
}
else if(Utils.makePayment(((Player)sender).getUniqueId(), bt.exitOffer.offerBy, bt.exitOffer.price, true, false))
{
bt.exitOffer = null;
claim.dropPermission(bt.buyer.toString());
bt.buyer = null;
bt.update();// eventual cancel is contained in here
sender.sendMessage(RealEstate.instance.dataStore.chatPrefix + ChatColor.AQUA +
"This exit offer has been accepted, the " + claimType + " is no longer rented or leased!");
}
// in case of payment failure, a msg has been sent by the utils function
}
}
}
RealEstate.transactionsStore.saveData();
return true;
}
}
else// plugin infos
{
String msg = ChatColor.BLUE + "---------= [" + ChatColor.GOLD + RealEstate.instance.getDescription().getName() + ChatColor.BLUE + "] =---------\n";
String msg = ChatColor.BLUE + "-------= [" + ChatColor.GOLD + RealEstate.instance.getDescription().getName() + ChatColor.BLUE + "] =-------\n";
msg += ChatColor.AQUA + "/" + label + ChatColor.LIGHT_PURPLE + " info" + ChatColor.AQUA +
" : Gets the informations about the transactions going on in the claim you're standing in.\n";

View File

@ -64,6 +64,7 @@ public class RealEstate extends JavaPlugin
ConfigurationSerialization.registerClass(ClaimSell.class);
ConfigurationSerialization.registerClass(ClaimRent.class);
ConfigurationSerialization.registerClass(ClaimLease.class);
ConfigurationSerialization.registerClass(ExitOffer.class);
RealEstate.transactionsStore = new TransactionsStore();

View File

@ -147,7 +147,7 @@ public class TransactionsStore
public boolean canCancelTransaction(Transaction tr)
{
return tr instanceof ClaimSell || (tr instanceof ClaimRent && ((ClaimRent)tr).rentedBy == null) ||
return tr instanceof ClaimSell || (tr instanceof ClaimRent && ((ClaimRent)tr).buyer == null) ||
(tr instanceof ClaimLease && ((ClaimLease)tr).buyer == null);
}

View File

@ -16,10 +16,10 @@ import net.milkbowl.vault.economy.EconomyResponse;
public class Utils
{
public static boolean makePayment(UUID seller, UUID buyer, double amount, boolean msgSeller, boolean msgBuyer)
public static boolean makePayment(UUID receiver, UUID giver, double amount, boolean msgSeller, boolean msgBuyer)
{
// seller might be null if it is the server
OfflinePlayer s = seller != null ? Bukkit.getOfflinePlayer(seller) : null, b = Bukkit.getOfflinePlayer(buyer);
OfflinePlayer s = receiver != null ? Bukkit.getOfflinePlayer(receiver) : null, b = Bukkit.getOfflinePlayer(giver);
if(!RealEstate.econ.has(b, amount))
{
if(b.isOnline() && msgBuyer)