Multiple bug fixes
This commit is contained in:
parent
44f64dd400
commit
5570e8bec2
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>Me.EtienneDx</groupId>
|
<groupId>Me.EtienneDx</groupId>
|
||||||
<artifactId>RealEstate</artifactId>
|
<artifactId>RealEstate</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.1.1</version>
|
||||||
<name>RealEstate</name>
|
<name>RealEstate</name>
|
||||||
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
|
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
|
||||||
<build>
|
<build>
|
||||||
@ -88,7 +88,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.14-R0.1-SNAPSHOT</version>
|
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -58,7 +58,7 @@ public class RECommand extends BaseCommand
|
|||||||
@Description("Displays the list of all real estate offers currently existing")
|
@Description("Displays the list of all real estate offers currently existing")
|
||||||
@CommandCompletion("all|sell|rent|lease")
|
@CommandCompletion("all|sell|rent|lease")
|
||||||
@Syntax("[all|sell|rent|lease] <page>")
|
@Syntax("[all|sell|rent|lease] <page>")
|
||||||
public static void list(Player player, @Optional String type, @Default("1") int page)
|
public static void list(CommandSender player, @Optional String type, @Default("1") int page)
|
||||||
{
|
{
|
||||||
if(page <= 0)
|
if(page <= 0)
|
||||||
{
|
{
|
||||||
@ -94,9 +94,12 @@ public class RECommand extends BaseCommand
|
|||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Invalid option provided!");
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Invalid option provided!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.DARK_BLUE + "----= " + ChatColor.WHITE + "[ " + ChatColor.GOLD + typeMsg + ChatColor.DARK_GREEN + " " +
|
if(count == 0)
|
||||||
page + ChatColor.GOLD + " / " + ChatColor.DARK_GREEN + (int)Math.ceil(count / (double)RealEstate.instance.config.cfgPageSize) +
|
{
|
||||||
ChatColor.WHITE + " ]" + ChatColor.DARK_BLUE + " =----");
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "No transaction have been found!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ArrayList<Transaction> transactions = new ArrayList<Transaction>(count);
|
ArrayList<Transaction> transactions = new ArrayList<Transaction>(count);
|
||||||
if(type == null || type.equalsIgnoreCase("all"))
|
if(type == null || type.equalsIgnoreCase("all"))
|
||||||
{
|
{
|
||||||
@ -118,11 +121,26 @@ public class RECommand extends BaseCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
int max = Math.min(start + RealEstate.instance.config.cfgPageSize, count);
|
int max = Math.min(start + RealEstate.instance.config.cfgPageSize, count);
|
||||||
|
if(start <= max)
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.DARK_BLUE + "----= " + ChatColor.WHITE + "[ " + ChatColor.GOLD + typeMsg + " page " + ChatColor.DARK_GREEN + " " +
|
||||||
|
page + ChatColor.GOLD + " / " + ChatColor.DARK_GREEN + (int)Math.ceil(count / (double)RealEstate.instance.config.cfgPageSize) +
|
||||||
|
ChatColor.WHITE + " ]" + ChatColor.DARK_BLUE + " =----");
|
||||||
for(int i = start; i < max; i++)
|
for(int i = start; i < max; i++)
|
||||||
{
|
{
|
||||||
RealEstate.instance.log.info("transaction " + i);
|
RealEstate.instance.log.info("transaction " + i);
|
||||||
transactions.get(i).msgInfo(player);
|
transactions.get(i).msgInfo(player);
|
||||||
}
|
}
|
||||||
|
if(page < (int)Math.ceil(count / (double)RealEstate.instance.config.cfgPageSize))
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.GOLD + "To see the next page, type " + ChatColor.GREEN + "/re list " + (type != null ? type : "all") + " " + (page + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This page does not exist!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("renewrent")
|
@Subcommand("renewrent")
|
||||||
@ -270,6 +288,8 @@ public class RECommand extends BaseCommand
|
|||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||||
"The proposition has been successfully created!");
|
"The proposition has been successfully created!");
|
||||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||||
|
if(other != null)// not an admin claim
|
||||||
|
{
|
||||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ? "claim" : "subclaim";
|
String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ? "claim" : "subclaim";
|
||||||
@ -289,6 +309,7 @@ public class RECommand extends BaseCommand
|
|||||||
+ loc.getBlockZ() + "]" + ChatColor.AQUA + " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
+ loc.getBlockZ() + "]" + ChatColor.AQUA + " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subcommand("accept")
|
@Subcommand("accept")
|
||||||
@Description("Accepts an offer to break an ongoing transaction")
|
@Description("Accepts an offer to break an ongoing transaction")
|
||||||
@ -313,6 +334,8 @@ public class RECommand extends BaseCommand
|
|||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||||
"This exit offer has been accepted, the " + claimType + " is no longer rented or leased!");
|
"This exit offer has been accepted, the " + claimType + " is no longer rented or leased!");
|
||||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||||
|
if(other != null)
|
||||||
|
{
|
||||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||||
if(otherP.isOnline())
|
if(otherP.isOnline())
|
||||||
{
|
{
|
||||||
@ -329,6 +352,7 @@ public class RECommand extends BaseCommand
|
|||||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||||
", Z: " + loc.getBlockZ() + "]. It is no longer rented or leased.");
|
", Z: " + loc.getBlockZ() + "]. It is no longer rented or leased.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bt.exitOffer = null;
|
bt.exitOffer = null;
|
||||||
claim.dropPermission(bt.buyer.toString());
|
claim.dropPermission(bt.buyer.toString());
|
||||||
GriefPrevention.instance.dataStore.saveClaim(claim);
|
GriefPrevention.instance.dataStore.saveClaim(claim);
|
||||||
@ -362,6 +386,8 @@ public class RECommand extends BaseCommand
|
|||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||||
"This exit offer has been refused");
|
"This exit offer has been refused");
|
||||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||||
|
if(other != null)
|
||||||
|
{
|
||||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||||
if(otherP.isOnline())
|
if(otherP.isOnline())
|
||||||
{
|
{
|
||||||
@ -380,6 +406,7 @@ public class RECommand extends BaseCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subcommand("cancel")
|
@Subcommand("cancel")
|
||||||
@Description("Cancels an offer to break an ongoing transaction")
|
@Description("Cancels an offer to break an ongoing transaction")
|
||||||
@ -395,6 +422,8 @@ public class RECommand extends BaseCommand
|
|||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||||
"This exit offer has been cancelled");
|
"This exit offer has been cancelled");
|
||||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||||
|
if(other != null)
|
||||||
|
{
|
||||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||||
if(otherP.isOnline())
|
if(otherP.isOnline())
|
||||||
{
|
{
|
||||||
@ -412,6 +441,7 @@ public class RECommand extends BaseCommand
|
|||||||
+ loc.getBlockZ() + "]");
|
+ loc.getBlockZ() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||||
|
|||||||
@ -164,7 +164,7 @@ public class RealEstate extends JavaPlugin
|
|||||||
throw new ConditionFailedException("This command only applies to rented or leased claims!");
|
throw new ConditionFailedException("This command only applies to rented or leased claims!");
|
||||||
}
|
}
|
||||||
if((((BoughtTransaction)tr).buyer != null && ((BoughtTransaction)tr).buyer.equals(context.getIssuer().getPlayer().getUniqueId())) ||
|
if((((BoughtTransaction)tr).buyer != null && ((BoughtTransaction)tr).buyer.equals(context.getIssuer().getPlayer().getUniqueId())) ||
|
||||||
tr.getOwner().equals(context.getIssuer().getPlayer().getUniqueId()))
|
(tr.getOwner() != null && tr.getOwner().equals(context.getIssuer().getPlayer().getUniqueId())))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
@ -417,9 +418,9 @@ public class ClaimLease extends BoughtTransaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void msgInfo(Player player)
|
public void msgInfo(CommandSender cs)
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
cs.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
||||||
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Lease " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Lease " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
||||||
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||||
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
@ -255,7 +256,7 @@ public class ClaimRent extends BoughtTransaction
|
|||||||
}
|
}
|
||||||
if(claim.parent == null && owner != null && !owner.equals(claim.ownerID))
|
if(claim.parent == null && owner != null && !owner.equals(claim.ownerID))
|
||||||
{
|
{
|
||||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + Bukkit.getPlayer(owner).getDisplayName() +
|
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + Bukkit.getOfflinePlayer(owner).getName() +
|
||||||
" does not have the right to rent this " + claimType + "!");
|
" does not have the right to rent this " + claimType + "!");
|
||||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||||
return;
|
return;
|
||||||
@ -396,9 +397,9 @@ public class ClaimRent extends BoughtTransaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void msgInfo(Player player)
|
public void msgInfo(CommandSender cs)
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
cs.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
||||||
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Rent " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Rent " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
||||||
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||||
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public class ClaimSell extends ClaimTransaction
|
public class ClaimSell extends ClaimTransaction
|
||||||
{
|
{
|
||||||
@ -193,9 +194,9 @@ public class ClaimSell extends ClaimTransaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void msgInfo(Player player)
|
public void msgInfo(CommandSender cs)
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
cs.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
||||||
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Sell " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Sell " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
||||||
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||||
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package me.EtienneDx.RealEstate.Transactions;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public interface Transaction
|
public interface Transaction
|
||||||
@ -14,5 +15,5 @@ public interface Transaction
|
|||||||
public void preview(Player player);
|
public void preview(Player player);
|
||||||
public boolean update();
|
public boolean update();
|
||||||
public boolean tryCancelTransaction(Player p);
|
public boolean tryCancelTransaction(Player p);
|
||||||
public void msgInfo(Player player);
|
public void msgInfo(CommandSender cs);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user