diff --git a/config.yml b/config.yml
index b1bfbf8..dfd7b91 100644
--- a/config.yml
+++ b/config.yml
@@ -263,6 +263,17 @@ distortCommands:
- /fl
- /s
- /letter
+- /g
+- /l
+- /lokal
+- /local
+- /mail send
+- /m
+- /msg
+- /w
+- /whisper
+- /reply
+- /r
# Distort the Text written on a Sign while drunk [false]
distortSignText: false
diff --git a/plugin.yml b/plugin.yml
index 6a2f735..1f9dacf 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,5 +1,5 @@
name: Brewery
-version: 1.2
+version: 1.3
main: com.dre.brewery.P
authors: [Milan Albrecht, Frank Baumann]
softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention]
diff --git a/pom.xml b/pom.xml
index 95e1b17..9f19a2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.dre
brewery
- 1.2
+ 1.3
Brewery
diff --git a/src/com/dre/brewery/BCauldron.java b/src/com/dre/brewery/BCauldron.java
index c5d35bf..a7a47d4 100644
--- a/src/com/dre/brewery/BCauldron.java
+++ b/src/com/dre/brewery/BCauldron.java
@@ -36,7 +36,7 @@ public class BCauldron {
public void onUpdate() {
// Check if fire still alive
- if (block.getRelative(BlockFace.DOWN).getType() == Material.FIRE || block.getRelative(BlockFace.DOWN).getType() == Material.STATIONARY_LAVA
+ if (!block.getChunk().isLoaded() || block.getRelative(BlockFace.DOWN).getType() == Material.FIRE || block.getRelative(BlockFace.DOWN).getType() == Material.STATIONARY_LAVA
|| block.getRelative(BlockFace.DOWN).getType() == Material.LAVA) {
// add a minute to cooking time
state++;
diff --git a/src/com/dre/brewery/Barrel.java b/src/com/dre/brewery/Barrel.java
index f8f4e8b..79d4bbf 100644
--- a/src/com/dre/brewery/Barrel.java
+++ b/src/com/dre/brewery/Barrel.java
@@ -18,6 +18,7 @@ import org.bukkit.material.MaterialData;
import org.bukkit.material.Stairs;
import org.bukkit.material.Tree;
import org.bukkit.plugin.Plugin;
+import org.bukkit.scheduler.BukkitRunnable;
import com.dre.brewery.integration.GriefPreventionBarrel;
import com.dre.brewery.integration.LWCBarrel;
@@ -29,12 +30,13 @@ import org.apache.commons.lang.ArrayUtils;
public class Barrel {
public static CopyOnWriteArrayList barrels = new CopyOnWriteArrayList();
+ private static int check = 0;
private Block spigot;
private int[] woodsloc = null; // location of wood Blocks
private int[] stairsloc = null; // location of stair Blocks
private byte signoffset;
- private boolean checked = false;
+ private boolean checked;
private Inventory inventory;
private float time;
@@ -90,26 +92,19 @@ public class Barrel {
}
public static void onUpdate() {
- Block broken;
for (Barrel barrel : barrels) {
- if (!barrel.checked) {
- broken = barrel.getBrokenBlock(false);
- if (broken != null) {
- // remove the barrel if it was destroyed
- barrel.willDestroy();
- barrel.remove(broken, null);
- continue;
- } else {
- // Dont check this barrel again, its enough to check it once after every restart
- // as now this is only the backup if we dont register the barrel breaking, as sample
- // when removing it with some world editor
- barrel.checked = true;
- }
- }
-
// Minecraft day is 20 min, so add 1/20 to the time every minute
barrel.time += (1.0 / 20.0);
}
+ if (check == 0 && barrels.size() > 0) {
+ Barrel random = barrels.get((int) Math.floor(Math.random() * barrels.size()));
+ if (random != null) {
+ // You have been selected for a random search
+ // We want to check at least one barrel every time
+ random.checked = false;
+ }
+ new BarrelCheck().runTaskTimer(P.p, 1, 1);
+ }
}
public boolean hasPermsOpen(Player player, PlayerInteractEvent event) {
@@ -894,4 +889,38 @@ public class Barrel {
return null;
}
+ public static class BarrelCheck extends BukkitRunnable {
+ @Override
+ public void run() {
+ boolean repeat = true;
+ while (repeat) {
+ if (check < barrels.size()) {
+ Barrel barrel = barrels.get(check);
+ if (!barrel.checked) {
+ Block broken = barrel.getBrokenBlock(false);
+ if (broken != null) {
+ P.p.debugLog("Barrel at " + broken.getWorld().getName() + "/" + broken.getX() + "/" + broken.getY() + "/" + broken.getZ()
+ + " has been destroyed unexpectedly, contents will drop");
+ // remove the barrel if it was destroyed
+ barrel.willDestroy();
+ barrel.remove(broken, null);
+ } else {
+ // Dont check this barrel again, its enough to check it once after every restart
+ // as now this is only the backup if we dont register the barrel breaking, as sample
+ // when removing it with some world editor
+ barrel.checked = true;
+ }
+ repeat = false;
+ }
+ check++;
+ } else {
+ check = 0;
+ repeat = false;
+ cancel();
+ }
+ }
+ }
+
+ }
+
}