mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Avoid int overflow in lootable refill time calculations (#1146)
Fixes https://github.com/PaperMC/Paper/issues/1141
This commit is contained in:
parent
1470add5c4
commit
b77a601ae0
1 changed files with 4 additions and 4 deletions
|
@ -231,7 +231,7 @@ index 000000000..668097620
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..01c2713d3
|
index 000000000..de2eff17e
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
|
@ -326,9 +326,9 @@ index 000000000..01c2713d3
|
||||||
+ this.lastFill = System.currentTimeMillis();
|
+ this.lastFill = System.currentTimeMillis();
|
||||||
+ final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig;
|
+ final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig;
|
||||||
+ if (paperConfig.autoReplenishLootables) {
|
+ if (paperConfig.autoReplenishLootables) {
|
||||||
+ int min = paperConfig.lootableRegenMin * 1000;
|
+ int min = paperConfig.lootableRegenMin;
|
||||||
+ int max = paperConfig.lootableRegenMax * 1000;
|
+ int max = paperConfig.lootableRegenMax;
|
||||||
+ this.nextRefill = this.lastFill + min + RANDOM.nextInt(max - min + 1);
|
+ this.nextRefill = this.lastFill + (min + RANDOM.nextInt(max - min + 1)) * 1000L;
|
||||||
+ this.numRefills++;
|
+ this.numRefills++;
|
||||||
+ if (paperConfig.changeLootTableSeedOnFill) {
|
+ if (paperConfig.changeLootTableSeedOnFill) {
|
||||||
+ this.lootable.setLootTableSeed(0);
|
+ this.lootable.setLootTableSeed(0);
|
||||||
|
|
Loading…
Reference in a new issue