Skip to content

Commit 41660c9

Browse files
committed
Release 1.4.2 for 1.9.x
Fixed the BrewEvent firing and double distilling sometimes in 1.9
1 parent bf57320 commit 41660c9

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.dre</groupId>
66
<artifactId>brewery</artifactId>
7-
<version>1.4.1</version>
7+
<version>1.4.2</version>
88
<name>Brewery</name>
99

1010
<properties>

src/com/dre/brewery/P.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ public void onEnable() {
6969
String v = Bukkit.getBukkitVersion();
7070
useUUID = !v.matches(".*1\\.[0-6].*") && !v.matches(".*1\\.7\\.[0-5].*");
7171
use1_9 = !v.matches(".*1\\.[0-8].*");
72-
if (use1_9) {
73-
log("&eExperimental support for Bukkit 1.9 enabled.");
74-
}
7572

7673
// load the Config
7774
try {

src/com/dre/brewery/listeners/InventoryListener.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void run() {
115115
if (now instanceof BrewingStand) {
116116
BrewingStand stand = (BrewingStand) now;
117117
if (brewTime == DISTILLTIME) { // only check at the beginning (and end) for distillables
118-
if (!isCustomAndDistill(stand.getInventory())) {
118+
if (!isCustom(stand.getInventory(), true)) {
119119
this.cancel();
120120
trackedBrewers.remove(brewery);
121121
P.p.debugLog("nothing to distill");
@@ -150,7 +150,7 @@ public void run() {
150150
}.runTaskTimer(P.p, 2L, 1L).getTaskId());
151151
}
152152

153-
private boolean isCustomAndDistill(BrewerInventory brewer) {
153+
private boolean isCustom(BrewerInventory brewer, boolean distill) {
154154
ItemStack item = brewer.getItem(3); // ingredient
155155
if (item == null || Material.GLOWSTONE_DUST != item.getType()) return false; // need dust in the top slot.
156156
for (int slot = 0; slot < 3; slot++) {
@@ -160,7 +160,7 @@ private boolean isCustomAndDistill(BrewerInventory brewer) {
160160
if (item.hasItemMeta()) {
161161
int uid = Brew.getUID(item);
162162
Brew pot = Brew.potions.get(uid);
163-
if (pot != null && pot.canDistill()) { // need at least one distillable potion.
163+
if (pot != null && (!distill || pot.canDistill())) { // need at least one distillable potion.
164164
return true;
165165
}
166166
}
@@ -172,6 +172,12 @@ private boolean isCustomAndDistill(BrewerInventory brewer) {
172172

173173
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
174174
public void onBrew(BrewEvent event) {
175+
if (P.use1_9) {
176+
if (isCustom(event.getContents(), false)) {
177+
event.setCancelled(true);
178+
}
179+
return;
180+
}
175181
if (runDistill(event.getContents())) {
176182
event.setCancelled(true);
177183
}

0 commit comments

Comments
 (0)