qfix for infinite loop and brewtime

This commit is contained in:
ProgrammerDan 2016-04-20 17:17:23 -04:00
parent 54e47bcf02
commit 76976ba12d

View File

@ -80,6 +80,7 @@ public class InventoryListener implements Listener {
P.p.log("Starting a new brew countdown"); P.p.log("Starting a new brew countdown");
trackedBrewers.put(brewery, new BukkitRunnable() { trackedBrewers.put(brewery, new BukkitRunnable() {
private int brewTime = 405;
@Override @Override
public void run() { public void run() {
BlockState now = brewery.getState(); BlockState now = brewery.getState();
@ -89,13 +90,10 @@ public class InventoryListener implements Listener {
BrewerInventory brewer = stand.getInventory(); BrewerInventory brewer = stand.getInventory();
if (isCustom(brewer) ) { if (isCustom(brewer) ) {
P.p.log("Still a valid brew distillation"); P.p.log("Still a valid brew distillation");
if (stand.getBrewingTime() == 0) { brewTime = brewTime - 5; // count down.
stand.setBrewingTime(400); // arbitrary for now stand.setBrewingTime(brewTime); // arbitrary for now
} else {
stand.setBrewingTime(stand.getBrewingTime() - 5); // count down.
}
if (stand.getBrewingTime() <= 5) { // trigger. if (brewTime <= 5) { // trigger.
P.p.log("Complete brew distillation!"); P.p.log("Complete brew distillation!");
BrewEvent doBrew = new BrewEvent(brewery, brewer); BrewEvent doBrew = new BrewEvent(brewery, brewer);
Bukkit.getServer().getPluginManager().callEvent(doBrew); Bukkit.getServer().getPluginManager().callEvent(doBrew);
@ -129,6 +127,7 @@ public class InventoryListener implements Listener {
} }
} }
} }
slot++;
} }
return false; return false;
} }