From 8b371226fbe8b823ed2e043626ce4b43cade0a41 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Wed, 13 Jun 2018 20:15:31 +0200
Subject: [PATCH] Avoid int overflow in lootable refill time calculations
 (#1146)

Fixes https://github.com/PaperMC/Paper/issues/1141
---
 ...otTable-API-Replenishable-Lootables-Feature.patch | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Spigot-Server-Patches/0123-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0123-LootTable-API-Replenishable-Lootables-Feature.patch
index dbf31441da..e864ff5c23 100644
--- a/Spigot-Server-Patches/0123-LootTable-API-Replenishable-Lootables-Feature.patch
+++ b/Spigot-Server-Patches/0123-LootTable-API-Replenishable-Lootables-Feature.patch
@@ -1,4 +1,4 @@
-From 5819a09940af69a152ca201f2d8ad27a19508928 Mon Sep 17 00:00:00 2001
+From 72ecf0a094c609382a42d214b204499eb35c00fd Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Sun, 1 May 2016 21:19:14 -0400
 Subject: [PATCH] LootTable API & Replenishable Lootables Feature
@@ -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
 new file mode 100644
-index 000000000..01c2713d3
+index 000000000..de2eff17e
 --- /dev/null
 +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
 @@ -0,0 +1,182 @@
@@ -326,9 +326,9 @@ index 000000000..01c2713d3
 +        this.lastFill = System.currentTimeMillis();
 +        final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig;
 +        if (paperConfig.autoReplenishLootables) {
-+            int min = paperConfig.lootableRegenMin * 1000;
-+            int max = paperConfig.lootableRegenMax * 1000;
-+            this.nextRefill = this.lastFill + min + RANDOM.nextInt(max - min + 1);
++            int min = paperConfig.lootableRegenMin;
++            int max = paperConfig.lootableRegenMax;
++            this.nextRefill = this.lastFill + (min + RANDOM.nextInt(max - min + 1)) * 1000L;
 +            this.numRefills++;
 +            if (paperConfig.changeLootTableSeedOnFill) {
 +                this.lootable.setLootTableSeed(0);
@@ -791,5 +791,5 @@ index e9963e21c..acb4dee04 100644
  
      CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) {
 -- 
-2.16.1
+2.16.1.windows.1