mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
39 lines
1.7 KiB
Diff
39 lines
1.7 KiB
Diff
--- a/net/minecraft/server/BlockCommand.java
|
|
+++ b/net/minecraft/server/BlockCommand.java
|
|
@@ -3,6 +3,8 @@
|
|
import java.util.Random;
|
|
import javax.annotation.Nullable;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockCommand extends BlockTileEntity {
|
|
|
|
public static final BlockStateDirection a = BlockDirectional.FACING;
|
|
@@ -30,7 +32,16 @@
|
|
boolean flag1 = tileentitycommand.g();
|
|
boolean flag2 = tileentitycommand.h();
|
|
|
|
- if (flag && !flag1) {
|
|
+ // 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);
|
|
+ // CraftBukkit end
|
|
+
|
|
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
|
|
tileentitycommand.a(true);
|
|
if (tileentitycommand.k() != TileEntityCommand.Type.SEQUENCE && !flag2) {
|
|
boolean flag3 = !tileentitycommand.l() || this.e(world, blockposition, iblockdata);
|
|
@@ -41,7 +52,7 @@
|
|
this.c(world, blockposition);
|
|
}
|
|
}
|
|
- } else if (!flag && flag1) {
|
|
+ } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
|
|
tileentitycommand.a(false);
|
|
}
|
|
|