From 76976ba12dbca86ba109d68c1488fcfb80bffe07 Mon Sep 17 00:00:00 2001 From: ProgrammerDan Date: Wed, 20 Apr 2016 17:17:23 -0400 Subject: [PATCH] qfix for infinite loop and brewtime --- src/com/dre/brewery/listeners/InventoryListener.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/com/dre/brewery/listeners/InventoryListener.java b/src/com/dre/brewery/listeners/InventoryListener.java index fc3cfc8..6290018 100644 --- a/src/com/dre/brewery/listeners/InventoryListener.java +++ b/src/com/dre/brewery/listeners/InventoryListener.java @@ -80,6 +80,7 @@ public class InventoryListener implements Listener { P.p.log("Starting a new brew countdown"); trackedBrewers.put(brewery, new BukkitRunnable() { + private int brewTime = 405; @Override public void run() { BlockState now = brewery.getState(); @@ -89,13 +90,10 @@ public class InventoryListener implements Listener { BrewerInventory brewer = stand.getInventory(); if (isCustom(brewer) ) { P.p.log("Still a valid brew distillation"); - if (stand.getBrewingTime() == 0) { - stand.setBrewingTime(400); // arbitrary for now - } else { - stand.setBrewingTime(stand.getBrewingTime() - 5); // count down. - } + brewTime = brewTime - 5; // count down. + stand.setBrewingTime(brewTime); // arbitrary for now - if (stand.getBrewingTime() <= 5) { // trigger. + if (brewTime <= 5) { // trigger. P.p.log("Complete brew distillation!"); BrewEvent doBrew = new BrewEvent(brewery, brewer); Bukkit.getServer().getPluginManager().callEvent(doBrew); @@ -129,6 +127,7 @@ public class InventoryListener implements Listener { } } } + slot++; } return false; }