patch #541, bump version

This commit is contained in:
jonah 2024-01-28 13:53:03 -05:00
parent 5c2acaa70e
commit 457a4ec1f3
3 changed files with 21 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.dre</groupId>
<artifactId>Brewery</artifactId>
<version>3.1.3</version>
<version>3.1.4</version>
<name>Brewery</name>
<properties>

View File

@ -384,7 +384,7 @@ public class BCauldron {
Block clickedBlock = event.getClickedBlock();
assert clickedBlock != null;
if (materialInHand == null || materialInHand == Material.AIR || materialInHand == Material.BUCKET) {
if (materialInHand == Material.AIR || materialInHand == Material.BUCKET) {
return;
} else if (materialInHand == LegacyUtil.CLOCK) {

View File

@ -2,14 +2,19 @@ package com.dre.brewery.listeners;
import com.dre.brewery.BCauldron;
import com.dre.brewery.utility.LegacyUtil;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Levelled;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.CauldronLevelChangeEvent;
import java.util.List;
public class CauldronListener implements Listener {
/**
@ -36,8 +41,9 @@ public class CauldronListener implements Listener {
}
} else { // newType == Material.WATER_CAULDRON
// Water level change
Levelled oldCauldron = ((Levelled) event.getBlock().getBlockData());
Levelled newCauldron = ((Levelled) newState.getBlockData());
Levelled oldCauldron = (Levelled) event.getBlock().getBlockData();
Levelled newCauldron = (Levelled) newState.getBlockData();
// Water Level increased somehow, might be Bucket, Bottle, Rain, etc.
if (newCauldron.getLevel() > oldCauldron.getLevel()) {
@ -47,6 +53,17 @@ public class CauldronListener implements Listener {
}
}
/* PATCH - "My friend found a way to dupe brews #541" https://github.com/DieReicheErethons/Brewery/issues/541
* Check if piston is pushing a BreweryCauldron and remove it
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPistonExtend(BlockPistonExtendEvent event) {
for (Block block : event.getBlocks()) {
if (BCauldron.bcauldrons.containsKey(block)) {
BCauldron.remove(block);
}
}
}
@SuppressWarnings("deprecation")
private void oldCauldronChange(CauldronLevelChangeEvent event) {