fix: fixed #35 and /re list command, bumped version to 1.4.0-pre2

This commit is contained in:
Etienne Dx 2022-03-04 22:18:34 +01:00
parent 2e92305aec
commit ef8b0797d7
6 changed files with 13 additions and 12 deletions

View File

@ -17,4 +17,6 @@
### Fixed
* Sign header color formatting being lost on server restart
* Fixed issue preventing to buy claims due to currencies using $ character
* Fixed issue preventing to buy claims due to currencies using $ character
* Fixed error with `/re list`
* Fixed error regarding renewrent

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Me.EtienneDx</groupId>
<artifactId>real-estate</artifactId>
<version>1.4.0-pre1</version>
<version>1.4.0-pre2</version>
<name>RealEstate</name>
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
<build>

View File

@ -1,7 +1,6 @@
package me.EtienneDx.RealEstate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.PluginDescriptionFile;
@ -353,10 +352,10 @@ public class Messages extends AnnotationConfig
public String msgInfoClaimInfoRentHeader = "$9-----= $f[$6RealEstate Rent Info$f]$9 =-----";
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.GeneralNoBuyer", comment = "0: claim type, 1: formatted price, 2: duration")
public String msgInfoClaimInfoGeneralRentNoBuyer = "$bThis {0} is for rent for $a{1}$b per $a{2}.";
public String msgInfoClaimInfoGeneralRentNoBuyer = "$bThis {0} is for rent for $a{1}$b per $a{2}$b.";
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.GeneralBuyer", comment = "0: claim type, 1: buyer name, 2: formatted price, 3: time left in current period, 4: duration of a period")
public String msgInfoClaimInfoGeneralRentBuyer = "$bThis {0} is currently rented by $a{1}$b for $a{2}$b. The {0} is rented until $a{3}$b. The rent period is $a{4}";
public String msgInfoClaimInfoGeneralRentBuyer = "$bThis {0} is currently rented by $a{1}$b for $a{2}$b. The {0} is rented for another $a{3}$b. The rent period is $a{4}";
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.MaxPeriod", comment = "0: max periods")
public String msgInfoClaimInfoRentMaxPeriod = "$bIt can be rented for a maximum of $a{0}$b periods.";
@ -449,11 +448,10 @@ public class Messages extends AnnotationConfig
}
msgTemplate = msgTemplate.replace('$', ChatColor.COLOR_CHAR);
for (int i = 0; i < args.length; i++) {
String param = args[i];
Matcher matcher = Pattern.compile("\\{" + i + "\\}").matcher(msgTemplate);
msgTemplate = matcher.replaceAll(Matcher.quoteReplacement(param));
msgTemplate = msgTemplate.replaceAll("\\{" + i + "\\}", Matcher.quoteReplacement(param));
}
return msgTemplate;

View File

@ -479,7 +479,7 @@ public class ClaimLease extends BoughtTransaction
@Override
public void msgInfo(CommandSender cs)
{
Claim claim = GriefPrevention.instance.dataStore.getClaim(claimId);
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +

View File

@ -192,7 +192,7 @@ public class ClaimRent extends BoughtTransaction
String location = "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]";
if((autoRenew || periodCount < maxPeriod) && Utils.makePayment(owner, this.buyer, price, false, false))
if((autoRenew || periodCount + 1 < maxPeriod) && Utils.makePayment(owner, this.buyer, price, false, false))
{
periodCount = (periodCount + 1) % maxPeriod;
startDate = LocalDateTime.now();
@ -335,6 +335,7 @@ public class ClaimRent extends BoughtTransaction
buyer = player.getUniqueId();
startDate = LocalDateTime.now();
autoRenew = false;
periodCount = 0;
claim.setPermission(buyer.toString(), buildTrust ? ClaimPermission.Build : ClaimPermission.Inventory);
claim.setPermission(player.getUniqueId().toString(), ClaimPermission.Manage);
claim.managers.add(player.getUniqueId().toString());
@ -477,7 +478,7 @@ public class ClaimRent extends BoughtTransaction
@Override
public void msgInfo(CommandSender cs)
{
Claim claim = GriefPrevention.instance.dataStore.getClaim(claimId);
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +

View File

@ -223,7 +223,7 @@ public class ClaimSell extends ClaimTransaction
@Override
public void msgInfo(CommandSender cs)
{
Claim claim = GriefPrevention.instance.dataStore.getClaim(claimId);
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
if(claim == null) {
tryCancelTransaction(null, true);
return;