Don't let player loot if reloot time is disabled (#9615)

If the reloot time is disabled while reloot is restricted, the player
should not be able to reloot. The previous logic was incorrect and
allowed players to reloot explicitly when the reloot time was disabled.
This commit is contained in:
Bjarne Koll 2023-08-16 06:08:00 +02:00 committed by GitHub
parent 6520ca1c47
commit 47b805fdf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -240,7 +240,7 @@ index 0000000000000000000000000000000000000000..8e6dac2cef7af26ad74928eff631c182
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..87c5f8a43b8643486ba898e1cea33873398f3b1c index 0000000000000000000000000000000000000000..5408cbc21fc7577a6100b5a1ca0463e899d2df8b
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
@@ -0,0 +1,188 @@ @@ -0,0 +1,188 @@
@ -419,7 +419,7 @@ index 0000000000000000000000000000000000000000..87c5f8a43b8643486ba898e1cea33873
+ if (!worldConfiguration.lootables.restrictPlayerReloot || lastLooted == null) return true; + if (!worldConfiguration.lootables.restrictPlayerReloot || lastLooted == null) return true;
+ +
+ final DurationOrDisabled restrictPlayerRelootTime = worldConfiguration.lootables.restrictPlayerRelootTime; + final DurationOrDisabled restrictPlayerRelootTime = worldConfiguration.lootables.restrictPlayerRelootTime;
+ if (restrictPlayerRelootTime.value().isEmpty()) return true; + if (restrictPlayerRelootTime.value().isEmpty()) return false;
+ +
+ return TimeUnit.SECONDS.toMillis(restrictPlayerRelootTime.value().get().seconds()) + lastLooted < System.currentTimeMillis(); + return TimeUnit.SECONDS.toMillis(restrictPlayerRelootTime.value().get().seconds()) + lastLooted < System.currentTimeMillis();
+ } + }