diff --git a/src/com/dre/brewery/BCauldron.java b/src/com/dre/brewery/BCauldron.java index 2264d40..930f85b 100644 --- a/src/com/dre/brewery/BCauldron.java +++ b/src/com/dre/brewery/BCauldron.java @@ -2,6 +2,7 @@ package com.dre.brewery; import java.util.concurrent.CopyOnWriteArrayList; +import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Levelled; import org.bukkit.entity.Player; import org.bukkit.Material; @@ -97,12 +98,17 @@ public class BCauldron { if (potion != null) { if (P.use1_13) { - Levelled cauldron = ((Levelled) block.getBlockData()); + BlockData data = block.getBlockData(); + Levelled cauldron = ((Levelled) data); if (cauldron.getLevel() <= 0) { bcauldrons.remove(bcauldron); return false; } cauldron.setLevel(cauldron.getLevel() - 1); + // Update the new Level to the Block + // We have to use the BlockData variable "data" here instead of the casted "cauldron" + // otherwise < 1.13 crashes on plugin load for not finding the BlockData Class + block.setBlockData(data); if (cauldron.getLevel() <= 0) { bcauldrons.remove(bcauldron); diff --git a/src/com/dre/brewery/Brew.java b/src/com/dre/brewery/Brew.java index c0b0315..7ba99a8 100644 --- a/src/com/dre/brewery/Brew.java +++ b/src/com/dre/brewery/Brew.java @@ -727,10 +727,12 @@ public class Brew { public void colorBrew(PotionMeta meta, ItemStack potion, boolean destillable) { if (P.use1_9) { - meta.setBasePotionData(new PotionData(getType())); meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); if (P.use1_12) { + // BasePotionData was only used for the Color, so starting with 1.12 we can use setColor instead meta.setColor(getColor()); + } else { + meta.setBasePotionData(new PotionData(getType())); } } else { potion.setDurability(getColorId(destillable)); diff --git a/src/com/dre/brewery/listeners/InventoryListener.java b/src/com/dre/brewery/listeners/InventoryListener.java index e6835f3..89c21cb 100644 --- a/src/com/dre/brewery/listeners/InventoryListener.java +++ b/src/com/dre/brewery/listeners/InventoryListener.java @@ -124,11 +124,18 @@ public class InventoryListener implements Listener { case 1: // Custom potion but not for distilling. Stop any brewing and cancel this task if (stand.getBrewingTime() > 0) { - // Brewing time is sent and stored as short - // This sends a negative short value to the Client - // In the client the Brewer will look like it is not doing anything - stand.setBrewingTime(Short.MAX_VALUE << 1); + if (P.use1_12) { + // The trick below doesnt work in 1.12, but we dont need it anymore + // This should only happen with older Brews that have been made with the old Potion Color System + stand.setBrewingTime(Short.MAX_VALUE); + } else { + // Brewing time is sent and stored as short + // This sends a negative short value to the Client + // In the client the Brewer will look like it is not doing anything + stand.setBrewingTime(Short.MAX_VALUE << 1); + } stand.setFuelLevel(fuel); + stand.update(); } case 0: // No custom potion, cancel and ignore @@ -148,19 +155,20 @@ public class InventoryListener implements Listener { stand.setBrewingTime((int) ((float) brewTime / ((float) runTime / (float) DISTILLTIME)) + 1); if (brewTime <= 1) { // Done! + stand.setBrewingTime(0); + stand.update(); BrewerInventory brewer = stand.getInventory(); if (!runDistill(brewer)) { this.cancel(); trackedBrewers.remove(brewery); - stand.setBrewingTime(0); P.p.debugLog("All done distilling"); } else { brewTime = -1; // go again. - stand.setBrewingTime(0); P.p.debugLog("Can distill more! Continuing."); } + } else { + stand.update(); } - stand.update(); } else { this.cancel(); trackedBrewers.remove(brewery); diff --git a/src/com/dre/brewery/listeners/TabListener.java b/src/com/dre/brewery/listeners/TabListener.java index 0e8f57b..20d7e17 100644 --- a/src/com/dre/brewery/listeners/TabListener.java +++ b/src/com/dre/brewery/listeners/TabListener.java @@ -17,7 +17,7 @@ public class TabListener implements TabCompleter { private static final List topCompletions = new ArrayList<>(2); static { - completions.put("", Arrays.asList("info", "unlabel")); + completions.put("", Arrays.asList("info", "unlabel", "help")); topCompletions.add("brew"); //topCompletions.add("brewery"); }