Changed to automatically sell/rent/lease as 'SERVER' for admin claims

This commit is contained in:
EtienneDx 2019-08-06 14:34:13 +02:00
parent 2cff090309
commit 8c18e01cb4
8 changed files with 1365 additions and 1325 deletions

View File

@ -14,7 +14,7 @@ public class GP_RealEstateHook implements IRealEstate
public String allowEdit(Claim claim, Player player) public String allowEdit(Claim claim, Player player)
{ {
Transaction b = RealEstate.transactionsStore.getTransaction(claim); Transaction b = RealEstate.transactionsStore.getTransaction(claim);
if(b != null && b.getOwner().equals(player.getUniqueId()) && b instanceof BoughtTransaction) if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)
{ {
if(((BoughtTransaction)b).getBuyer() != null) if(((BoughtTransaction)b).getBuyer() != null)
return "This claim is currently involved in a transaction, you can't edit it!"; return "This claim is currently involved in a transaction, you can't edit it!";
@ -26,7 +26,7 @@ public class GP_RealEstateHook implements IRealEstate
public String allowBuild(Claim claim, Player player, Material material) public String allowBuild(Claim claim, Player player, Material material)
{ {
Transaction b = RealEstate.transactionsStore.getTransaction(claim); Transaction b = RealEstate.transactionsStore.getTransaction(claim);
if(b != null && b.getOwner().equals(player.getUniqueId()) && b instanceof BoughtTransaction) if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)// ??
{ {
if(((BoughtTransaction)b).getBuyer() != null) if(((BoughtTransaction)b).getBuyer() != null)
return "This claim is currently involved in a transaction, you can't build on it!"; return "This claim is currently involved in a transaction, you can't build on it!";
@ -38,7 +38,7 @@ public class GP_RealEstateHook implements IRealEstate
public String allowAccess(Claim claim, Player player) public String allowAccess(Claim claim, Player player)
{ {
Transaction b = RealEstate.transactionsStore.getTransaction(claim); Transaction b = RealEstate.transactionsStore.getTransaction(claim);
if(b != null && b.getOwner().equals(player.getUniqueId()) && b instanceof BoughtTransaction) if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)
{ {
if(((BoughtTransaction)b).getBuyer() != null) if(((BoughtTransaction)b).getBuyer() != null)
return "This claim is currently involved in a transaction, you can't access it!"; return "This claim is currently involved in a transaction, you can't access it!";
@ -50,7 +50,7 @@ public class GP_RealEstateHook implements IRealEstate
public String allowContainers(Claim claim, Player player) public String allowContainers(Claim claim, Player player)
{ {
Transaction b = RealEstate.transactionsStore.getTransaction(claim); Transaction b = RealEstate.transactionsStore.getTransaction(claim);
if(b != null && b.getOwner().equals(player.getUniqueId()) && b instanceof BoughtTransaction) if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)
{ {
if(((BoughtTransaction)b).getBuyer() != null) if(((BoughtTransaction)b).getBuyer() != null)
return "This claim is currently involved in a transaction, you can't access it's containers!"; return "This claim is currently involved in a transaction, you can't access it's containers!";

View File

@ -87,7 +87,7 @@ public class RECommand extends BaseCommand
} }
} }
@Subcommand("seller") /*@Subcommand("seller")
@Description("Displays or changes the seller of a claim (admin only)") @Description("Displays or changes the seller of a claim (admin only)")
@Conditions("inPendingTransactionClaim") @Conditions("inPendingTransactionClaim")
public static void setSeller(Player player, @Optional String newSeller) public static void setSeller(Player player, @Optional String newSeller)
@ -112,6 +112,7 @@ public class RECommand extends BaseCommand
{ {
tr.setOwner(null); tr.setOwner(null);
tr.update(); tr.update();
RealEstate.transactionsStore.saveData();
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "Changed the seller to the server"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "Changed the seller to the server");
} }
else else
@ -130,11 +131,12 @@ public class RECommand extends BaseCommand
{ {
tr.setOwner(newOwner.getUniqueId()); tr.setOwner(newOwner.getUniqueId());
tr.update(); tr.update();
RealEstate.transactionsStore.saveData();
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "Changed the seller to " + player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "Changed the seller to " +
ChatColor.GREEN + newOwner.getDisplayName()); ChatColor.GREEN + newOwner.getDisplayName());
} }
} }
} }*/
@Subcommand("exitoffer") @Subcommand("exitoffer")
@Conditions("partOfBoughtTransaction") @Conditions("partOfBoughtTransaction")

View File

@ -115,13 +115,16 @@ public class REListener implements Listener
return; return;
} }
if(claim.isAdminClaim() && !RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims if(claim.isAdminClaim())
{
if(!RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims
{ {
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to sell admin claims!"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to sell admin claims!");
event.setCancelled(true); event.setCancelled(true);
event.getBlock().breakNaturally(); event.getBlock().breakNaturally();
return; return;
} }
}
else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim
{ {
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only sell claims you own!"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only sell claims you own!");
@ -132,7 +135,7 @@ public class REListener implements Listener
// we should be good to sell it now // we should be good to sell it now
event.setCancelled(true);// need to cancel the event, so we can update the sign elsewhere event.setCancelled(true);// need to cancel the event, so we can update the sign elsewhere
RealEstate.transactionsStore.sell(claim, player, price, event.getBlock().getLocation()); RealEstate.transactionsStore.sell(claim, claim.isAdminClaim() ? null : player, price, event.getBlock().getLocation());
} }
else if(RealEstate.instance.config.cfgRentKeywords.contains(event.getLine(0).toLowerCase()))// we want to rent it else if(RealEstate.instance.config.cfgRentKeywords.contains(event.getLine(0).toLowerCase()))// we want to rent it
{ {
@ -216,13 +219,16 @@ public class REListener implements Listener
} }
} }
if(claim.isAdminClaim() && !RealEstate.perms.has(player, "realestate.admin"))// admin may rent admin claims if(claim.isAdminClaim())
{
if(!RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims
{ {
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to rent admin claims!"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to rent admin claims!");
event.setCancelled(true); event.setCancelled(true);
event.getBlock().breakNaturally(); event.getBlock().breakNaturally();
return; return;
} }
}
else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim
{ {
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only rent claims you own!"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only rent claims you own!");
@ -307,13 +313,16 @@ public class REListener implements Listener
return; return;
} }
if(claim.isAdminClaim() && !RealEstate.perms.has(player, "realestate.admin"))// admin may rent admin claims if(claim.isAdminClaim())
{
if(!RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims
{ {
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to lease admin claims!"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to lease admin claims!");
event.setCancelled(true); event.setCancelled(true);
event.getBlock().breakNaturally(); event.getBlock().breakNaturally();
return; return;
} }
}
else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim
{ {
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only lease claims you own!"); player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only lease claims you own!");

View File

@ -105,7 +105,7 @@ public class ClaimLease extends BoughtTransaction
if(buyer == null) return; if(buyer == null) return;
OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(buyer); OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(buyer);
OfflinePlayer seller = Bukkit.getOfflinePlayer(owner); OfflinePlayer seller = owner == null ? null : Bukkit.getOfflinePlayer(owner);
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim"; String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim";
@ -133,6 +133,8 @@ public class ClaimLease extends BoughtTransaction
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left"); ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
} }
if(owner != null)
{
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner) if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
{ {
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() + ((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
@ -153,6 +155,7 @@ public class ClaimLease extends BoughtTransaction
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left"); ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
} }
} }
}
else else
{ {
if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer) if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer)

View File

@ -142,7 +142,7 @@ public class ClaimRent extends BoughtTransaction
if(buyer == null) return; if(buyer == null) return;
OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(this.buyer); OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(this.buyer);
OfflinePlayer seller = Bukkit.getOfflinePlayer(owner); OfflinePlayer seller = owner == null ? null : Bukkit.getOfflinePlayer(owner);
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim"; String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim";
@ -166,6 +166,8 @@ public class ClaimRent extends BoughtTransaction
ChatColor.AQUA + "for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural()); ChatColor.AQUA + "for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
} }
if(seller != null)
{
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner) if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
{ {
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + buyerPlayer.getName() + ((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + buyerPlayer.getName() +
@ -183,7 +185,7 @@ public class ClaimRent extends BoughtTransaction
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural()); ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
} }
}
} }
else if (autoRenew) else if (autoRenew)

View File

@ -115,7 +115,7 @@ public class ClaimSell extends ClaimTransaction
"Z: " + player.getLocation().getBlockZ() + "] " + "Z: " + player.getLocation().getBlockZ() + "] " +
"Price: " + price + " " + RealEstate.econ.currencyNamePlural()); "Price: " + price + " " + RealEstate.econ.currencyNamePlural());
if(RealEstate.instance.config.cfgMessageOwner) if(RealEstate.instance.config.cfgMessageOwner && owner != null)
{ {
OfflinePlayer oldOwner = Bukkit.getOfflinePlayer(owner); OfflinePlayer oldOwner = Bukkit.getOfflinePlayer(owner);
if(oldOwner.isOnline()) if(oldOwner.isOnline())

View File

@ -2,6 +2,10 @@ package me.EtienneDx.RealEstate.Transactions;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Collection; import java.util.Collection;
@ -10,10 +14,12 @@ import java.util.HashMap;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.FileUtil;
import me.EtienneDx.RealEstate.RealEstate; import me.EtienneDx.RealEstate.RealEstate;
import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.Claim;
@ -59,25 +65,40 @@ public class TransactionsStore
claimRent = new HashMap<>(); claimRent = new HashMap<>();
claimLease = new HashMap<>(); claimLease = new HashMap<>();
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(this.dataFilePath)); File file = new File(this.dataFilePath);
for(String key : config.getKeys(true))
{ FileConfiguration config = YamlConfiguration.loadConfiguration(file);
if(key.startsWith("Sell.")) try {
{ RealEstate.instance.addLogEntry(new String(Files.readAllBytes(FileSystems.getDefault().getPath(this.dataFilePath))));
ClaimSell cs = (ClaimSell)config.get(key); } catch (IOException e) {
claimSell.put(key.substring(5), cs); // TODO Auto-generated catch block
e.printStackTrace();
} }
else if(key.startsWith("Rent.")) ConfigurationSection sell = config.getConfigurationSection("Sell");
ConfigurationSection rent = config.getConfigurationSection("Rent");
ConfigurationSection lease = config.getConfigurationSection("Lease");
if(sell != null)
{ {
ClaimRent cr = (ClaimRent)config.get(key); RealEstate.instance.addLogEntry(sell.toString());
claimRent.put(key.substring(5), cr); RealEstate.instance.addLogEntry(sell.getKeys(false).size() + "");
} for(String key : sell.getKeys(false))
else if(key.startsWith("Lease."))
{ {
ClaimLease cl = (ClaimLease)config.get(key); ClaimSell cs = (ClaimSell)sell.get(key);
claimLease.put(key.substring(6), cl); claimSell.put(key, cs);
} }
} }
if(rent != null)
for(String key : rent.getKeys(false))
{
ClaimRent cr = (ClaimRent)rent.get(key);
claimRent.put(key, cr);
}
if(lease != null)
for(String key : lease.getKeys(false))
{
ClaimLease cl = (ClaimLease)lease.get(key);
claimLease.put(key, cl);
}
} }
public void saveData() public void saveData()
@ -160,12 +181,12 @@ public class TransactionsStore
cs.update(); cs.update();
saveData(); saveData();
RealEstate.instance.addLogEntry("[" + this.dateFormat.format(this.date) + "] " + player.getName() + RealEstate.instance.addLogEntry("[" + this.dateFormat.format(this.date) + "] " + (player == null ? "The Server" : player.getName()) +
" has made " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for sale at " + " has made " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for sale at " +
"[" + player.getLocation().getWorld() + ", " + "[" + claim.getGreaterBoundaryCorner().getWorld() + ", " +
"X: " + player.getLocation().getBlockX() + ", " + "X: " + claim.getGreaterBoundaryCorner().getBlockX() + ", " +
"Y: " + player.getLocation().getBlockY() + ", " + "Y: " + claim.getGreaterBoundaryCorner().getBlockY() + ", " +
"Z: " + player.getLocation().getBlockZ() + "] " + "Z: " + claim.getGreaterBoundaryCorner().getBlockZ() + "] " +
"Price: " + price + " " + RealEstate.econ.currencyNamePlural()); "Price: " + price + " " + RealEstate.econ.currencyNamePlural());
if(player != null) if(player != null)
@ -180,7 +201,7 @@ public class TransactionsStore
{ {
if(p != player) if(p != player)
{ {
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + player.getDisplayName() + p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + (player == null ? "The Server" : player.getDisplayName()) +
ChatColor.AQUA + " has put " + ChatColor.AQUA + " has put " +
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for sale for " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for sale for " +
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural()); ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
@ -196,12 +217,12 @@ public class TransactionsStore
cr.update(); cr.update();
saveData(); saveData();
RealEstate.instance.addLogEntry("[" + this.dateFormat.format(this.date) + "] " + player.getName() + RealEstate.instance.addLogEntry("[" + this.dateFormat.format(this.date) + "] " + (player == null ? "The Server" : player.getName()) +
" has made " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for rent at " + " has made " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for rent at " +
"[" + player.getLocation().getWorld() + ", " + "[" + claim.getLesserBoundaryCorner().getWorld() + ", " +
"X: " + player.getLocation().getBlockX() + ", " + "X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
"Y: " + player.getLocation().getBlockY() + ", " + "Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +
"Z: " + player.getLocation().getBlockZ() + "] " + "Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "] " +
"Price: " + price + " " + RealEstate.econ.currencyNamePlural()); "Price: " + price + " " + RealEstate.econ.currencyNamePlural());
if(player != null) if(player != null)
@ -216,7 +237,7 @@ public class TransactionsStore
{ {
if(p != player) if(p != player)
{ {
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + player.getDisplayName() + p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + (player == null ? "The Server" : player.getDisplayName()) +
ChatColor.AQUA + " has put " + ChatColor.AQUA + " has put " +
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for rent for " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for rent for " +
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural()); ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
@ -232,12 +253,12 @@ public class TransactionsStore
cl.update(); cl.update();
saveData(); saveData();
RealEstate.instance.addLogEntry("[" + this.dateFormat.format(this.date) + "] " + player.getName() + RealEstate.instance.addLogEntry("[" + this.dateFormat.format(this.date) + "] " + (player == null ? "The Server" : player.getName()) +
" has made " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for lease at " + " has made " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for lease at " +
"[" + player.getLocation().getWorld() + ", " + "[" + claim.getLesserBoundaryCorner().getWorld() + ", " +
"X: " + player.getLocation().getBlockX() + ", " + "X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
"Y: " + player.getLocation().getBlockY() + ", " + "Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +
"Z: " + player.getLocation().getBlockZ() + "] " + "Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "] " +
"Payments Count : " + paymentsCount + " " + "Payments Count : " + paymentsCount + " " +
"Price: " + price + " " + RealEstate.econ.currencyNamePlural()); "Price: " + price + " " + RealEstate.econ.currencyNamePlural());
@ -254,7 +275,7 @@ public class TransactionsStore
{ {
if(p != player) if(p != player)
{ {
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + player.getDisplayName() + p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + (player == null ? "The Server" : player.getDisplayName()) +
ChatColor.AQUA + " has put " + ChatColor.AQUA + " has put " +
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for lease for " + (claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for lease for " +
ChatColor.GREEN + paymentsCount + ChatColor.AQUA + " payments of " + ChatColor.GREEN + paymentsCount + ChatColor.AQUA + " payments of " +

View File

@ -104,6 +104,8 @@ public class Utils
if(claim.parent == null && RealEstate.instance.config.cfgTransferClaimBlocks) if(claim.parent == null && RealEstate.instance.config.cfgTransferClaimBlocks)
{ {
PlayerData buyerData = GriefPrevention.instance.dataStore.getPlayerData(buyer); PlayerData buyerData = GriefPrevention.instance.dataStore.getPlayerData(buyer);
if(seller != null)
{
PlayerData sellerData = GriefPrevention.instance.dataStore.getPlayerData(seller); PlayerData sellerData = GriefPrevention.instance.dataStore.getPlayerData(seller);
// the seller has to provide the blocks // the seller has to provide the blocks
@ -113,6 +115,7 @@ public class Utils
sellerData.setAccruedClaimBlocks(sellerData.getAccruedClaimBlocks() + sellerData.getBonusClaimBlocks()); sellerData.setAccruedClaimBlocks(sellerData.getAccruedClaimBlocks() + sellerData.getBonusClaimBlocks());
sellerData.setBonusClaimBlocks(0); sellerData.setBonusClaimBlocks(0);
} }
}
// the buyer receive them // the buyer receive them
buyerData.setBonusClaimBlocks(buyerData.getBonusClaimBlocks() + claim.getArea()); buyerData.setBonusClaimBlocks(buyerData.getBonusClaimBlocks() + claim.getArea());