summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-03-16 21:02:02 +0100
committerErik Broes <erikbroes@grum.nl>2011-03-21 00:30:00 +0100
commit11590f49f0f03a2da43583e806f218bf7b56e34c (patch)
treeec3ed72580e400de449cece2a5e637cbe466818d /src/main/java/net/minecraft/server/BlockRedstoneTorch.java
parent437025a179b670af6b15caff6d0f5db9f907951d (diff)
downloadcraftbukkit-11590f49f0f03a2da43583e806f218bf7b56e34c.tar
craftbukkit-11590f49f0f03a2da43583e806f218bf7b56e34c.tar.gz
craftbukkit-11590f49f0f03a2da43583e806f218bf7b56e34c.tar.lz
craftbukkit-11590f49f0f03a2da43583e806f218bf7b56e34c.tar.xz
craftbukkit-11590f49f0f03a2da43583e806f218bf7b56e34c.zip
Redstone torch fix
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockRedstoneTorch.java')
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index d8c0ca90..85f4b259 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -7,6 +7,7 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.block.BlockRedstoneEvent;
+import org.bukkit.plugin.PluginManager;
// CraftBukkit end
public class BlockRedstoneTorch extends BlockTorch {
@@ -100,15 +101,22 @@ public class BlockRedstoneTorch extends BlockTorch {
// CraftBukkit start
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
- BlockRedstoneEvent event = new BlockRedstoneEvent(block, flag ? 15 : 0, flag ? 0 : 15);
- ((WorldServer) world).getServer().getPluginManager().callEvent(event);
- if ((event.getNewCurrent() != 0) == flag) {
- return;
- }
+ PluginManager man = ((WorldServer) world).getServer().getPluginManager();
+ int oldCurrent = this.a ? 15 : 0;
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
// CraftBukkit end
if (this.a) {
if (flag) {
+ // CraftBukkit start
+ if (oldCurrent != 0) {
+ event.setNewCurrent(0);
+ man.callEvent(event);
+ if (event.getNewCurrent() != 0) {
+ return;
+ }
+ }
+ // CraftBukkit end
world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
if (this.a(world, i, j, k, true)) {
world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
@@ -123,6 +131,15 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
} else if (!flag && !this.a(world, i, j, k, false)) {
+ // CraftBukkit start
+ if (oldCurrent != 15) {
+ event.setNewCurrent(15);
+ man.callEvent(event);
+ if (event.getNewCurrent() != 15) {
+ return;
+ }
+ }
+ // CraftBukkit end
world.b(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
}
}