Skip to content

Commit ef8b079

Browse files
committed
fix: fixed #35 and /re list command, bumped version to 1.4.0-pre2
1 parent 2e92305 commit ef8b079

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@
1717

1818
### Fixed
1919
* Sign header color formatting being lost on server restart
20-
* Fixed issue preventing to buy claims due to currencies using $ character
20+
* Fixed issue preventing to buy claims due to currencies using $ character
21+
* Fixed error with `/re list`
22+
* Fixed error regarding renewrent

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>Me.EtienneDx</groupId>
66
<artifactId>real-estate</artifactId>
7-
<version>1.4.0-pre1</version>
7+
<version>1.4.0-pre2</version>
88
<name>RealEstate</name>
99
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
1010
<build>

src/me/EtienneDx/RealEstate/Messages.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package me.EtienneDx.RealEstate;
22

33
import java.util.regex.Matcher;
4-
import java.util.regex.Pattern;
54

65
import org.bukkit.command.CommandSender;
76
import org.bukkit.plugin.PluginDescriptionFile;
@@ -353,10 +352,10 @@ public class Messages extends AnnotationConfig
353352
public String msgInfoClaimInfoRentHeader = "$9-----= $f[$6RealEstate Rent Info$f]$9 =-----";
354353

355354
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.GeneralNoBuyer", comment = "0: claim type, 1: formatted price, 2: duration")
356-
public String msgInfoClaimInfoGeneralRentNoBuyer = "$bThis {0} is for rent for $a{1}$b per $a{2}.";
355+
public String msgInfoClaimInfoGeneralRentNoBuyer = "$bThis {0} is for rent for $a{1}$b per $a{2}$b.";
357356

358357
@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")
359-
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}";
358+
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}";
360359

361360
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.MaxPeriod", comment = "0: max periods")
362361
public String msgInfoClaimInfoRentMaxPeriod = "$bIt can be rented for a maximum of $a{0}$b periods.";
@@ -449,11 +448,10 @@ public static String getMessage(String msgTemplate, boolean withPrefix, String..
449448
}
450449

451450
msgTemplate = msgTemplate.replace('$', ChatColor.COLOR_CHAR);
452-
451+
453452
for (int i = 0; i < args.length; i++) {
454453
String param = args[i];
455-
Matcher matcher = Pattern.compile("\\{" + i + "\\}").matcher(msgTemplate);
456-
msgTemplate = matcher.replaceAll(Matcher.quoteReplacement(param));
454+
msgTemplate = msgTemplate.replaceAll("\\{" + i + "\\}", Matcher.quoteReplacement(param));
457455
}
458456

459457
return msgTemplate;

src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ public void preview(Player player)
479479
@Override
480480
public void msgInfo(CommandSender cs)
481481
{
482-
Claim claim = GriefPrevention.instance.dataStore.getClaim(claimId);
482+
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
483483
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
484484
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
485485
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +

src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private void payRent()
192192
String location = "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
193193
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]";
194194

195-
if((autoRenew || periodCount < maxPeriod) && Utils.makePayment(owner, this.buyer, price, false, false))
195+
if((autoRenew || periodCount + 1 < maxPeriod) && Utils.makePayment(owner, this.buyer, price, false, false))
196196
{
197197
periodCount = (periodCount + 1) % maxPeriod;
198198
startDate = LocalDateTime.now();
@@ -335,6 +335,7 @@ public void interact(Player player)
335335
buyer = player.getUniqueId();
336336
startDate = LocalDateTime.now();
337337
autoRenew = false;
338+
periodCount = 0;
338339
claim.setPermission(buyer.toString(), buildTrust ? ClaimPermission.Build : ClaimPermission.Inventory);
339340
claim.setPermission(player.getUniqueId().toString(), ClaimPermission.Manage);
340341
claim.managers.add(player.getUniqueId().toString());
@@ -477,7 +478,7 @@ public void preview(Player player)
477478
@Override
478479
public void msgInfo(CommandSender cs)
479480
{
480-
Claim claim = GriefPrevention.instance.dataStore.getClaim(claimId);
481+
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
481482
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
482483
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
483484
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +

src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public void setOwner(UUID newOwner)
223223
@Override
224224
public void msgInfo(CommandSender cs)
225225
{
226-
Claim claim = GriefPrevention.instance.dataStore.getClaim(claimId);
226+
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
227227
if(claim == null) {
228228
tryCancelTransaction(null, true);
229229
return;

0 commit comments

Comments
 (0)