summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockCommand.patch
blob: 12a88a41add0e8708167c0bcc2347f383c5c2fe1 (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
--- a/net/minecraft/server/BlockCommand.java
+++ b/net/minecraft/server/BlockCommand.java
@@ -4,6 +4,8 @@
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
 public class BlockCommand extends BlockTileEntity {
 
     private static final Logger c = LogManager.getLogger();
@@ -30,6 +32,15 @@
                 TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
                 boolean flag = world.isBlockIndirectlyPowered(blockposition);
                 boolean flag1 = tileentitycommand.f();
+                // CraftBukkit start
+                org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+                int old = flag1 ? 15 : 0;
+                int current = flag ? 15 : 0;
+
+                BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+                world.getServer().getPluginManager().callEvent(eventRedstone);
+                flag = eventRedstone.getNewCurrent() > 0;
+                // CraftBukkit end
 
                 tileentitycommand.a(flag);
                 if (!flag1 && !tileentitycommand.h() && tileentitycommand.l() != TileEntityCommand.Type.SEQUENCE) {