blob: c809229bc8a6e2896f5d333bbd28137581e34794 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--- a/net/minecraft/server/BlockTrapdoor.java
+++ b/net/minecraft/server/BlockTrapdoor.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTrapdoor extends BlockFacingHorizontal implements IFluidSource, IFluidContainer {
@@ -94,6 +95,19 @@
boolean flag = world.isBlockIndirectlyPowered(blockposition);
if (flag != ((Boolean) iblockdata.get(BlockTrapdoor.c)).booleanValue()) {
+ // CraftBukkit start
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ int power = bblock.getBlockPower();
+ int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
+
+ if (oldPower == 0 ^ power == 0 || block.getBlockData().isPowerSource()) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ flag = eventRedstone.getNewCurrent() > 0;
+ }
+ // CraftBukkit end
if (((Boolean) iblockdata.get(BlockTrapdoor.OPEN)).booleanValue() != flag) {
iblockdata = (IBlockData) iblockdata.set(BlockTrapdoor.OPEN, Boolean.valueOf(flag));
this.a((EntityHuman) null, world, blockposition, flag);
|